1aranzant
(1aranzant)
April 25, 2023, 5:04am
1
Hello,
I had dozens of automations where an Ikea symfonisk gen 2 remote was the trigger.
The remote stopped working, so I deleted it and repaired it on ZHA, and then I saw that all my automations with that remote got deleted.
Is this normal behavior?
I know will have to spend hours recreating these automations…
Thank you
EDIT: I just recreated one of the old automations that got deleted, and all of a sudden, they all re-appeared again… very strange…
tom_l
April 25, 2023, 5:14am
2
Did your automations have device triggers or did they have state triggers?
1aranzant
(1aranzant)
April 25, 2023, 5:20am
3
The triggers were device triggers.
see example:
alias: Denon UP volume
description: ""
trigger:
- device_id: 872d37954e576adf799387e00c4b7020
domain: zha
platform: device
type: remote_button_short_press
subtype: dim_up
condition: []
action:
- service: media_player.volume_set
data:
volume_level: >-
{{ state_attr('media_player.denon_avr_x2700h_2', 'volume_level') | float
+0.03 }}
target:
device_id: c3db1119ba04d9a00b8da15579b192ef
mode: single
tom_l
April 25, 2023, 5:40am
4
That’s your problem.
Delete a device and all automations where the device_id is used will disappear.
There are other reasons not to use device triggers, conditions and actions. They are a simple way to start but are not easy to maintain.
It’s a big problem that you can avoid by not using device triggers, conditions or actions. There are always other triggers conditions and actions you can use instead.
e.g. instead of a device turn on trigger use a state trigger.
If you only ever use entity_ids in your triggers, conditions and actions then when you have to replace the device you can change the new entity id to match the old one in one place and all your automations keep working.
If you use device ids you have to change all of …
2 Likes