Needle pointer in Gauge Card does not work

The needle pointer in my Gauge Card does not work with the following yaml code. The needle stays always on the same place. The displayed data (kW) is correct and varies. Can anyone explain why?

type: gauge
entity: sensor.home_power_total
needle: true
severity:
green: -50
yellow: 25
red: 60
name: Energieverbruik
unit: kW
min: -50
max: 100

@Ardi, It looks like you have it set up the same as I do and my gauges update just fine. This one shows the battery level of a window blind.

      - type: gauge
        entity: sensor.mqtt_kitchen_blind_battery
        name: Kitchen
        severity:
          green: 51
          yellow: 25
          red: 0
        needle: true
        min: 0
        max: 100
        unit: "%"

Have you looked at your sensor.home_power_total value in Developer Tools / States to verify it is varying? Sometimes sensors don’t update very frequently.

Just for fun, I added a gauge to look at sensor.system_monitor_memory_use which is a sensor whose value changes frequently and the gauge did update as the sensor value was updated.

      - type: gauge
        entity: sensor.system_monitor_memory_use
        name: Memory
        needle: true
        min: 1060
        max: 1070

One last comment, when you posted your YAML, you didn’t use the pre-formatted text feature of this forum, so I can’t verify your indentation. Improper indentation of YAML will cause things to not work properly.

Hope something here helps…

Thanks for your reply. I’ve checked and I see every 10 seconds an update of the sensor. In your code you use “%” and I use also negative numbers (-50 to +100).
The indentation is correct. Sorry, I did not know how to use the pre-formatted text feature.
Even when i use the most simple code, the needle is not moving at all =>
type: gauge
entity: sensor.home_power_total
needle: true

Hmm, very strange. Do other sensors update a gauge card for you? I wonder if your issue is with this one sensor or if it’s with the dashboard itself not updating based on sensor changes. Sorry, I’m out of ideas. Hopefully, someone else can help.

For future reference, regarding posting code, click the </> button, then paste your code between the ellipses. Here’s a screenshot of what that looks like.

image

Good Luck!

I’ve tried someting else:
This works great, two gauges in stack. But I don’t understand why the simpel code does not work en de code below works fine (needle moves; every 10 secs update received).

type: vertical-stack
cards:
  - type: gauge
    entity: sensor.dsmr_reading_electricity_currently_delivered_watt
    max: 5000
    min: 0
    needle: true
    severity:
      green: 0
      yellow: 800
      red: 1500
    name: Current usage
  - type: gauge
    entity: sensor.dsmr_reading_electricity_currently_returned_watt
    max: 5000
    min: 0
    needle: true
    severity:
      green: 0
      yellow: 800
      red: 1500
    name: Current return

The problem is the sensor.home_power_total => This is a calculation yaml script in /homeassistant/templates.yaml, as follows:

    - name: "Home Power total"
      unit_of_measurement: "kWh"
      state: >
         {% set Power_return = states('sensor.dsmr_reading_electricity_currently_returned') | float %}
         {% set Power_delivered = states('sensor.dsmr_reading_electricity_currently_delivered') | float %}
         {{ (Power_delivered - Power_return) | round(3, default=0) }}

When using this sensor, the needle does not move at all.
And when using one single (not calculated) sensor such as “sensor.dsmr_reading_electricity_currently_returned” or “sensor.dsmr_reading_electricity_currently_delivered” it works fine.

So from the stack code I need to create ONE (1) gauge => “Current usage -/- Current return”
How can I do that?

What is the value of Home Power total right now?

Usage = 1135 Return = 0 Total Home Power = 1135

I found a yaml code that does work:

type: gauge
entity: sensor.home_power_total
max: 5
needle: true
severity:
  green: -5
  yellow: -3
  red: 1
unit: kW
name: Energieverbruik
min: -5

Your sensor unit is incorrect.

    - name: "Home Power total"
      unit_of_measurement: "kWh"

Power is not measured in kWh. It is either W or kW.

Going by the previously stated value of 1135 I’d say it is supposed to be W

Thx Tom, You’re right. I’ve corrected it.