Skip to content

Commit

Permalink
fix miles check max value of wrong value #109
Browse files Browse the repository at this point in the history
  • Loading branch information
leeyuentuen committed Feb 23, 2024
1 parent 11596a8 commit 5cb899c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ def state(self) -> StateType:
# prevent exponentianal value, we only give state value that is lower than the max value
if self.entity_description.max_value is not None:
if isinstance(self._sensor_data, str):
self._attr_native_value = int(self._attr_native_value)
if self._sensor_data > self.entity_description.max_value:
self._attr_native_value = int(self._sensor_data)
if self._attr_native_value > self.entity_description.max_value:
_LOGGER.warning("%s: Value %s is higher than max value %s", self.entity_description.key, self._attr_native_value, self.entity_description.max_value)
return None

Expand Down

0 comments on commit 5cb899c

Please sign in to comment.