Decouple Konnected entity setup from discovery#16146
Decouple Konnected entity setup from discovery#16146balloob merged 2 commits intohome-assistant:devfrom
Conversation
|
This looks like a lot of changes, but it's really mostly moving code around and some simplification. I've split up the |
|
Great news! I've had to downgrade to an earlier version of the konnected mcu firmware because of this issue. My system was repeatedly getting into an unrecoverable unresponsive state, when restarting Hass after editing config. |
* decouple entity setup from discovery * validate that device_id is a full MAC address
|
@heythisisnate - So my python is weak but does this mean I no longer need to use discovery w/ konnected ? |
|
@johntdyer No, not quite. Discovery is still required for the devices to be fully set up and connected to Hass. This change is one step in that direction, allowing the entities to be created ahead of time before the device's network information is discovered. I plan on adding a manual IP configuration option in a future release. |
|
@heythisisnate you should implement a config flow that will do discovery once and store the IP in a config entry |
|
@balloob Thank you for the suggestion. I didn't think it was possible for Hass to write to a config entry. Could you point me to an example of this or some documentation? |
|
And now let's no longer abuse this PR as a discussion place. You can find us on Discord. |
Description:
This PR does not contain any new features or functional changes. It decouples Konnected entity setup from the network discovery process to improve stability and faster recovery in case of a Hass reboot or power failure.
Previously, the Konnected component would completely depend on
discoveryto find the Konnected device(s) on the network before the corresponding Hass entities (binary sensors & switches) were created. This caused a problem if Hass was rebooted while Konnected was still running -- Hass would "forget" all the discovered entities and the Konnected device could get into a reboot/failsafe cycle trying to update the states of devices that Hass didn't know about any longer. The reboot cycle prevented discovery from working again properly.Included in this PR, we decouple the entity setup from discovery so that entity setup happens earlier when the
konnectedcomponent first loads. This allows the Konnected device(s) to recover quickly after a reboot and update states even if the device hasn't been re-discovered yet. Once discovery occurs, the entity will be augmented with its initial state and network information.Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#6066
Checklist:
tox. Your PR cannot be merged unless tests pass