Dynamicize gauge segments values with input_number

Hello at all and thank you in advance for reply.
I have a card in my dashboard like this

- type: grid
  columns: 4
  square: false
  cards:
    - type: gauge
      entity: sensor.sensore_salone_temperature
      name: Temp
      needle: true
      min: 0
      max: 45
      segments:
        - from: 0
          color: '#db4437'
        - from: 18
          color: '#43a047'
        - from: 30
          color: '#db4437'

I would use for example my input_number.max_temperature_ok instead of number 30. how can I do it?

Thank you

Like most core dashboard cards the gauge card does not support templates. You would have to use this:

I would not use config-template-card for the gauge card, it will cause problems described here:

Scroll down this thread, you will find my solution based on auto-entities.

2 Likes

Many thanks!!!

This works perfectly

- type: custom:auto-entities
  card:
    type: vertical-stack
  card_param: cards
  filter:
    template: >-
      {{
        {
          'type': 'gauge',
          'entity': 'sensor.sensore_salone_temperature',
          'name': 'Temp',
          'needle': true,
          'min': 0,
          'max': 45,
          'segments': [
            {'from': 0, 'color': '#db4437'},
            {'from': states('input_number.min_temperature_ok')|float, 'color': '#43a047'},
            {'from': states('input_number.max_temperature_ok')|float, 'color': '#db4437'},
          ],
        }
      }},