Make sure zwave nodes/entities enter the registry is proper state.#14251
Make sure zwave nodes/entities enter the registry is proper state.#14251balloob merged 5 commits intohome-assistant:devfrom
Conversation
| super().__init__() | ||
| from openzwave.network import ZWaveNetwork | ||
| from pydispatch import dispatcher | ||
| self.component = None |
There was a problem hiding this comment.
This is not necessary. Entities already have access to the platform that contains them at self.platform.
There was a problem hiding this comment.
Maybe the "remove, clear_id, add back" functionality should be added to the Entity class then? WDYT?
There was a problem hiding this comment.
I don't think that it's a very common use case to do this. Better keep it in Z-Wave, we can always make it a generic function once we see more places need it.
There was a problem hiding this comment.
This can be removed since it's no longer being used?
|
Added more logic. Ready for review. |
| entity.node_id, sec) | ||
| hass.async_add_job(_add_node_to_component) | ||
|
|
||
| def _on_timeout(sec): |
There was a problem hiding this comment.
Can you tag this one and the other async callbacks with @callback so we know it's async
|
@andrey-git after this gets merged do we need to clean db/remove entity registry or anything else...or renaming zwave will work right away reflecting the new entity id ? |
|
@rofrantz this change is backwards compatible. However if you delete your entity registry you might get other entity IDs when it is regenerated. |
|
Thanks for the clarifications @andrey-git |
…ome-assistant#14251) * When zwave node's info is parsed remove it and re-add back. * Delay value entity if not ready * If node is ready consider it parsed even if manufacturer/product are missing. * Add annotations
Description:
Until zwave node's info is parsed it is read as blank causing inconvenient entity_id to be written into the entity registry. zwave entities (lights, sensors, etc.) suffer from the same problem.
This PR adds the following logic:
unique_id, don't add the node/entity to HA. For entity additionally require that the label is not"unknown".unique_id. If it does - add it to HA (it will get also get added to the entity registry with a proper name and entity_id.unique_id. It will get inconvenient name and entity_id, but won't "pollute" the registry with it.unique_idand remove-and-re-add it to HA so it will get a new, better entity_id and get added to entity registry. If node became ready, then even its"unknown"entities will getunique_id. This can happen do to OZW failing to properly scan an entity type.Checklist:
tox. Your PR cannot be merged unless tests pass