-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Quantum gateway data coordinator #146007
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
base: dev
Are you sure you want to change the base?
Quantum gateway data coordinator #146007
Conversation
Hey there @cisasteelersfan, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
coordinator = QuantumGatewayCoordinator(hass, options) | ||
|
||
try: | ||
await coordinator._async_setup() # noqa: SLF001 |
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.
Is there a better way of manually initializing the data coordinator? I'm not using async_config_entry_first_refresh
because there's no config entry yet!
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.
async_refresh
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.
hmm, async_refresh doesn't seem to call _async_setup
to initialize the coordinator. Do you recommend using a different API for doing initial setup?
93c3657
to
94d0e3a
Compare
4036e2c
to
ff81336
Compare
CONFIG_SCHEMA = vol.Schema( | ||
{DEVICE_TRACKER_DOMAIN: [PLATFORM_SCHEMA]}, | ||
extra=vol.ALLOW_EXTRA, | ||
) | ||
|
||
|
||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: | ||
"""Set up the Quantum Gateway component.""" |
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.
We should maintain the current entrypoint, so we should use the device_tracker async_setup_platform instead
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.
Hey Joost, I'm not sure what you mean. Should be initializing the coordinator in the device_scanner async_get_scanner by reverting this change?
ff81336#diff-2b177940cc8b47dd3c46b82c10defa53607dd9898e1cdfa4b89291c1edc8b9eaL30-L43
My reasoning for moving the initialization here was to reduce the amount of changes when switching to a config entry, but I'm happy to switch it back if this is what you mean.
coordinator = QuantumGatewayCoordinator(hass, options) | ||
|
||
try: | ||
await coordinator._async_setup() # noqa: SLF001 |
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.
async_refresh
|
||
return scanner if scanner.success_init else None | ||
return QuantumGatewayDeviceScanner(hass, coordinator) | ||
|
||
|
||
class QuantumGatewayDeviceScanner(DeviceScanner): |
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.
I think we should need to make this a CoordinatorEntity
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.
Hey Joost, I've made the update to use a CoordinatorEntity, but I'm a bit confused; isn't this the class representing the scanner itself as opposed to entities it creates for the scanned devices?
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
ff81336
to
731b4a3
Compare
Breaking change
Proposed change
This PR updates the Quantum Gateway device tracker to use a DataCorrdinator for handling its polling for data. This is another step in the path to updating the Quantum Gateway integration to be setup through the UI.
The main change in the PR is that the Quantum Gateway scanner is now initialized at component setup instead of the device tracker platform setup.
Type of change
Additional information
n/a
Checklist
ruff format 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
.To help with the load of incoming pull requests: