I’m trying to get this code to show that I am home at the present.
type: horizontal-stack
cards:
- type: custom:mushroom-template-card
primary: >-
{% if (state_attr('sensor.motorola_edge_2022_detected_activity', '') ==
'still') %} Mike is here: {% else %} Mike is {% endif %}
secondary: >-
{% if (state_attr('sensor.motorola_edge_2022_detected_activity', '') ==
'still') %} Location: {{
state_attr('sensor.motorola_edge_2022_geocoded_location', 'Name') }} {{
state_attr('sensor.motorola_edge_2022_geocoded_location', 'locality') }},
{{ state_attr('sensor.motorola_edge_2022_geocoded_location', 'city') }},
{{ state_attr('sensor.motorola_edge_2022_geocoded_location',
'postal_code') }} {% else %} Driving... {% endif %}
icon: >
{% if (state_attr('sensor.motorola_edge_2022_detected_activity', "") ==
'still') %} mdi:home-account
{% else %} mdi:home-search
{% endif %}
multiline_secondary: true
color: |
{% if is_state('device_tracker.mike', 'home') %} green
{% else %} cyan
{% endif %}
features_position: bottom
I entered {% if (state_attr('sensor.motorola_edge_2022_detected_activity', '') == 'still') %} Mike is here: {% else %} Mike is {% endif %}
into the template tool, and it replies states it is listening for a change in that attribute. Yet when still changes to unknown (i walked from the shop to the house), nothing changed. The logs showed a change. The icon shows Driving, and doesn't change.
What am I doing wrong?