Thanks! I’ll test it out without the redundant part. I know the image belongs to Sovrum, but that’s where the trouble occur when changing the circle code for the item in Studio. Wierd. I’ll have another look tonight.
If you want to display only the ON state, I think it is better to create a new template for specific entities and not to manipulate the circle template. Because with that template you have to fix it in extra styles as well. For example, I have a small icon for my office button when the laptop is on, otherwise it is not displayed.
Sorry, but those files aren’t just for copy and paste. It’s just a preview of how my dashboard is done, there are a lot of custom template sensors and other helpers and many added custom cards from the community.
In this template I used for variables.state_on attributes hvac_action from entity, specifically state_on only when heating. To display the state I have a different background for the button and color for the state.
Yes, stroke = ring. The active states are defined via variables.state_on , which you’ll find in the base template. I do the same as suggested by VietNgoc, if my ideas of a certain design are very specific and decouple the code.
- unique_id: wide_timeclock
state: template
attributes:
hour: >
{% set hours = now().strftime('%H') %} {{ hours }}
minutes: >
{% set minutes = now().strftime('%M') %} {{ minutes}}
day: >
{{ states.sensor.day_en.state }}
date: >
{{'📆'}} {{ states.sensor.date_en.state }}
lunar: >
{{'🌚'}} {{ states.calendar.lunar.attributes.message | replace("/", ".") }}
events: >
{%- set midnight = today_at() %}
{%- set event = state_attr('calendar.ceske_statni_svatky', 'start_time') | as_datetime | as_local %}
{%- set delta = event - midnight %}
{%- if delta.days == 0 %}
{{ state_attr('calendar.ceske_statni_svatky', 'message') }}
{%- endif %}
{% set time = now().hour %}
{%- if time <= 1 -%} {{'💤'}} Good night
{%- elif time <= 3 -%} {{'😴'}} Good night
{%- elif time <= 5 -%} {{'😪'}} Good night
{%- elif time <= 7 -%} {{'🧠'}} Good morning
{%- elif time <= 9 -%} {{'🤟'}} Good morning
{%- elif time <= 10 -%} {{'😘'}} Good morning
{%- elif time <= 13 -%} {{'😍'}} Good day
{%- elif time <= 15 -%} {{'😏'}} Good day
{%- elif time <= 17 -%} {{'🖖'}} Good day
{%- elif time <= 19 -%} {{'🤩'}} Good evening
{%- elif time <= 22 -%} {{'🤗'}} Good evening
{%- elif time <= 23 -%} {{'🤫'}} Good night
{%- else %} {{'🤫'}} Good night
{%- endif -%}