From ffe9b7801f6ba37d3c58874d625b9f86b9d580d9 Mon Sep 17 00:00:00 2001 From: slyoldfox Date: Fri, 15 Mar 2024 12:05:10 +0100 Subject: [PATCH] Add missing mystrom sensor (#113225) Co-authored-by: TheJulianJES Co-authored-by: Franck Nijhof --- homeassistant/components/mystrom/sensor.py | 7 +++++++ homeassistant/components/mystrom/strings.json | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/homeassistant/components/mystrom/sensor.py b/homeassistant/components/mystrom/sensor.py index 5c096c87993..2c35d35dad6 100644 --- a/homeassistant/components/mystrom/sensor.py +++ b/homeassistant/components/mystrom/sensor.py @@ -30,6 +30,13 @@ class MyStromSwitchSensorEntityDescription(SensorEntityDescription): SENSOR_TYPES: tuple[MyStromSwitchSensorEntityDescription, ...] = ( + MyStromSwitchSensorEntityDescription( + key="avg_consumption", + translation_key="avg_consumption", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + value_fn=lambda device: device.consumedWs, + ), MyStromSwitchSensorEntityDescription( key="consumption", device_class=SensorDeviceClass.POWER, diff --git a/homeassistant/components/mystrom/strings.json b/homeassistant/components/mystrom/strings.json index 9ebd1c36df0..80d0866f6f4 100644 --- a/homeassistant/components/mystrom/strings.json +++ b/homeassistant/components/mystrom/strings.json @@ -17,5 +17,12 @@ "abort": { "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" } + }, + "entity": { + "sensor": { + "avg_consumption": { + "name": "Average consumption" + } + } } }