Greminn
(Simon)
May 4, 2025, 10:47pm
1
Hi There, I am using GitHub - francois-le-ko4la/lovelace-entity-progress-card: Entity progress card for Home Assistant to show the feed progress of our cat feeder. I want to use the tap action function to toggle the feeding automation - so we can turn the automation on and off. This part works well!
I want to show the icon as a blue colour if the automation is enabled or not… what do I have wrong here? As this just shows a black icon.
color: >-
{% if states('automation.cat_feeder_schedule', 'state') == 'on' %}
blue
{% else %}
disabled
{% endif %}
That’s not a valid way to use the states()
function… the preferred method to check if the state value is “on” would be:
{% if is_state('automation.cat_feeder_schedule', 'on') %}
but, the following would also work:
{% if states('automation.cat_feeder_schedule') == 'on' %}
Greminn
(Simon)
May 5, 2025, 12:50am
3
Thanks for the help here! I can see this works well in my dev tools template editor. It just does not show up in the dashboard. Currently automation.cat_feeder_schedule’s state is “off”, so in theory the bar_colour should be red right?
bar_color: >-
{% if is_state('automation.cat_feeder_schedule', 'on') %}blue{% else %}red{%
endif %}
Based on the docs you linked it does not appear that bar_color
accepts templates. The configuration variables that accept templates are marked as [JINJA]:
While bar_color
variable is marked as accepting strings only:
Greminn
(Simon)
May 5, 2025, 1:08am
5
Ah!! Thank you. And also I learned some new things in reading docs!