Grafana does not display ON/OFF Values (Switch Item)


sorry for the noobish question but i am trying for hours now and cannot make any progress …
I have a switch item i want to display in grafana via influxdb.

i checked in the influxdb and the item is updated (1 to 0 and vice versa).

If i implement the exact same item in grafana it just stays at 0.
i read that switch items are supported but i also tried converting it to a number.
i found a thread that explains how to do that: sendCommand() Documentation - #9 by rlkoshak
but i cannot get any of those working. Other graphs work fine (so i know it’s not an authorization problem or bucket or something like that.

Here’s a screenshot of my influxdb, grafana graphs and the configs i made :frowning:


Switch    KG_Technikraum_Zirkulationspumpe             "Zirkulationspumpe"                          (gAuswertungWP)     {influxdb="Zirkulationspumpe" [bezeichnung= "Zirkulationspumpe", floor="KG"],channel="knx:device:bridge:Schalter:KG_Technikraum_Zirkulationspumpe"}

EDIT: The group gAuswertungWP is persisted at any change (confirmed through influx UI)

Grafana config:

  |> range(start:-24h)
  |> filter(fn:(r) =>
    r.item == "KG_Technikraum_Zirkulationspumpe"
  |> aggregateWindow(every: 6m, fn: min)
  |> map(fn: (r) => ({  r with name: r._measurement }))



I used to plot many switches in Grafana as a heatmap. It worked very well without doing anything special. I haven’t been able to recently, but only because the binding was changed so that the switch channel is now a string type and that doesn’t work in influx-Grafana.

that is strange.
i clearly get a “1” as value in influxdb and it manages to display it in the graph in influx so i think it is a number …

0 is transferred correctly. 1 is not.

rule "Warmwasserzirkulationspumpe Switch to Number"

                Item KG_Technikraum_Zirkulationspumpe changed
                val int zero = 0
                val int one = 1
                if (KG_Technikraum_Zirkulationspumpe.state == ON)
                if (KG_Technikraum_Zirkulationspumpe.state == OFF)

Does also not work for me …
I also tried without int

I just checked. Switch type items OFF or ON appear in Grafana as 0 or 1 for me. I even do a math calculation to scale them up to 100 and then plot them on a heat map together with dimmers. Item state is updated by a binding. I am using influx persistence config file.

strategy = everyUpdate, everyChange, everyHour

What are your Grafana query settings for the item?

1 Like


everything was working fine.
The problem was my aggregation argument in grafana (6 minutes) → that did negate my fast on/off switching for debugging reasons …