From 2bd9918ee87d807bb2df5594cd4b0da85450806d Mon Sep 17 00:00:00 2001 From: Niv Steingarten Date: Fri, 21 Feb 2025 21:13:22 +0200 Subject: [PATCH] Add daily and monthly consumption sensors to the rympro integration (#137953) --- homeassistant/components/rympro/coordinator.py | 6 ++++++ homeassistant/components/rympro/sensor.py | 14 ++++++++++++++ homeassistant/components/rympro/strings.json | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/homeassistant/components/rympro/coordinator.py b/homeassistant/components/rympro/coordinator.py index 55e5f0f90df..6b49a065d35 100644 --- a/homeassistant/components/rympro/coordinator.py +++ b/homeassistant/components/rympro/coordinator.py @@ -42,6 +42,12 @@ class RymProDataUpdateCoordinator(DataUpdateCoordinator[dict[int, dict]]): try: meters = await self.rympro.last_read() for meter_id, meter in meters.items(): + meter["monthly_consumption"] = await self.rympro.monthly_consumption( + meter_id + ) + meter["daily_consumption"] = await self.rympro.daily_consumption( + meter_id + ) meter["consumption_forecast"] = await self.rympro.consumption_forecast( meter_id ) diff --git a/homeassistant/components/rympro/sensor.py b/homeassistant/components/rympro/sensor.py index 250e942fb4f..66ed41a4ce9 100644 --- a/homeassistant/components/rympro/sensor.py +++ b/homeassistant/components/rympro/sensor.py @@ -36,6 +36,20 @@ SENSOR_DESCRIPTIONS: tuple[RymProSensorEntityDescription, ...] = ( suggested_display_precision=3, value_key="read", ), + RymProSensorEntityDescription( + key="monthly_consumption", + translation_key="monthly_consumption", + state_class=SensorStateClass.TOTAL_INCREASING, + suggested_display_precision=3, + value_key="monthly_consumption", + ), + RymProSensorEntityDescription( + key="daily_consumption", + translation_key="daily_consumption", + state_class=SensorStateClass.TOTAL_INCREASING, + suggested_display_precision=3, + value_key="daily_consumption", + ), RymProSensorEntityDescription( key="monthly_forecast", translation_key="monthly_forecast", diff --git a/homeassistant/components/rympro/strings.json b/homeassistant/components/rympro/strings.json index 2c1e2ad93c9..589e91a6c6f 100644 --- a/homeassistant/components/rympro/strings.json +++ b/homeassistant/components/rympro/strings.json @@ -23,6 +23,12 @@ "total_consumption": { "name": "Total consumption" }, + "monthly_consumption": { + "name": "Monthly consumption" + }, + "daily_consumption": { + "name": "Daily consumption" + }, "monthly_forecast": { "name": "Monthly forecast" }