Skip to content

Instantly share code, notes, and snippets.

@dstreefkerk
Forked from EverythingSmartHome/templates.yaml
Last active July 14, 2022 08:56
Show Gist options
  • Save dstreefkerk/c0ea601a9a1f1f0f4ca3e19f3fb2234a to your computer and use it in GitHub Desktop.
Save dstreefkerk/c0ea601a9a1f1f0f4ca3e19f3fb2234a 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:
#Updated to greet the user by first name only
{% set time = now().hour %}
{% set firstname = user.split(" ") | first %}
{% if (time >= 18) %}
Good Evening, {{firstname}}!
{% elif (time >= 12) %}
Good Afternoon, {{firstname}}!
{% elif (time >= 5) %}
Good Morning, {{firstname}}!
{% else %}
Hello, {{firstname}}!
{% endif %}
Hello, {{user}}!
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment