Mushroom: Best Card for template

could you give me a hand please. I’ve setup a cover (cover.yaml) for a shelly + magnetic sensor for my garage gate. What Mushroom card shall be best option to achieve the following: upon shelly toggle, icon changes to open or close gate and additionally changes colors accordingly? Trying to use mushroom template card although icon and color don’t change.

Entity used is a gate cover which works perfectly with default button card.
cover code:

  - platform: template
    covers:
      ramp_gate:
        device_class: gate
        friendly_name: "Ramp Gate"
        value_template: >-
          {% if is_state('binary_sensor.shelly1_xxxxxxxxxx_external_input','on') %}
            Open
          {% else %}
            Closed
          {% endif %}
        open_cover:
          service: switch.turn_on
          data:
            entity_id: switch.shelly1_xxxxxxxxxx
        close_cover:
          service: switch.turn_off
          data:
            entity_id: switch.shelly1_xxxxxxxxxx
        stop_cover:
          service: switch.turn_on
          data:
            entity_id: switch.shelly1_xxxxxxxxxx
        icon_template: >-
          {% if is_state('binary_sensor.shelly1_xxxxxxxxxx_external_input','on') %}
            mdi:gate-open
          {% else %}
            mdi:gate
          {% endif %}

Below is code added on Mushroom Template Card.
Icon:

{% if is_state('switch.shelly1_xxxxxxxxxxx', 'off') %}
  'mdi:gate' 
{% elif is_state('switch.shelly1_xxxxxxxxxxx', 'unavailable') %} 
  'mdi:alert'
{% else %}
  'mdi:gate-open'
{% endif %}

Icon Color:

{% if is_state('switch.shelly1_xxxxxxxxxxx', 'off') %}
  'rgb(97 ,247 ,2)' 
{% elif is_state('switch.shelly1_xxxxxxxxxxx', 'unavailable') %} 
  'rgb(254 ,0 ,0)'
{% else %}
  'rgb(247 ,141 ,2)'
{% endif %}

Currently I’m testing cover card, button card and template card the last one don’t even show icon neither color.

Just sorted! Can leverage Mushroom Template with below code:

Icon:

{% if is_state('binary_sensor.shelly1_xxxxxxxxxxx_external_input','off') %}
  mdi:gate
{% else %}
  mdi:gate-open
{% endif %}

Icon Color:

{% if is_state('binary_sensor.shelly1_xxxxxxxxxxx_external_input', 'off') %}
  green 
{% else %}
  red
{% endif %}

However not being able to put RGB color :\
Any ideas?

1 Like