mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add Shelly Pro 3EM energy sensors (#86476)
* Add Shelly Pro 3EM energy sensors * Add total and total returned energy counters * Set single phase energy counters disabled by default
This commit is contained in:
parent
0de7be7803
commit
3cb9b273c9
@ -465,6 +465,84 @@ RPC_SENSORS: Final = {
|
|||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
|
"total_act": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="total_act",
|
||||||
|
name="Total active energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
),
|
||||||
|
"a_total_act_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="a_total_act_energy",
|
||||||
|
name="Phase A total active energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
|
"b_total_act_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="b_total_act_energy",
|
||||||
|
name="Phase B total active energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
|
"c_total_act_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="c_total_act_energy",
|
||||||
|
name="Phase C total active energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
|
"total_act_ret": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="total_act_ret",
|
||||||
|
name="Total active returned energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
),
|
||||||
|
"a_total_act_ret_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="a_total_act_ret_energy",
|
||||||
|
name="Phase A total active returned energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
|
"b_total_act_ret_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="b_total_act_ret_energy",
|
||||||
|
name="Phase B total active returned energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
|
"c_total_act_ret_energy": RpcSensorDescription(
|
||||||
|
key="emdata",
|
||||||
|
sub_key="c_total_act_ret_energy",
|
||||||
|
name="Phase C total active returned energy",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
value=lambda status, _: round(float(status) / 1000, 2),
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
),
|
||||||
"temperature": RpcSensorDescription(
|
"temperature": RpcSensorDescription(
|
||||||
key="switch",
|
key="switch",
|
||||||
sub_key="temperature",
|
sub_key="temperature",
|
||||||
|
@ -284,6 +284,7 @@ def get_model_name(info: dict[str, Any]) -> str:
|
|||||||
|
|
||||||
def get_rpc_channel_name(device: RpcDevice, key: str) -> str:
|
def get_rpc_channel_name(device: RpcDevice, key: str) -> str:
|
||||||
"""Get name based on device and channel name."""
|
"""Get name based on device and channel name."""
|
||||||
|
key = key.replace("emdata", "em")
|
||||||
if device.config.get("switch:0"):
|
if device.config.get("switch:0"):
|
||||||
key = key.replace("input", "switch")
|
key = key.replace("input", "switch")
|
||||||
device_name = device.name
|
device_name = device.name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user