[SOLVED] Openhab temperature chart

Hi,
I have created new frame called “Indoor” and want to list aver temp and humidity of the house. All seems to be working ok as it will display me correct aver value for both but at the top of it, when I click on temperature section I want to show temperature of the specific room and underneath that wishing to have chart with this temperature.
With my current sitemap it`s currently showing me chart on front page under aver room temp instead of inside underneath this specific room.
What am I doing wrong. Literally need to relocate this chart. Also it would be good to add some history , week, 24hrs and today.

}
	Frame label="Indoor"	{
	    Group item=Temperature icon="temperature"
		Chart item=Temperature period=h refresh=60
		Group item=Humidity icon="humidity"
									}

If I’m understanding what you are after correctly you can’t do that using Group elements. You have no control over how the elements under the Group are displayed and you can’t add any other elements like a Chart to that subframe. If you want a chart to appear under Temperature then you must build that up manually.

Frame label="Indoor" {
    Text item=Temperature icon="temperature" {
        Frame label="Temperatures" {
            Text item=room1Temp
            Chart item=room1Temp period=h refresh=60

            Text item=room2Temp
            ...
        }
    }

If you want to show only the chart for the selected room use theVisibility tag in conjunction with a switch. You need to have a chart-line for each room in your sitemap, however only the selected one will show up.

Thank you to both of you for replies. Yes I was struggling with this sitemap but applied the example from above and works well.
Now when I enter temperatures frame I can see the individual room - fab.

Liv%20room

Just wonder if I want to add some more details to this chart such as last update and chart period (hour/day/week) how would I do that. This is what I`m after.

last%20upd

Also where is this date being saved in openhab ? Assuming the log will be growing and growing until is manually deleted is that correct.

For the display of the last update just use an item to be displayed.
For the different chart periods you can also use the visibility tag ( yes that would make it even more lines in the sitemap file, but it works that way. You only need to create a number representing the period and the room.
The values are stored in a database which you have selected by the persistence service. Sql would be growing, rrd4j not growing.
For example, see this part of my sitemap on which I have 3 switches to select the correct chart to be displayed.

Switch item=Sprit_Art label= “Spritart:” mappings=[0=“E10”, 1=“E5”, 2=“Diesel”]
Switch item=Sprit_Chart_Period label= “Zeitraum” mappings=[0=“Tag”, 3=“Woche”, 6=“Monat”]
Switch item=Tankstelle label= “Tankstelle” mappings=[0=“1”, 9=“2”, 18=“3”]
}
Frame label=“Preise” {
Text item=Name_1A label="[%s]"
Text item=Name_2A label="[%s]"
Text item=Name_3A label="[%s]"
}
Frame label=“Preisverlauf” {
Chart item=E10_1 period=D legend=true refresh=300000 visibility=[ChartSelector==0, ChartSelector=="$
Chart item=E10_1 period=W legend=true refresh=600000 visibility=[ChartSelector==3]
Chart item=E10_1 period=M legend=true refresh=600000 visibility=[ChartSelector==6]
Chart item=E5_1 period=D legend=true refresh=300000 visibility=[ChartSelector==1]
Chart item=E5_1 period=W legend=true refresh=600000 visibility=[ChartSelector==4]
Chart item=E5_1 period=M legend=true refresh=600000 visibility=[ChartSelector==7]
Chart item=Diesel_1 period=D legend=true refresh=300000 visibility=[ChartSelector==2]
Chart item=Diesel_1 period=W legend=true refresh=600000 visibility=[ChartSelector==5]
Chart item=Diesel_1 period=M legend=true refresh=600000 visibility=[ChartSelector==8]
Chart item=E10_2 period=D legend=true refresh=300000 visibility=[ChartSelector==9]

The Chart selector just adds the values of all switches

Thanks.
With the following syntax I get to display chart period (Hour/Day/Week) but when selecting any of them chart is not changing view.
Additionally after adding few extra Chart lines , I now can see 4 charts - two of them are hour, third is day and fourth is week. Only the problem all four charts are displayed separately underneath each other, obviously switch button has no functionality. What else is missing here ?

}
	Frame label="Indoor"	{
	    Text item=Temperature icon="temperature" {
		    Frame label="Temperatures" {
			    Text item=Temperature_GF_Living
				Switch item=Temperature_GF_Living_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"]
				Chart item=Temperature_GF_Living period=h refresh=60
				Chart item=Temperature_GF_Living period=h refresh=6000 visibility=[Temperature_GF_Living_Period==0, Temperature_GF_Living_Period=="Uninitialized"]
				Chart item=Temperature_GF_Living period=D refresh=30000 visibility=[Temperature_GF_Living_Period==1]
				Chart item=Temperature_GF_Living period=W refresh=30000 visibility=[Temperature_GF_Living_Period==2]
												}
				}				}```
1 Like

Refresh problem:
I do see that also, refreshing the page gives the updated view.
Display of first chart:
Your first chart line has no visibility tag, hence it will allways show! Why did you use a refresh of 60 msec? I can’t blink that often!
Display of the three other charts:
I remeber seeing that behaviour when something wasn’t set correctly, can’t remember what it was in my case. The only possible reason I see (not certain on that) is your first chart line.

I removed the first line from sitemap, so have now three charts only but there are still displayed separately. Sorry the first line was only for testing needs - yeah the update time was quick.

I’d have to do some test-trials using your code on my system in order to find what is going on. That will take some time.
It could be any syntax-problem in the sitemap file!

Great - thank you. Let me know if you find anything. I will check my syntax again as soon I get home later today.

Found it!
I guess your item “Temperature_GF_Living_Period” is defined as a Switch, if you change that to Number it will work.
A switch doesn’t take more then ON/OFF! You are using it with 0,1 and 2!

Evening. I tried changing Switch to Number in sitemap but this is creating error. This is my current sitemap:

}
	Frame label="Indoor"	{
	    Text item=Temperature icon="temperature" {
		    Frame label="Temperatures" {
			    Text item=Temperature_GF_Living
				Switch item=Temperature_GF_Living_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"]
				Chart item=Temperature_GF_Living period=h refresh=6000 visibility=[Temperature_GF_Living_Period==0, Temperature_GF_Living_Period=="Uninitialized"]
				Chart item=Temperature_GF_Living period=D refresh=30000 visibility=[Temperature_GF_Living_Period==1]
				Chart item=Temperature_GF_Living period=W refresh=30000 visibility=[Temperature_GF_Living_Period==2]
								}
				}

In items I have the following syntax for this temperature:

Number Temperature_GF_Living "Living Room Temp [%.1f °C]"   <temperature>   (Temperature, GF_Living) [ "CurrentTemperature" ] { mqtt="<[broker:/relay/switch5/temperature:state:default]"}

Have I changed it correctly ?

You need to change the Temperature_GF_Living_Period to a Number!!!
(Edit:) …and that change needs to be done in the .items file, displaying it as a switch on the sitemap is correct!

1 Like

I got it now. It turns out that I didn`t had Period syntax in items at all as I was trying to build everything in sitemap. After adding this line as Number I can see one chart and chart period selector works properly so problem solved - many thanks , good spot.
When comes to refresh rate is that correct what I have in sitemap ? h=6000, D=30000 & W=30000. If we are talking about ms then this seems to be still quick.

Your thinking is correct, Im using a value of 30000 for all my charts.

Please mark the post that shows the solution with the checkmark at the bottom of the post.

Thanks. I will slow down my refresh rate on this chart as my current refresh setup is 6s for h, and 30s for D and W. Probably it doesn`t need to be that fast.