Skip to content

Instantly share code, notes, and snippets.

@lennon101
Created April 16, 2024 04:45
Show Gist options
  • Save lennon101/73b7c5ccba525aaecbf103fa0d4b8c22 to your computer and use it in GitHub Desktop.
Save lennon101/73b7c5ccba525aaecbf103fa0d4b8c22 to your computer and use it in GitHub Desktop.
Mushroom Template Card Example πŸ„

Below is an example of how I've used a mushroom template card to change the colour of a button depending on the state of an input_boolean. The code is below in the card.yaml file

image

type: custom:mushroom-template-card
layout: vertical
primary: Home
icon_color: |-
{% if is_state('input_boolean.away_mode', 'off') %}
green
{% else %}
red
{% endif %}
fill_container: true
multiline_secondary: false
tap_action:
action: call-service
service: script.home_mode
target: {}
entity: input_boolean.away_mode
icon: mdi:home-import-outline
double_tap_action:
action: more-info
secondary: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment