[Solved] Switch doesn't show multiple states and question for Webview

Hi all,

I work now for two weeks with openHAB and most things are working. But in one frame there are two problems

Frame label="Meßwerte" {
            Text item=Rasenfeuchtigkeit
            Text item=Rasentemperatur
            Switch item=rasenChartPeriod label="Chart Periode" mappings=[0="Aus",1="2 Tage",2="Woche",3="Monat"]
            Webview height=10 url="http://server1:8080/static/rasen2d.html"

The result is:

Why are there only two states for rasenChartPeriod?
The “broken” image seems to come from the Webview item. When I define a valid icon it works but I do not want to have one at all. I saw several tutorials for usage of Grafana charts in openHAB by Webview and they all seem not to have one. Do you know what happens?

Best regards

The openHAB answer is because that is what Grafan is sending.
Perhaps a Grafana forum can help you debug Grafana. :wink:

Hi, Grafana does exactly that what I expect. The Problem with icon and switch item comes from openHAB

Best regards

What type of Item is that?
I can’t see anything obvious wrong with your mappings.

Try icon="none"

@rossko57: Thanks a lot!

I defined rasenChartPeriod as a Number. After reading your reply I changed this to String - it’s working.

Also your hint re icon is working!

Best regards

It should work as Number too, perhaps something else was amiss with your definition.

This works for me and it is Number type Item -

Switch item=nm_chart_period label="chart period []" mappings=[0="Day", 1="Week", 2="Month", 3="Year"]