diff --git a/homeassistant/components/shelly/binary_sensor.py b/homeassistant/components/shelly/binary_sensor.py index c1c241a32ef..c9a13249aa8 100644 --- a/homeassistant/components/shelly/binary_sensor.py +++ b/homeassistant/components/shelly/binary_sensor.py @@ -3,6 +3,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_GAS, DEVICE_CLASS_MOISTURE, DEVICE_CLASS_OPENING, + DEVICE_CLASS_PROBLEM, DEVICE_CLASS_SMOKE, DEVICE_CLASS_VIBRATION, BinarySensorEntity, @@ -15,8 +16,18 @@ from .entity import ( ) SENSORS = { - ("device", "overtemp"): BlockAttributeDescription(name="overtemp"), - ("relay", "overpower"): BlockAttributeDescription(name="overpower"), + ("device", "overtemp"): BlockAttributeDescription( + name="Overheating", device_class=DEVICE_CLASS_PROBLEM + ), + ("device", "overpower"): BlockAttributeDescription( + name="Over Power", device_class=DEVICE_CLASS_PROBLEM + ), + ("light", "overpower"): BlockAttributeDescription( + name="Over Power", device_class=DEVICE_CLASS_PROBLEM + ), + ("relay", "overpower"): BlockAttributeDescription( + name="Over Power", device_class=DEVICE_CLASS_PROBLEM + ), ("sensor", "dwIsOpened"): BlockAttributeDescription( name="Door", device_class=DEVICE_CLASS_OPENING ), diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index 8e648a1a269..8a24a6380ed 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -40,6 +40,43 @@ SENSORS = { device_class=sensor.DEVICE_CLASS_POWER, default_enabled=False, ), + ("device", "power"): BlockAttributeDescription( + name="Power", + unit=POWER_WATT, + value=lambda value: round(value, 1), + device_class=sensor.DEVICE_CLASS_POWER, + ), + ("emeter", "power"): BlockAttributeDescription( + name="Power", + unit=POWER_WATT, + value=lambda value: round(value, 1), + device_class=sensor.DEVICE_CLASS_POWER, + ), + ("relay", "power"): BlockAttributeDescription( + name="Power", + unit=POWER_WATT, + value=lambda value: round(value, 1), + device_class=sensor.DEVICE_CLASS_POWER, + ), + ("device", "energy"): BlockAttributeDescription( + name="Energy", + unit=ENERGY_KILO_WATT_HOUR, + value=lambda value: round(value / 60 / 1000, 2), + device_class=sensor.DEVICE_CLASS_ENERGY, + ), + ("emeter", "energy"): BlockAttributeDescription( + name="Energy", + unit=ENERGY_KILO_WATT_HOUR, + value=lambda value: round(value / 1000, 2), + device_class=sensor.DEVICE_CLASS_ENERGY, + ), + ("light", "energy"): BlockAttributeDescription( + name="Energy", + unit=ENERGY_KILO_WATT_HOUR, + value=lambda value: round(value / 60 / 1000, 2), + device_class=sensor.DEVICE_CLASS_ENERGY, + default_enabled=False, + ), ("relay", "energy"): BlockAttributeDescription( name="Energy", unit=ENERGY_KILO_WATT_HOUR,