Hi everyone, i’d need some help about this thing:
My goal is using a template , in a custom:button-card, to retrieve the state value of a media_player, and using it inside a state value list belonging to another entity(that is, the main one of the card.
so I tried to template the color attribute but it seems that either it can’t accept the templating, either (maybe) inside the template it can’t retrieve the value that is necessary to switch between the 2 colors.
I tried writing just a color value and it works,while the templating doesn’t.
type: custom:button-card
icon: mdi:television-box
size: 20%
name: req. ch.
entity: input_select.tv_ch_list
state:
- value: 24
operator: '=='
styles:
icon:
- color: |
{%if is_state('media_player.livingroom_tv','on') %}
'#00ccff'
{% else %}
'gray'
{% endif %}
- value: 24
operator: '!='
color: '#336699'
tap_action:
action: call-service
service: input_button.press
target:
entity_id: input_button.tv_ch_ch