Dynamic gauge severity

It would be nice if the different severitys in the gauge card didn’t only have to be fixed numbers but instead could use e.g. templates.

E.g. if you want to see if the electricity price is relatively expensive during the day.

Don’t forget to vote for your own request.

Until this gets implemented or if this does not get implemented, you could use the custom Lovelace template card. It uses javascript instead of jinja templates:

2 Likes

Thanks for the tips! The custom template card looks pretty sweet, I’ll use that in the mean time!

1 Like

Hello my Solution is the Condition Card.
You can hide every Card with a Condition.
I calculate a var with the humidity mean and hide all card with other humidity mean.

a part of lovelece

  - type: conditional
    conditions:
      - entity: variable.humidity_mean
        state: '50'
    card:
      type: gauge
      min: 0
      max: 100
      needle: true
      severity:
        green: 45
        yellow: 55
        red: 100
      entity: sensor.indoor_humidity

a part of automation

condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ states(''sensor.temperature_1'') | float > 10.0}}'
        sequence:
          - service: variable.set_variable
            data:
              variable: humidity_mean
              value: 50
      - conditions:
          - condition: template
            value_template: '{{ states(''sensor.temperature_1'') | float < 10.0}}'
          - condition: and
            conditions:
              - condition: template
                value_template: '{{ states(''sensor.temperature_1'') | float > -7.0}}'
        sequence:
          - service: variable.set_variable
            data:
              variable: humidity_mean
              value: 40
      - conditions:
          - condition: template
            value_template: '{{ states(''sensor.temperature_1'') | float < -7.0}}'
          - condition: and
            conditions:
              - condition: template
                value_template: '{{ states(''sensor.temperature_1'') | float > -12.0}}'

1 Like

Hello and welcome to the forum. Please have a read of point 11 here, then edit and format your post correctly. At the moment is is not useful to anyone.

Thanks for the tip :wink:

It would be great to have the needle in the Gauge display “Red” if the current Power consumption = > current Solar Production. This way you can easily manage your home appliances and turn something on or off, especially the WAF will go up as now I have to explain her how to calculate it herself ! :wink:

I don’t think that it is possible today, but this code shows what I would like to do:

type: gauge
name: Current Home Power Usage
needle: true
min: 0
severity:
  blue: =< states('sensor.envoy_current_power_production')
  red: => states('sensor.envoy_current_power_production')
entity: sensor.current_energy_usage
max: 4000
unit: W
2 Likes

I was looking for a solution for this problem as well, have you resolved it yet?

just bumping this up … would be awesome for some of my views on the dashboard …

I’d really love to have this feature.

I’ve been trying to make a gauge for my solar production in which the severity is defined by the estimated production for the day, so it goes green if the real production exceeds the predictions.

I have all the values… Only need the possibility to set them as severity values.

Also looking for a solution here. I tried to use: custom:card-templater
but this ends up with a refresh of the full card and not only the needle to switch to the new value. This looks really ugly, because the needle jumps to the lowest value before it returns to the actual one.

type: custom:card-templater
card:
  type: gauge
  name: Lukas Wohnzimmer
  entity: sensor.lukas_apple_watch_wohnzimmer_rssi
  min: -100
  max: -50
  needle: true
  segments:
    - from: -100
      color: var(--error-color)
    - from_template: '{{ states(''input_number.rssi_not_present_wohnzimmer'')}}'
      color: var(--warning-color)
    - from_template: '{{ states(''input_number.rssi_present_wohnzimmer'')}}'
      color: var(--success-color)
entities:
  - entity: sensor.lukas_apple_watch_wohnzimmer_rssi
    state_template: '{{ states("sensor.lukas_apple_watch_wohnzimmer_rssi") | round(0) }}'
  - entity: input_number.rssi_present_wohnzimmer
    state_template: '{{ states("input_number.rssi_present_wohnzimmer") | round(0) }}'
  - entity: input_number.rssi_not_present_wohnzimmer
    state_template: '{{ states("input_number.rssi_not_present_wohnzimmer") | round(0) }}'

If I skip the real value holding entity in the list of monitored entities. The value just dont change at all.
As you see, I already added state_templates to overcome this issue. But they also did not help.
Probably there is another trick based on this template.

Unfortunately I have not been able to find a solution for this yet. Not sure anyone else has been creative enough to find a way to do this? Dynamic ‘severity’ would really make the Gauge card more meaningful especially if we can also add the navigate option to go to a more detailed sub-view from tapping the Gauge.

I did however create an automation that calculates when the total consumed power in the house > current solar power (on sunny days only) and that is already helpful to do a quick check if you can delay the dishwasher or the dryer for example.

1 Like

I’ve tried using ChatGPT.
Here’s the suggested code:

type: custom:config-template-card
variables:
  - states['input_number.max_value']
entities:
  - ${vars[0].entity_id}
card:
  type: gauge
  entity: sensor.something_days_left
  unit: Days
  needle: false
  severity:
    green: <= ${parseFloat(vars[0].state) - 10}
    yellow: <= ${parseFloat(vars[0].state) - 5}
    red: <= ${parseFloat(vars[0].state) - 2}
  max: ${vars[0].state}

the max value of the gauge card works fine, but the severity map fails to render.
I’m not skilled enough to troubleshoot why, but on the face of it, it seemed like it could work.

Lol, bruh. You wanna get banned? Read the rules.

1 Like

Would be nice to have a solution here.

I am living in a very humid area. I would like the outside dew point to set the red in the gauge of the inside dew point.

So I can see, if the needle is in the red, I don’t need to open the window, I will use the climatisation, because outside it is worse than inside.

found this thread after posting in reply to another thread:
Max and min dynamic value in Gauge card? - Configuration / Frontend - Home Assistant Community (home-assistant.io) would have been handy to find this first :slight_smile: