From f754252278f86a35b74cda3766bf4c02457bb189 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 29 Aug 2023 16:57:08 +0200 Subject: [PATCH] add Error state to runningState the entity runningState has a new value Error when runningState is 2 --- custom_components/saj_esolar/sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/saj_esolar/sensor.py b/custom_components/saj_esolar/sensor.py index 276fa00..97b4a95 100644 --- a/custom_components/saj_esolar/sensor.py +++ b/custom_components/saj_esolar/sensor.py @@ -870,8 +870,10 @@ async def async_update(self): if energy['plantDetail']["runningState"] is not None: if int(energy['plantDetail']["runningState"]) is 0: self._state = "No" - else: + elif int(energy['plantDetail']["runningState"]) is 1 self._state = "Yes" + else: + self._state = "Error" if self._type == 'todayElectricity': if 'todayElectricity' in energy['plantDetail']: if energy['plantDetail']["todayElectricity"] is not None: @@ -1198,4 +1200,4 @@ async def async_update(self): # -Debug- adding sensor - _LOGGER.debug(f"Device: {self._type} State: {self._state}") \ No newline at end of file + _LOGGER.debug(f"Device: {self._type} State: {self._state}")