With help from the community I got this working with mushroom-card listed in the 1st code block.
I would like to make it work with the button-card, but not having any luck. I tried a couple of ways: the 2nd attempt is commented out:
- type: custom:mushroom-template-card
primary: Center
icon: >-
{% if
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_1_input','off')
%}
mdi:garage-variant
{% elif
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_0_input','off')
%}
mdi:garage-open-variant
{% else %}
mdi:garage-alert-variant
{% endif %}
icon_color: >-
{% if is_state('switch.shelly1p_center_rollup_switch_0', 'on') -%}
blue
{% elif
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_1_input','off')
%}
green
{% elif
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_0_input','off')
%}
(220,220,0)
{%- else -%}
red
{%- endif %}
tap_action:
action: toggle
entity: switch.shelly1p_center_rollup_switch_0
layout: vertical
fill_container: false
card_mod:
style: |
:host {
--mush-icon-symbol-size: 1.00em;
}
The one I’m trying to get working - started with color only. once that works I can add the icon mdi:
- type: custom:button-card
entity: switch.shelly1p_center_rollup_switch_0
name: Center Copy
template: vic_cbt
styles:
icon:
- color: |
{% if is_state('switch.shelly1p_center_rollup_switch_0', 'on') -%}
blue
{% elif
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_1_input','off')
%}
green
{% elif
is_state('binary_sensor.shellyplusi4_d4d4da7e242c_input_0_input','off')
%}
(220,220,0)
{%- else -%}
red
{%- endif %}
# [[[
# if (states['binary_sensor.shellyplusi4_d4d4da7e242c_input_1_input'])
# return pink;
# return red;
# ]]]