From 97a025ccc128dba0b33b09348c434780e70d7a3b Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:16:09 +0200 Subject: [PATCH] Add sensor for self-consumption in solarlog (#119885) --- homeassistant/components/solarlog/sensor.py | 7 +++++++ homeassistant/components/solarlog/strings.json | 3 +++ 2 files changed, 10 insertions(+) diff --git a/homeassistant/components/solarlog/sensor.py b/homeassistant/components/solarlog/sensor.py index 0b5d56f1a9e..a0d6d4bc540 100644 --- a/homeassistant/components/solarlog/sensor.py +++ b/homeassistant/components/solarlog/sensor.py @@ -146,6 +146,13 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = ( state_class=SensorStateClass.TOTAL, value=lambda value: round(value / 1000, 3), ), + SolarLogSensorEntityDescription( + key="self_consumption_year", + translation_key="self_consumption_year", + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + ), SolarLogSensorEntityDescription( key="total_power", translation_key="total_power", diff --git a/homeassistant/components/solarlog/strings.json b/homeassistant/components/solarlog/strings.json index caa14ac01a6..f5f5e064294 100644 --- a/homeassistant/components/solarlog/strings.json +++ b/homeassistant/components/solarlog/strings.json @@ -79,6 +79,9 @@ "consumption_total": { "name": "Consumption total" }, + "self_consumption_year": { + "name": "Self-consumption year" + }, "total_power": { "name": "Installed peak power" },