diff --git a/README.md b/README.md index 7ee1f6f..a20cc0e 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,6 @@ H1 Sensors: - lastUploadTime - totalPlantTreeNum - totalReduceCo2 - - todayAlarmNum - status - plantuid - currency @@ -100,6 +99,7 @@ H1 Sensors: - selfConsumedEnergy1 - selfConsumedEnergy2 - batCapcity + - isAlarm - batCurr - batEnergyPercent - batteryDirection diff --git a/custom_components/saj_esolar/sensor.py b/custom_components/saj_esolar/sensor.py index 5a6b7d1..8bf82a3 100644 --- a/custom_components/saj_esolar/sensor.py +++ b/custom_components/saj_esolar/sensor.py @@ -112,6 +112,7 @@ def add_years(d, years): "chargeElec", "dischargeElec", "batCapcity", + "isAlarm", "batCurr", "batEnergyPercent", "batteryDirection", @@ -401,6 +402,11 @@ def add_years(d, years): icon="mdi:solar-panel-large", native_unit_of_measurement="A⋅h" ), + SensorEntityDescription( + key="isAlarm", + name="isAlarm", + icon="mdi:solar-panel-large", + ), SensorEntityDescription( key="batCurr", name="batCurr", @@ -1003,6 +1009,10 @@ async def async_update(self): if 'batCapcity' in energy["storeDevicePower"]: if energy["storeDevicePower"]['batCapcity'] is not None: self._state = float(energy["storeDevicePower"]["batCapcity"]) + if self._type == 'isAlarm': + if 'isAlarm' in energy["storeDevicePower"]: + if energy["storeDevicePower"]['isAlarm'] is not None: + self._state = int(energy["storeDevicePower"]["isAlarm"]) if self._type == 'batCurr': if 'batCurr' in energy["storeDevicePower"]: if energy["storeDevicePower"]['batCurr'] is not None: diff --git a/info.md b/info.md index 7ee1f6f..a20cc0e 100644 --- a/info.md +++ b/info.md @@ -75,7 +75,6 @@ H1 Sensors: - lastUploadTime - totalPlantTreeNum - totalReduceCo2 - - todayAlarmNum - status - plantuid - currency @@ -100,6 +99,7 @@ H1 Sensors: - selfConsumedEnergy1 - selfConsumedEnergy2 - batCapcity + - isAlarm - batCurr - batEnergyPercent - batteryDirection