Charts for group items vs the group itself


(Jakob Jensen) #1

Hello

When following the documentation to insert charts into sitemaps, I am running into some trouble regarding groups.

The group Temperature_Living contains multiple temperature sensors. All sensor values AND the value of the group itself, are persisted every minute and on every change.

Group item:

Group:Number:AVG Temperature_Living "Temperatur (Stue) [%.1f °C]" <temperature> (Temperature_Inside, Temperature_Inside_MIN, Temperature_Inside_MAX)

Sitemap chart:

Chart item=Temperature_Living refresh=60 period=W

The above generates a chart, with a series (line) for EACH for the sensors in the group. The generated URL for the image is as follows:

http://openhab:8080/chart?groups=Temperature_Living&period=W&theme=bright&t=1523367877065

Instead of a line for each sensor in the group, I would like to get a single line, showing the group itself. I can do this because I also persist the value of the group itself, and if the URL is changed to the below, it works fine (Changed groups= to items= ):

http://openhab:8080/chart?items=Temperature_Living&period=W&theme=bright&t=1523367877065

Unfortunately I cannot decide in the sitemap configuration if I want the group items or the group itself to be shown in the chart. Or does anyone know a way to do this?


(Rich Koshak) #2

I’m pretty sure you can’t do this with the built in Charts. If you need more control over your charts you need to use something like:


(Jakob Jensen) #3

That’s pretty sad, because the intended graph can already be rendered. It is just a matter of changing the URL of the chart image being loaded by the sitemap…


(Lolodomo) #4

What happens if you put Temperature_Living in a specific group and use this group as item for chart ?


(Vincent Regaud) #5

What is you copy the value of the group in a rule on every update to a proxy item and graph the proxy item only?


(Jakob Jensen) #6

Thanks for the ideas. I really do not like adding pseudo items just to fix something that is already working. (I.e. the data is already persisted for the Temperature_Living item, and the graph can actually be shown, if the image URL changes one parameter). - The simplest solution at this time, is not to use the Chart element in the Sitemap, but to use an Image element in the Sitemap instead, where I manually add the URL for the graph. Works fine for now.

So just in case anyone else has the same problem: If you create a Chart for a Group Item, then the Chart will depict a dataseries (line) for each of the included group members. However, if you change the “?group=” part in the URL, to “?items=”, it will show the value for the group itself. (Which is the value, e.g. AVG, depending on the group configuration). Naturally, this will only work, if the group value itself is also persisted.

// Instead of the Chart item:
Chart item=Temperature_Living refresh=60 period=W

// I now use the Image item:
Image url="http://myhome.com:8080/chart?items=Temperature_Living&period=W" refresh=60

Drawback: URL must be available from wherever you access the chart, but that is no problem if you have a (sub)domain linked to your openHAB server.