Hello,
Things are not working as expected. I am trying to use the button-card to localize my family members through their phone location.
My yaml code is:
type: custom:button-card
entity: person.toto
aspect_ratio: 4/4
show_name: false
show_icon: false
styles:
card:
- padding: 4%
- background-image: url('/local/sticker-toto.png')
- background-size: 90%
- background-repeat: no-repeat
- background-position: top center
- "--keep-background": "true"
custom_fields:
location:
- position: absolute
- bottom: 4%
- right: 4%
- left: 4%
- color: >-
[[[ if (states["person.toto"].state == "home") return "#50A14F";
if (states["person.toto"].state == "Zone 1") return "#FFA500";
else return "#e45649"; ]]]
custom_fields:
location: |
[[[
if (states["person.toto"].state == "Zone 1")
return `<ha-icon
icon="mdi:home"
style="width: 22px; height: 22px;">
</ha-icon>`
if (states["person.toto"].state == "Zone 2")
return `<ha-icon
icon="mdi:briefcase"
style="width: 22px; height: 22px;">
</ha-icon>`
else
return `<ha-icon
icon="mdi:home-export-outline"
style="width: 22px; height: 22px;">
</ha-icon>`
]]]
One of my family member should be in Zone 2 … briefcase icon … but it doesnt show.
How do you link the device tracking to the person/user ?
Any comments ?
Thx