Looking for some help in the below which is to check if the location of a person is in already defined zones (friendly names). Please suggest.
custom_fields:
loc: |
[[[
if (states["person.xxx"].state in [states | selectattr('domain', 'equalto', 'zone') | map(attribute='attributes.friendly_name') | list])
return `<ha-icon
icon="mdi:map-marker"
style="width: 17px; height: 17px;">
</ha-icon>
<span> ${states['person.xxx'].state} </span>`
else
return `<ha-icon
icon="mdi:map-export-outline"
style="width: 17px; height: 17px;">
</ha-icon>
<span> ${states['person.xxx'].state} </span>`
]]]