Gauge threshold not working with negative value

Hi,

I have some sensor that returns negative value (wifi signal in db, speaker volume in db …).

Applying negative threshold value doesn’t have any impact on the color. It is always blue.
Example:

      {
          "type": "gauge",
          "position": {
            "x": 1,
            "y": 2,
            "width": 1,
            "height": 1
          },
          "properties": {
            "label": "",
            "style": "radial",
            "icon": "volume",
            "unit": "none",
            "value": {
              "binding": "tkktbjcnsbnc1d05vd9vang5e.sensor.speaker_volume#numeric-sensor.state"
            },
            "thresholds": {
              "1iekr7bsdf1lt15ufqm52quaua": {
                "value": -52,
                "color": "120,100,50"
              },
              "42rshohfwkp61qebflg26wqrt": {
                "value": -40,
                "color": "39,100,100"
              },
              "14ufyyhllz6mc15lf7682bz1w3": {
                "value": -30,
                "color": "0,100,100"
              }
            },
            "min": -90,
            "max": 0,
            "show-timestamp": false,
            "timestamp": null
          }
        }

Am I doing something wrong?

Thanks

Will be fixed in the next patch release.

Just to clarify, the thresholds will still apply as “greater than”, even for negative numbers. So in this case this would produce:

  • value: -55, result: no threshold met, default color (blue)
  • value: -50, result: -52 threshold met, green color
  • value: -45, result: -52 threshold met, green color
  • value: -40, result: -40 threshold met, orange color
  • value: -25, result: -30 threshold met, red color
1 Like

Exactly what I needed. I’ll see how it goes and let you know.

Thanks a lot.

I didn’t see that I got a new version, but it is now working :smile:

Thank you.

Great! Thanks for confirming.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.