Max and min dynamic value in Gauge card?

Wrap into auto-entities like this example:

code
type: vertical-stack
cards:
  - type: entities
    entities:
      - input_number.test_level_1
      - input_number.test_level_2
      - input_number.test_level_3
  - type: custom:auto-entities
    card:
      type: vertical-stack
    card_param: cards
    filter:
      template: >-
        {{
          {
            'type': 'gauge',
            'entity': 'input_number.test_level_3',
            'name': 'Temp',
            'severity': {
              'green': 0,
              'yellow': states('input_number.test_level_1')|int,
              'red': states('input_number.test_level_2')|int
            },
          }
        }},

Update:
Example with a “needle”:

code
type: vertical-stack
cards:
  - type: entities
    entities:
      - input_number.test_level_1
      - input_number.test_level_2
      - input_number.test_level_3
  - type: custom:auto-entities
    card:
      type: vertical-stack
    card_param: cards
    filter:
      template: >-
        {{
          {
            'type': 'gauge',
            'entity': 'input_number.test_level_3',
            'name': 'Temp',
            'needle': true,
            'severity': {
              'green': 0,
              'yellow': states('input_number.test_level_1')|int,
              'red': states('input_number.test_level_2')|int
            },
          }
        }},

And example with added additional information could be related here:

code
type: vertical-stack
cards:
  - type: entities
    entities:
      - input_number.test_level_1
      - input_boolean.test_boolean
  - type: custom:auto-entities
    card:
      type: vertical-stack
    card_param: cards
    filter:
      template: >-
        {% if is_state('input_boolean.test_boolean','on') -%}
          {%- set STATUS = 'charging' -%}
        {%- else -%}
          {%- set STATUS = 'discharging' -%}
        {%- endif -%}
        {{
          {
            'type': 'gauge',
            'entity': 'input_number.test_level_1',
            'name': 'Battery (' + STATUS + ')',
            'severity': {
              'green': 67,
              'yellow': 34,
              'red': 0
            },
          }
        }},

Alternatively - use card-mod.

5 Likes