Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Handle ozwdaemon restart while HA is running #24

Closed
cgarwood opened this issue Jan 3, 2020 · 6 comments
Closed

Handle ozwdaemon restart while HA is running #24

cgarwood opened this issue Jan 3, 2020 · 6 comments
Assignees
Labels
Milestone

Comments

@cgarwood
Copy link
Owner

cgarwood commented Jan 3, 2020

If Home Assistant is currently running and the OZWDaemon restarts, we'll get a bunch of NODE_ADDED and VALUE_ADDED etc events fired, and the component will try to recreate all of the entities instead of simply updating them.

Need to add checks for if the entity already exists and fire an update instead of trying to recreate.

@balloob
Copy link
Collaborator

balloob commented Jan 3, 2020

We should only get NODE_ADDED instead of NODE_UPDATED if there also was a NODE_REMOVED event ?

@Fishwaldo
Copy link

Node Added is fired when OZW is starting up. Node New is fired when OZW pairs a new device.

It would be nice if you could handle the Inclusion Button on the zsticks as well so people can do a “offline” inclusion.

@Fishwaldo
Copy link

And yes, if OZWDaemon restarts - during the shutdown it should remove the node/value topics etc.

@cgarwood cgarwood added the todo label Jan 21, 2020
@balloob balloob added this to the beta milestone Feb 25, 2020
@MartinHjelmare
Copy link
Collaborator

MartinHjelmare commented Apr 6, 2020

If I understand correctly:

  1. OZWDaemon decides to restart
  2. OZWDaemon shuts down and during the shutdown sends NODE_REMOVED event for a node.
  3. OZWDaemon starts and sends NODE_ADDED event for the node.

Since this is then normal behavior for the OZWDaemon, we need to handle this in home assistant, as I assume we don't want to remove nodes as they are represented in Home Assistant just because the OZWDaemon restarts.

In Home Assistant we want to add a node representation both when a NODE_ADDED event and a Node New event is fired, if that node is not yet seen.

Side note: How is the Node New event represented in https://github.com/cgarwood/python-openzwave-mqtt? I don't find it.

Is that correct?

@balloob
Copy link
Collaborator

balloob commented Apr 6, 2020

Events are fired as EVENT_INSTANCE_EVENT. Payload is {type: "event_name_from_topic", data: {"event": "data}}. See cgarwood/python-openzwave-mqtt#47

@marcelveldt
Copy link
Contributor

Closed by #93 which will mark entities unavailable when OZW is not in a valid state (e.g. restarting). This can be even improved bt watching the LWT message of the OZW daemon on MQTT so we can also track the MQTT connection or OZW broker to be completely offline (non clean shutdown). A normal/clean shutdown of OZW is catched by the status.,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants