From 3733aa9494a695cba63e26f4afa3610091d8f9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Thu, 10 Feb 2022 08:47:34 +0100 Subject: [PATCH] Add more sensors for users with Tibber Pulse (#66201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Tibber, Add stats and sensors for homes with real time meter Signed-off-by: Daniel Hjelseth Høyer * Tibber stats Signed-off-by: Daniel Hjelseth Høyer * Monthly peak hour --- homeassistant/components/tibber/manifest.json | 2 +- homeassistant/components/tibber/sensor.py | 14 +++++++------- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/tibber/manifest.json b/homeassistant/components/tibber/manifest.json index 90a19526c7c..9b84b9a54c2 100644 --- a/homeassistant/components/tibber/manifest.json +++ b/homeassistant/components/tibber/manifest.json @@ -3,7 +3,7 @@ "domain": "tibber", "name": "Tibber", "documentation": "https://www.home-assistant.io/integrations/tibber", - "requirements": ["pyTibber==0.21.7"], + "requirements": ["pyTibber==0.22.1"], "codeowners": ["@danielhiversen"], "quality_scale": "silver", "config_flow": true, diff --git a/homeassistant/components/tibber/sensor.py b/homeassistant/components/tibber/sensor.py index eeb072e3a62..ebb986d6a7e 100644 --- a/homeassistant/components/tibber/sensor.py +++ b/homeassistant/components/tibber/sensor.py @@ -210,7 +210,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = ( ), SensorEntityDescription( key="peak_hour", - name="Month peak hour consumption", + name="Monthly peak hour consumption", device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, ), @@ -253,17 +253,17 @@ async def async_setup_entry( if home.has_active_subscription: entities.append(TibberSensorElPrice(home)) + if coordinator is None: + coordinator = TibberDataCoordinator(hass, tibber_connection) + for entity_description in SENSORS: + entities.append(TibberDataSensor(home, coordinator, entity_description)) + if home.has_real_time_consumption: await home.rt_subscribe( TibberRtDataCoordinator( async_add_entities, home, hass ).async_set_updated_data ) - if home.has_active_subscription and not home.has_real_time_consumption: - if coordinator is None: - coordinator = TibberDataCoordinator(hass, tibber_connection) - for entity_description in SENSORS: - entities.append(TibberDataSensor(home, coordinator, entity_description)) # migrate old_id = home.info["viewer"]["home"]["meteringPointData"]["consumptionEan"] @@ -547,7 +547,7 @@ class TibberDataCoordinator(update_coordinator.DataUpdateCoordinator): hass, _LOGGER, name=f"Tibber {tibber_connection.name}", - update_interval=timedelta(hours=1), + update_interval=timedelta(minutes=20), ) self._tibber_connection = tibber_connection diff --git a/requirements_all.txt b/requirements_all.txt index 7245f7970fd..5376c7a5f11 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1362,7 +1362,7 @@ pyRFXtrx==0.27.1 # pySwitchmate==0.4.6 # homeassistant.components.tibber -pyTibber==0.21.7 +pyTibber==0.22.1 # homeassistant.components.dlink pyW215==0.7.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 3b024a1ac32..ae3fe7eb5c4 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -854,7 +854,7 @@ pyMetno==0.9.0 pyRFXtrx==0.27.1 # homeassistant.components.tibber -pyTibber==0.21.7 +pyTibber==0.22.1 # homeassistant.components.nextbus py_nextbusnext==0.1.5