Skip to content

Commit

Permalink
Add isAlarm for storage devices
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen1987 committed Aug 22, 2022
1 parent 77a9031 commit 9d0dcc8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ H1 Sensors:
- lastUploadTime
- totalPlantTreeNum
- totalReduceCo2
- todayAlarmNum
- status
- plantuid
- currency
Expand All @@ -100,6 +99,7 @@ H1 Sensors:
- selfConsumedEnergy1
- selfConsumedEnergy2
- batCapcity
- isAlarm
- batCurr
- batEnergyPercent
- batteryDirection
Expand Down
10 changes: 10 additions & 0 deletions custom_components/saj_esolar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def add_years(d, years):
"chargeElec",
"dischargeElec",
"batCapcity",
"isAlarm",
"batCurr",
"batEnergyPercent",
"batteryDirection",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion info.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ H1 Sensors:
- lastUploadTime
- totalPlantTreeNum
- totalReduceCo2
- todayAlarmNum
- status
- plantuid
- currency
Expand All @@ -100,6 +99,7 @@ H1 Sensors:
- selfConsumedEnergy1
- selfConsumedEnergy2
- batCapcity
- isAlarm
- batCurr
- batEnergyPercent
- batteryDirection
Expand Down

0 comments on commit 9d0dcc8

Please sign in to comment.