-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Evaluate AirVisual interval on reboot #48392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm still a bit unclear on why this is necessary. We re-level the API call rate when we add a new instance: core/homeassistant/components/airvisual/__init__.py Lines 246 to 248 in 03b7b13
...or remove an instance: core/homeassistant/components/airvisual/__init__.py Lines 352 to 354 in 03b7b13
If we haven't added or removed an instance, why would we need to consider re-leveling with every API call? |
In fact, when HA restarts, it reloads all instance in an asynchrenous way. This triggers the issue.
==> in this scenario A&B are still with the default value 5minutes wheras is shall be higher |
That's why I put a re-evaluation on instanciation update. |
Great it works by moving the time of interval computing during the instanciation. |
The pull was performed without pylint issue, this time. |
@@ -343,10 +345,7 @@ async def async_unload_entry(hass, config_entry): | |||
remove_listener = hass.data[DOMAIN][DATA_LISTENER].pop(config_entry.entry_id) | |||
remove_listener() | |||
|
|||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, great catch! If someone added a name-based entry, this would not have happened previously, which is definitely a bug. 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
Your welcome! Thank you ! |
Proposed change
Upon HA initialisation, all AirVisual coordinators are initialized in asynchroneous way : they can be initialised at same time and so don't see each other. The server request interval is then not correct.
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: