Improve Wemo setup speed#19563
Improve Wemo setup speed#19563MartinHjelmare merged 8 commits intohome-assistant:devfrom sqldiablo:wemo_improve_setup_speed
Conversation
Move WeMo device discovery to an async context so it won't block initial component setup from completing quickly.
MartinHjelmare
left a comment
There was a problem hiding this comment.
I don't see the benefit of this, and there are mistakes regarding I/O in the event loop and api use.
|
@MartinHjelmare I think I misunderstood some things here. I'm still getting used to how asyncio works. My hope was to allow the WeMo component to load quickly at startup by not having to wait for it to do its device discovery. That's why I moved the discovery process to a subroutine that I then called through hass.add_job(). If there's no good way to defer the discovery process until after setup of the component is complete, then we can close this PR. I was trying to eliminate the "taking a long time to load" messages at startup and make HA load faster on initial startup. |
|
Is there an event that fires at the end of the setup phase that I could listen for and then run the wemo device discovery? That would accomplish my goal of starting up faster by deferring wemo discovery until after setup is complete. |
|
We can listen for |
|
I've changed the way this works, per our conversation. This no longer adds an async task to run in the event loop, but rather listens for the start event and then schedules a wemo discovery scan immediately. This is copied from how the discovery component works. |
|
Marking this breaking change, since we change when discovery is run. |
|
Will this speed up static discovery as well? My Wemo devices are on another subnet and even though I have mDNS enabled, they're not discovered by HomeAssistant (Google Cast devices are discovered just fine though). Doing static discovery with the Wemo devices causes home assistant to hang or about 20 seconds before allowing me to log back in. |
|
Yep, it'll let HA start up a little faster, because it won't add the wemo devices until after HA has started up and let's you log in. |
|
I think that this change means I now need to change my homekit component to not auto_start. My wemo lights disappeared and I think it is because the wemo devices are discovered after, even though I have discovery disabled and my wemo devices statically defined. Is there an event I could setup an automation on to turn on homekit once wemo devices are loaded? This would be helpful. |
|
Please open an issue if you suspect a bug. If you need help please use our help channels: Merged PRs should not be used for support or bug reports. Thanks! |
Description:
Breaking change:
Move WeMo device discovery to run after home assistant start so it won't block initial component setup from completing quickly.
Example entry for
configuration.yaml(if applicable):wemo:Checklist:
tox. Your PR cannot be merged unless tests pass