Skip to content

Commit

Permalink
Made energy data not update on a schedule by default, added docs for …
Browse files Browse the repository at this point in the history
…this new behavior
  • Loading branch information
signalkraft committed Jan 4, 2025
1 parent 0258677 commit de1492c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
8 changes: 6 additions & 2 deletions custom_components/mypyllant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mypyllant/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mypyllant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 21 additions & 2 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit de1492c

Please sign in to comment.