#Device or entity?

1 messages · Page 1 of 1 (latest)

lucid latch
#

Hi, when creatng automations is it better to reference devices or entities in the actions? For example, I have a zigbee device to manage a roller shutter. I have created an automation to close it at sunset. Should I use the device or entity id in the Actions field? What would be the difference?

sturdy plaza
#

entities, once you'd have to replace the device, you can easily rename the new device with the same name used for previous one. That way you dont have to alter automations etc.

sturdy plaza
#

If this answers your question you may mark your thread as resolved by checking the RESOLVED box 😉

lucid latch
#

I wasn't aware, thanks a lot!

sturdy plaza
#

np

lucid latch
sturdy plaza
#

because device_id will change and break the rest.

#

do a google search for pros and cons

lucid latch
#

I see... I had a look at my yaml code in one of my automations:

#
  • action: cover.open_cover
    metadata: {}
    data: {}
    target:
    device_id: 74c46eab383f9090f74ca45aabe7176e
#

That device_id corresponds to a device I named as Suite Persiana, and I would have expected that the device_id in the automation was something like suite_persiana, but that is not the case

#

I understand now, thanks!

sturdy plaza
#

If your question feels answered, you may mark this thread as resolved by clicking the RESOLVED box 😉

hazy kayak
#
novel heron
#

Entities are more “portable” and should be preferred. They are also easier to work with from a YAML pov. The only case I’m user of is device triggers for things like buttons. Haven’t yet figured out how to make those work with entities.

fierce basin
#

same here, buttons are only devices that I use in automations

hazy kayak
#

Guess you are using Zigbee buttons and ZHA then?

novel heron