fix: charger current return int
This commit is contained in:
@@ -67,13 +67,13 @@ class EaseeSolarCoordinator(DataUpdateCoordinator):
|
|||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_charger_current_a(self) -> float | None:
|
def _get_charger_current_a(self) -> int | None:
|
||||||
entity_id = f"sensor.{self.charger_id.lower()}_current"
|
entity_id = f"sensor.{self.charger_id.lower()}_current"
|
||||||
state = self.hass.states.get(entity_id)
|
state = self.hass.states.get(entity_id)
|
||||||
if state is None or state.state in ("unknown", "unavailable"):
|
if state is None or state.state in ("unknown", "unavailable"):
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return float(state.state)
|
return round(float(state.state))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user