Fix Shelly EM/3EM invalid energy value after reboot (#68052)

pull/68044/head^2
Shay Levy 2022-03-12 22:21:45 +02:00 committed by GitHub
parent 6831be67f4
commit eccf8c76fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -174,6 +174,7 @@ SENSORS: Final = {
value=lambda value: round(value / 1000, 2),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
available=lambda block: cast(int, block.energy) != -1,
),
("emeter", "energyReturned"): BlockSensorDescription(
key="emeter|energyReturned",
@ -182,6 +183,7 @@ SENSORS: Final = {
value=lambda value: round(value / 1000, 2),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
available=lambda block: cast(int, block.energyReturned) != -1,
),
("light", "energy"): BlockSensorDescription(
key="light|energy",