Trigger type Device vs state or zone in automation

Hi there
Im still new home assistant, and i have a question regarding automations.
In many cases there can be used either Device or example state or zone for the same thing.
Can anyone tell me if there is a difference between using Device as Trigger/condition type, vs state or zone?
I guess both will work, but for me it is more a question about the best practice and beeing consistent about how i set up automations.
The difference is if it is using Platform: Device, State or Zone, and im thinking if there is a deeper meaning about the Different platforms, so one is better to use than the other and visa versa?
Here is a couple of example i am wondering about.


I am sure someone much more knowledgeable than me on this subject will add to this but from my experience I always try to use “state”.

I have read so many posts on here regarding issues with triggers in automations and scripts were the issue has been rectified by changing from a device trigger to a state trigger.

But interested in others explanations as to why?

1 Like

Device id’s are not persistent. If you remove a device from HA and add it again, it will have a different device id. And, unlike entity id’s, a device id can’t be changed.

2 Likes

Thanks for input, these are the things i mean with deeper integration, that i as an amateur doesent see, before i experience it my self. Im not new to “smart home” , although im new to Home Assistant, so i know that there are sometimes “special ways” of handling devices based on what system we use.

If i understand you correctly, are you saying that if i delete a device and its entities, and then recreate it again, the entities will remain the same, but the device id will change? (As long as it is the same device)

device id will always change, entity id sometimes will change, sometimes will not change, depending on the integration. But if an entity id has changed, it is easy to change it back to the old one using the UI.

1 Like

Thanks guys, good to know.
Although Device is sometimes simpler to use and have more human friendly names, i think i will also stick with states for now :slight_smile: