Skip to content

Commit c75ba8c

Browse files
committed
em01p
1 parent 725c35c commit c75ba8c

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ Or click here: [![Add Integration](https://my.home-assistant.io/badges/config_fl
5252
| Refoss Smart Wi-Fi Switch, R21 | All |
5353
| Refoss Smart Energy Monitor, EM06P | All |
5454
| Refoss Smart Energy Monitor, EM16P | All |
55+
| Refoss Smart Energy Monitor, EM01P | All |

custom_components/refoss_rpc/sensor.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,28 @@ class RefossSensorDescription(RefossEntityDescription, SensorEntityDescription):
301301
device_class=SensorDeviceClass.ENERGY,
302302
state_class=SensorStateClass.TOTAL_INCREASING,
303303
),
304+
"em_total_energy": RefossSensorDescription(
305+
key="em",
306+
sub_key="total_energy",
307+
name="Total Energy",
308+
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
309+
value=lambda status, _: None if status is None else float(status),
310+
suggested_display_precision=2,
311+
device_class=SensorDeviceClass.ENERGY,
312+
state_class=SensorStateClass.TOTAL_INCREASING,
313+
supported=lambda status: status.get("total_energy") is not None,
314+
),
315+
"em_total_ret_energy": RefossSensorDescription(
316+
key="em",
317+
sub_key="total_ret_energy",
318+
name="Total Return Energy",
319+
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
320+
value=lambda status, _: None if status is None else float(abs(status)),
321+
suggested_display_precision=2,
322+
device_class=SensorDeviceClass.ENERGY,
323+
state_class=SensorStateClass.TOTAL_INCREASING,
324+
supported=lambda status: status.get("total_ret_energy") is not None,
325+
),
304326
}
305327

306328

0 commit comments

Comments
 (0)