Gauge wont work with template

This works fine but has hard coded values that are wrong half the time.

type: gauge
entity: sensor.difference_between_temperatures
max: 1
needle: true
severity:
  green: 0
  yellow: 0.5
  red: 0.75
min: 0

What I want to do is something like this. No hard coded values but derived values instead.

type: gauge
entity: sensor.difference_between_temperatures
max:  {{ states('sensor.difference_between_temperatures_okay') * 2.0  }}
needle: true
severity:
  green: 0
  yellow: {{ states('sensor.difference_between_temperatures_okay')  }}
  red: {{ (states('sensor.difference_between_temperatures_okay') * 1.5)  }}
min: 0

Is something like the above possible? I can’t use hard coded values since they change based on the hour of the day.

Quite a lot of cards donot allow this, use this

iantrich/config-template-card: :memo: Templatable Lovelace Configurations (github.com)

I would not suggest using config-template-card with the Gauge.
Go to auto-entities main thread - search for “gauge” - find my solution for templating the Gauge

Care to be a bit less cryptic so people can understand (myself included) :slight_smile:
IMO there is nothing wrong with using template cards

Using particularly config-template-card will cause a total redraw of an inner card on every change of “monitored” entity.
In case of particularly Gauge card - that redraw will cause undesired animation for a needle.
There are plenty of threads here about this undesired effect.

1 Like

I assume you mean this? Max and min dynamic value in Gauge card? - #7 by Ildar_Gabdullin

Yes, this one