Skip to content

Commit

Permalink
Merge pull request #881 from alandtse/alandtse-patch-4
Browse files Browse the repository at this point in the history
fix: check sensor value is valid before casting
  • Loading branch information
alandtse authored Mar 6, 2024
2 parents 895a207 + 2f2ddfd commit 83a5c72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/tesla_custom/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ class TeslaCarChargerPower(TeslaCarEntity, SensorEntity):
@property
def native_value(self) -> float:
"""Return the charger power."""
return float(self._car.charger_power)
return (
float(self._car.charger_power)
if self._car.charger_power is not None
else self._car.charger_power
)

@property
def extra_state_attributes(self):
Expand Down

0 comments on commit 83a5c72

Please sign in to comment.