custom-cards / bar-card

Customizable Animated Bar card for Home Assistant Lovelace
MIT License
378 stars 54 forks source link

Bar colour based on template #161

Open flybrys opened 1 year ago

flybrys commented 1 year ago

I'm using this card to visualise how our energy usage is tracking against a pre-set budget for the day.

I'd like the bar to be green if it is under budget, yellow if it is slightly over, and red if it is way over.

Is it possible to set the colour based on template conditions?

This is the code I want to use for true/false conditions on the budget:

{{(states("sensor.house_total_daily_energy")|float) < (now().hour * 60 * 0.0104166) }}

{{(states("sensor.house_total_daily_energy")|float) < (now().hour * 60 * 0.0125) }}