mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Evaluate AirVisual interval on reboot (#48392)
* Reevaluate interval on reboot (and periodically) * AirVisual update interval periodically * AirVisual : update periodically interval request * AirVisual : update sever request interval periodically * AirVisual : periodically update interval for server requests * AirVisual : periodic update for server interval * Airvisual : periodic update of server interval * AirVisual : periodic update of server interval * AirVisual : periodic update of interval request * Periodic interval update of server request * AirVisual : periodic update of interval request * Reassess interval request on periodic event * ReAssess interval between 2 requests during update * ReAssess interval between 2 requests periodically * Reassess interval of server requests periodically * Reassess the interval between 2 server requests * Reassess interval between 2 server requests * Reassess server requests interval periodically * Assess interval request after inserting instance
This commit is contained in:
parent
f5d9713bd5
commit
76d9c62900
@ -242,10 +242,6 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
update_method=async_update_data,
|
update_method=async_update_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
async_sync_geo_coordinator_update_intervals(
|
|
||||||
hass, config_entry.data[CONF_API_KEY]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Only geography-based entries have options:
|
# Only geography-based entries have options:
|
||||||
hass.data[DOMAIN][DATA_LISTENER][
|
hass.data[DOMAIN][DATA_LISTENER][
|
||||||
config_entry.entry_id
|
config_entry.entry_id
|
||||||
@ -275,6 +271,12 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
|
|
||||||
hass.data[DOMAIN][DATA_COORDINATOR][config_entry.entry_id] = coordinator
|
hass.data[DOMAIN][DATA_COORDINATOR][config_entry.entry_id] = coordinator
|
||||||
|
|
||||||
|
# Reassess the interval between 2 server requests
|
||||||
|
if CONF_API_KEY in config_entry.data:
|
||||||
|
async_sync_geo_coordinator_update_intervals(
|
||||||
|
hass, config_entry.data[CONF_API_KEY]
|
||||||
|
)
|
||||||
|
|
||||||
for platform in PLATFORMS:
|
for platform in PLATFORMS:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.async_forward_entry_setup(config_entry, platform)
|
hass.config_entries.async_forward_entry_setup(config_entry, platform)
|
||||||
@ -340,10 +342,7 @@ async def async_unload_entry(hass, config_entry):
|
|||||||
remove_listener = hass.data[DOMAIN][DATA_LISTENER].pop(config_entry.entry_id)
|
remove_listener = hass.data[DOMAIN][DATA_LISTENER].pop(config_entry.entry_id)
|
||||||
remove_listener()
|
remove_listener()
|
||||||
|
|
||||||
if (
|
if CONF_API_KEY in config_entry.data:
|
||||||
config_entry.data[CONF_INTEGRATION_TYPE]
|
|
||||||
== INTEGRATION_TYPE_GEOGRAPHY_COORDS
|
|
||||||
):
|
|
||||||
# Re-calculate the update interval period for any remaining consumers of
|
# Re-calculate the update interval period for any remaining consumers of
|
||||||
# this API key:
|
# this API key:
|
||||||
async_sync_geo_coordinator_update_intervals(
|
async_sync_geo_coordinator_update_intervals(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user