#If states

1 messages · Page 1 of 1 (latest)

sharp flint
#

Hi all,

I have been reaserching everywhere but i just can't find where i'm going wrong, i'm trying to add a ha-icon to my card and changing its state depending if home or not.
This is the code im using,
custom_fields:
location:
[[[
if (states["person.name"].state == "home")
return '<ha-icon
icon="mdi:home"
style="width: 22px; height: 22px;"
</ha-icon>'
else
return '<ha-icon
icon=mdi: home-export-outline"
style="width:22px; height:22px;"
</ha-icon>'

wraith ginkgo
#

looks to me like you're using single quotes around your HTML when you need backticks

sharp flint
#

sorry thats just a typo they are backticks