[SOLVED] Switching Graph for different Periods

Hi everybody,
I’m struggeling some time with the problem to switch a simple rrd4j-Chart for different periods.
Her is may configuration:
rrd4j.persist

Strategies {
everyMinute  : "0 * * * * ?"
everyHour    : "0 0 * * * ?"
everyDay     : "0 0 0 * * ?"
default = everyMinute
}
Items {
BadRegler_ActualTemperature : strategy = everyMinute
Temperature : strategy = everyMinute
RauchmelderKChe_TemperatureSensor : strategy = everyMinute
gChartTemp; gChartTemp* : strategy = everyMinute
}

sitemap:

Group item=TempChart			 label="Temperatur"				icon="line"
										{
										Switch item=Chart_intervall label="Temperaturverlauf"	icon="line"	mappings=[0="Tag",1="Woche",2="Monat"]
										Chart item=Temperature		period=D 	refresh=180000     	visibility=[Chart_intervall==0, Chart_intervall=="Uninitialized"]	service="rrd4j"
										Chart item=Temperature		period=W 	refresh=180000     	visibility=[Chart_intervall==1]	service="rrd4j"
										Chart item=Temperature		period=M 	refresh=180000     	visibility=[Chart_intervall==2]	service="rrd4j"
										}	

but the result looks lieke this:

where ist the fault?

1 Like

Hello Andreas.

Could you post the Items Definitions.

So we can have a look at it and maybe find the Mistake.

Thanks.

Matz

Hi Matz,

hier are the items definitions:

// temperature
Number   Temperature            "Temperatur [%.2f °C]"                      <temperature>		(gwetter)	{weather="locationId=gg5, type=temperature, property=current"}
Number   Temp_Feel              "gefühlte Temperatur [%.2f °C]"             <temperature>		(gwetter)	{weather="locationId=gg5, type=temperature, property=feel"}

In your sitemap try something like this for different time periods.

Example:

Frame {
		Switch item=Home_Sensor_Chart_Period mappings=[0="1h", 1="12h", 2="Day", 3="Week", 4="Month"]
		Chart  item=Home_Sensor_Chart period=h   refresh=60000 visibility=[Home_Sensor_Chart_Period==0] //, Home_Sensor_Chart_Period=="Uninitialized"]
		Chart  item=Home_Sensor_Chart period=12h  refresh=60000 visibility=[Home_Sensor_Chart_Period==1]
		Chart  item=Home_Sensor_Chart period=D  refresh=60000 visibility=[Home_Sensor_Chart_Period==2]
		Chart  item=Home_Sensor_Chart period=W refresh=60000 visibility=[Home_Sensor_Chart_Period==3]
		Chart  item=Home_Sensor_Chart period=M   refresh=60000 visibility=[Home_Sensor_Chart_Period==4]
	}

You may also want to change the default from everyMinute to everyChange.

Strategies {
everyMinute  : "0 * * * * ?"
everyHour    : "0 0 * * * ?"
everyDay     : "0 0 0 * * ?"
default = everyChange
}

I’ve tried this, but no change in result!

What are you expecting in terms of graphs? When I am looking at these, they appear OK to me, not sure what I am missing:
the first one shows about 24h, the next one about 7d and the last one about 1month…at the time of post, you had only few data and they are depicted on all screens. Maybe have a look at the graphs on a computer screen, they will be less compressed.

Just watch out, rrd4j only be used for graphing if it persist everyMinute, you can add others, but you must have everyMinute.

1 Like

Hi Markus,

yes, i left the persit of items on everyMinute. what I expect was switching the period in one graph like in the excample below. I wonder, why the switching doesn’twork.

Sorry, I seem to be really dense here, still not quite making the connection…what you are showing now, does not correspond to your sitemap code above: in the code you have not “Jahr” defined as timespan, only day week and month (and those seem to work). Can you post the code for what you have shown here?

It doesn’t matter - I need only the ones, I defines in my sitemap - the picture is only an excample from the net. The Problem is, that there are always three graphs displayed, not only one with choosen period. The switch buttons are inaktiv as shown in my cellphone-screenshot. In my browser is only a simple switch shown, as you can see in this screenshot:

Got it, thanks for your patience.
Try putting the service assignment before the visibility statement (making that the very last statement):

Chart item=Temperature		period=W 	refresh=180000    service="rrd4j" 	visibility=[Chart_intervall==1]	

This is just a guess, as it is the only difference from my code (where it works as designed).

Oh, hold…missed that… @amsd there is a little more amiss with your sitemap code I believe: I don’t think you can put them all in a group in your case. Try something like that:

Frame label="Temperatur" {
	Switch item=Chart_intervall label="Temperaturverlauf"	icon="line"	mappings=[0="Tag",1="Woche",2="Monat"]
	Chart item=Temperature		period=D 	refresh=180000     	visibility=[Chart_intervall==0, Chart_intervall=="Uninitialized"]	service="rrd4j"
	Chart item=Temperature		period=W 	refresh=180000     	visibility=[Chart_intervall==1]	service="rrd4j"
	Chart item=Temperature		period=M 	refresh=180000     	visibility=[Chart_intervall==2]	service="rrd4j"
}										}	

Theoretically the sequence of arguments should not matter, but if it still gives you problems try the above.

Thank you for your patience. But the last 2 hints are still not working:disappointed_relieved:
In the Frame, the graphs are only shown on the parent page in the same behavier .I’ll restart OH once again, looking for changes…

So, maybe we need to make smaller steps. It may very helpful to create a new sitemap for testing, that contains only the frame above, nothing else.

So I’ve reduced my sitemap to this:

sitemap gg5 label="Grüner Grund" 
{
Frame label="Temperatur"
		{
		Switch item=Chart_intervall label="Temperaturverlauf"	icon="line"	mappings=[0="Tag",1="Woche",2="Monat"]
		Chart item=Temperature		period=D 	refresh=180000     service="rrd4j"	visibility=[Chart_intervall==0, Chart_intervall=="Uninitialized"]	
		Chart item=Temperature		period=W 	refresh=180000     service="rrd4j"	visibility=[Chart_intervall==1]	
		Chart item=Temperature		period=M 	refresh=180000     service="rrd4j"	visibility=[Chart_intervall==2]	
		}
}	

and the result:

1 Like

Interesting…can you pls post the item definition for Chart_intervall, and can you please define it as a Number item and try again.

Chart_intervall is already a number defined item

Number Chart_intervall

Looks light you thought already about everything.

I noticed that the switch seems to have renderer fine on your cell (screenshot in your first post)…I presume the last pic is from your computer, where it does not render…if not used already, could you pls try it with BasicUI and could you try to use a different browser…
not sure what browser, platform and OH version you are using…

I#m using OH2.4 stable and Firefox-Browser. Trying with Chrome makes no difference. With BasicUI, I#Ve no experience and don’t know how to use.

From the docs: https://www.openhab.org/docs/tutorial/sitemap.html
To finally see the result, browse to the initial openHAB start page http://IP-of-your-machine:8080 and click on the “Basic UI” link.
Also see here, in case you want to learn more: https://www.openhab.org/docs/configuration/ui/basic/

Does your new sitemap work on your phone?

So I created the sitemap basicUI and unfortunatly it looks like this:


on my phone the same.
So I’ll give up for today and sleep over it - thanks for your support so far!