Add config entry for Flu Near You#32858
Conversation
|
Monitored conditions should be removed if all the data is fetched from the same API call. If it requires more calls, it is ok to allow enabling/disabling that. |
|
@balloob Two distinct API calls in this one. |
Kane610
left a comment
There was a problem hiding this comment.
Remember this is a major breaking change in regards to moving away from platform configuration, which isn't really reflected in the breaking change text.
| async def refresh(event_time): | ||
| """Refresh data from Flu Near You.""" | ||
| await fny.async_update() | ||
|
|
||
| hass.data[DOMAIN][DATA_LISTENER][config_entry.entry_id] = async_track_time_interval( | ||
| hass, refresh, DEFAULT_SCAN_INTERVAL | ||
| ) |
There was a problem hiding this comment.
Why are you not using the Data Update Coordinator? https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities
There was a problem hiding this comment.
Because I had no idea this was a thing? 😆
There was a problem hiding this comment.
A few things:
- FNY requires more than one API call. I could wrap them both in a single callback that gets passed to this, but that doesn't feel great.
2 The Data Update Coordinator doesn't appear to handle disabling/enabling of entities and the appropriate removal/addition of API calls.
There was a problem hiding this comment.
Data Update Coordinators will only refresh if they have at least 1 listener. So you can create two coordinators and let entities subscribe.
8e07f1c to
799ad18
Compare
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
|
@MartinHjelmare Thank you! I’ll address these in a future PR. |
Breaking change
The
configuration.yamlschema for this integration has changed; users will need to reconfigure the integration.Proposed change
This PR adds a config flow for Flu Near You. It also removes the ability to set the
monitored_conditionsconfiguration key (per ADR #0003).Now that
monitored_conditionscannot be configured, I should manage API usage (since disabling certain entities disables the need for those calls). I'm waiting on an answer #32291 (comment) – if it gets here in time, I'll include it here; otherwise, I'll include it in a future PR.Type of change
Example entry for
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: