Hi, I’m trying to make some person cards on my dashboard.
The point is to change the badge icon and color, as well as the text, depending on if the person is home or not. For some reason the elif statements don’t work. Only the if and else statements. Any idea what’s wrong?
- type: custom:mushroom-template-card
entity: person.Mrs
layout: horizontal
primary: Mrs
tap_action:
action: more-info
hold_action:
action: more-info
double_tap_action:
action: none
badge_icon: |
{% if is_state(config.entity, 'home') %}
mdi:home
{% elif is_state(config.entity, 'away') or
is_state(config.entity, 'unavailable') %}
mdi:home-export-outline
{% endif %}
badge_color: |
{% if is_state(config.entity, 'home') %}
green
{% else %}
red
{% endif %}
picture: |
{{ state_attr(config.entity, 'entity_picture') }}
multiline_secondary: true
secondary: >
{% if is_state(config.entity, 'home') %}
Home
{% elif is_state(config.entity, 'away') or
is_state(config.entity, 'unavailable') %}
Away
{% else %}
Is {{ states(config.entity) }}
{% endif %}