#YAML 'if exists'

1 messages · Page 1 of 1 (latest)

sharp musk
#

I am trying to perform an automation based on the presence of a given attribute on an entity. I've proven that the entity only exists in certain circumstances, but I can't find the right YAML syntax to only trigger an automation if the attribute is present. I then want to set an input text based on the value of the attribute.

Can anyone help me figure the syntax out here please?

solemn yarrow
#

@sharp musk Just to avoid the potential of the XY problem, what are you ultimately trying to accomplish?

sharp musk
#

I want to set a label with my location based on what SSID my phone is connected to

#

... Thinking about it, the SSID comes from the device tracker created by Ubiquiti so they only works for SSIDs presented at home - a shortlist of one...

solemn yarrow
#

The HA companion app can provide the SSID as a sensor

#

which you could then use in a state trigger with to: and the specific SSIDs you want or

not_to:
- '<not connected>'
- 'unavailable'