Skip to content

Instantly share code, notes, and snippets.

@EverythingSmartHome
Created April 6, 2022 13:13
Show Gist options
  • Save EverythingSmartHome/814bc87e83dcff1c06fffa3095b95b3f to your computer and use it in GitHub Desktop.
Save EverythingSmartHome/814bc87e83dcff1c06fffa3095b95b3f to your computer and use it in GitHub Desktop.
Home Assistant Mushroom card templates
#Showing the state of a temperature in a template card:
{{ states('sensor.your_temperature_sensor') }}
#Change the colour of the light depending on status:
{% if is_state('light.your_light', 'on') %}
orange
{% endif %}
#Welcome template:
{% set time = now().hour %}
{% if (time >= 18) %}
Good Evening, {{user}}!
{% elif (time >= 12) %}
Good Afternoon, {{user}}!
{% elif (time >= 5) %}
Good Morning, {{user}}!
{% else %}
Hello, {{user}}!
{% endif %}
@danewhitfield
Copy link

I have this code below which is working fine, but I want to make the icon in orange every time that any of these 4 lights below turns on. light.banheiro_suite_interruptor_iluminacao_interruptor_1 light.banheiro_suite_interruptor_iluminacao_interruptor_2 light.banheiro_suite_interruptor_iluminacao_interruptor_3 light.banheiro_suite_interruptor_iluminacao_interruptor_4

{% if is_state('light.banheiro_suite_interruptor_iluminacao_interruptor_1','on') %} orange {% endif %}

Does anybody know how to ADD the "OR" clause on this sintax?

{% if is_state('light.banheiro_suite_interruptor_iluminacao_interruptor_1','on')
   or is_state('light.light_2','on')
   or is_state('light.light_3','on')
   or is_state('light.light_4','on')
%} orange
{% endif %}

@domingosedu
Copy link

domingosedu commented Apr 21, 2025

Many thanks @danewhitfield for your assistance! You rock! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment