Okay, I’m tinkering around with Mushroom cards again and I build a chip card that should do the following. The chip should change:
- the icon should change depending on state.attr of the media player (Arbeitszimmer = Office) → working
- the icon color should change to → working
- the service being called should change dependiung on the state.attr → not working
This code is working flawlessly in Developer Tools\Services:
service: |-
{% if is_state_attr('media_player.arbeitszimmer', 'group_members',
[
"media_player.arbeitszimmer",
]) %}
script.join_bad
{% elif is_state_attr('media_player.arbeitszimmer',
'group_members', [
"media_player.arbeitszimmer",
"media_player.bad"
]) %}
script.unjoin_bad
{% endif %}
But if I put it in with the rest of it in my chip card I get
Failed to call service <{% if is_state_attr('media_player.arbeitszimmer', 'group_members',["media_player. Service not found
Here’s the full chip card and if I replace the service with just ‘script.join.bad’ or ‘script.unjoin.bad’ everything is working fine so the card is okay.
type: custom:mushroom-chips-card
chips:
- type: template
entity: media_player_bad
icon: >-
{% if is_state_attr('media_player.arbeitszimmer', 'group_members',
[
"media_player.arbeitszimmer",
]) %}
hue:room-bathroom
{% elif is_state_attr('media_player.arbeitszimmer',
'group_members', [
"media_player.arbeitszimmer",
"media_player.bad"
]) %}
hue:room-bathroom-off
{% else %}
mdi:cloud-question
{% endif %}
icon_color: >-
{% if is_state_attr('media_player.arbeitszimmer', 'group_members',
[
"media_player.arbeitszimmer",
]) %}
disabled
{% elif is_state_attr('media_player.arbeitszimmer',
'group_members', [
"media_player.arbeitszimmer",
"media_player.bad"
]) %}
blue
{% else %}
mdi:cloud-question
{% endif %}
content: ''
hold_action:
action: call-service
service: |-
{% if is_state_attr('media_player.arbeitszimmer', 'group_members', ["media_player.arbeitszimmer", ]) %}
script.join_bad
{% elif is_state_attr('media_player.arbeitszimmer','group_members', ["media_player.arbeitszimmer", "media_player.bad" ]) %}
script.unjoin_bad
{% endif %}
service_data: {}
target: {}
Hope that’s just a ',{ somewhere that has to be in the card code and Developer Tools is that picky.