Best way to exclude and re-include device?

I have some Zooz Z-Wave devices that have firmware updates. The Zooz support site states to “exclude and re-include the device” after updating. However, this would break the automations associated with these devices. I found a forum post that suggests keeping track of the device’s entity ID in Home Assistant and giving it the same entity after it is re-included. As a test, I tried this with one of my devices. The associated automation still worked, but if you edit the automation Home Assistant shows <unknown entity> instead of the device name.
The issue with this approach, from what I see, is that I’m retaining the friendly entity ID (ex: “switch.my_device”), but I can see in the automations yaml file that Home Assistant is using a system-level device_id (de26ad6969d111f98cbe11f1a3c8a8c2) and entity_id (4f42c01560aeb84fd733b316ee1d6d36) values to identify the device. These values change when the device is re-included.

Advice on how to go about this?

Best current practice is not to use device triggers in automations and instead use entity_ids instead (state triggers)

For this exact reason.

If you were using entity id’s you could re-include with impunity and all it takes to get everything back is renaming to the old entity_id

Sorry.

Thanks for the nearly immediate reply! I had built the test automation using the Home Assistant visual editor. This is the action section it constructed…

  action:
  - type: toggle
    device_id: de26ad6969d111f98cbe11f1a3c8a8c2
    entity_id: 4f42c01560aeb84fd733b316ee1d6d36
    domain: switch

I simply changed the entity_id value to the friendly entity_id, as shown below. Everything appears to be happy now. Is this the proper approach?

  action:
  - type: toggle
    device_id: de26ad6969d111f98cbe11f1a3c8a8c2
    entity_id: switch.my_device
    domain: switch

No you should use services not device actions and refer to the entity like:

service: light.toggle
data: {}
target:
  entity_id: light.my_light
1 Like