From de1492cd0251caf63e23ed04cd8ee5974b53c5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20D=C3=B6rner?= Date: Sat, 4 Jan 2025 17:06:56 +0100 Subject: [PATCH] Made energy data not update on a schedule by default, added docs for this new behavior --- custom_components/mypyllant/__init__.py | 8 ++++++-- custom_components/mypyllant/config_flow.py | 2 +- custom_components/mypyllant/const.py | 2 +- docs/docs/index.md | 23 ++++++++++++++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/custom_components/mypyllant/__init__.py b/custom_components/mypyllant/__init__.py index 3c79e77..9f33211 100644 --- a/custom_components/mypyllant/__init__.py +++ b/custom_components/mypyllant/__init__.py @@ -108,9 +108,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await system_coordinator.async_refresh() hass.data[DOMAIN][entry.entry_id]["system_coordinator"] = system_coordinator - # Daily data coordinator is updated hourly by default, but requests data for the whole day + # Daily data coordinator is fetched once by default (to get all entities), but not updated on a regular basis + # to prevent quota errors daily_data_coordinator = DailyDataCoordinator( - hass, api, entry, timedelta(seconds=update_interval_daily) + hass, + api, + entry, + timedelta(seconds=update_interval_daily) if update_interval_daily else None, ) _LOGGER.debug("Refreshing DailyDataCoordinator") await daily_data_coordinator.async_refresh() diff --git a/custom_components/mypyllant/config_flow.py b/custom_components/mypyllant/config_flow.py index f3a882c..88a9647 100644 --- a/custom_components/mypyllant/config_flow.py +++ b/custom_components/mypyllant/config_flow.py @@ -133,7 +133,7 @@ async def async_step_init( OPTION_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL ), ): positive_int, - vol.Required( + vol.Optional( OPTION_UPDATE_INTERVAL_DAILY, default=self.config_entry.options.get( OPTION_UPDATE_INTERVAL_DAILY, DEFAULT_UPDATE_INTERVAL_DAILY diff --git a/custom_components/mypyllant/const.py b/custom_components/mypyllant/const.py index ab65e9a..cc302ea 100644 --- a/custom_components/mypyllant/const.py +++ b/custom_components/mypyllant/const.py @@ -20,7 +20,7 @@ OPTION_FETCH_ENERGY_MANAGEMENT = "fetch_energy_management" OPTION_FETCH_EEBUS = "fetch_eebus" DEFAULT_UPDATE_INTERVAL = 60 # in seconds -DEFAULT_UPDATE_INTERVAL_DAILY = 7200 # in seconds +DEFAULT_UPDATE_INTERVAL_DAILY = None # Optional, in seconds DEFAULT_REFRESH_DELAY = 5 # in seconds DEFAULT_MANUAL_COOLING_DURATION = 30 # in days DEFAULT_COUNTRY = "germany" diff --git a/docs/docs/index.md b/docs/docs/index.md index 86a817e..7c02372 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -133,8 +133,27 @@ After setting up the integration, you can configure it further in Settings :mate ### Seconds between energy data updates -: Wait interval between updating sensors with hourly data. The energy data and efficiency sensors have a fixed hourly interval. - Setting this too low can cause "quota exceeded" errors. +: Wait interval between updating sensors with hourly data. Default is off, because querying for energy data can get + you blocked by Vaillant quite easily ("quota exceeded" errors). + + Most users seem to be OK with 7200s (2 hours) or more. + + You can also schedule your own updates with an automation, for example once a day just before midnight: + + ```yaml + description: "Update myVAILLANT energy data at midnight" + mode: single + triggers: + - trigger: time + at: "23:59:00" + conditions: [] + actions: + - action: homeassistant.update_entity + metadata: {} + data: + entity_id: + - sensor.home_heating_energy_efficiency + ``` You should restart Home Assistant after changing this setting.