Graphing in sitemap

Your need to install REST Documentations via PaperUI Add-ons Misc.
On REST API select persistence and on that page the third get.
For serviceID put in “rrd4j” and for itemname the name of one of your persisted items ( not a group) and hit “Try it out”.
If your database contains any data you will see a reponse body like:
“name”: “E10_1”,
“datapoints”: “1416”,…"
Of course with the name of your item, if the number of data points is zero, the database have no entries.
Note that the .rrd file is created before any value is persisted and it size won’t change. So the existence of that file doesn’t tell that something is saved!

Seems to be a bug in OH, that let you not install addons on

So need to head home and try it out :slight_smile:

  "name": "Heating_LivingRoom_Setpoint",
  "datapoints": "0",
  "data": []

seems like there is no data, what can be the problem?

File has this:

^@R^@R^@D^@4^@J^@,^@ ^@v^@e^@r^@s^@i^@o^@n^@ ^@0^@.^@1^@ ^@ ^@^@^@^@^@^@^@<^@^@$

hmm, more debug…

Error handling update of file '/etc/openhab2/persistence/rrd4j.persist': null.
	at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.removeFutures([98:org.eclipse.smarthome.core:0.9.0.b4]
	at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.remove([98:org.eclipse.smarthome.core:0.9.0.b4]
	at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.remove([98:org.eclipse.smarthome.core:0.9.0.b4]
	at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.removeTimers([103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
	at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.stopEventHandling([103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
	at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.removeConfig([103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
	at org.eclipse.smarthome.model.persistence.internal.PersistenceModelManager.modelChanged([125:org.eclipse.smarthome.model.persistence:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners([122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel([122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile([122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1([122:org.eclipse.smarthome.model.core:0.9.0.b4]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent([122:org.eclipse.smarthome.model.core:0.9.0.b4]

According to your initial post., the item in question is only persisted on everychange and not everyminute.

I tried updating the persitance rule, as well as persisting other items without success! I expect it might be some issue with the persistence file in the xml database or something…Or the persistence.cfg file…

Confirm that you changed the rrd4j.persist in order to have the Group_Chart also be persisted everyMinute.

I have the number item:
Number Miflora_Sensor5_Temperature "Sensor5 Air Temperature [%.1f °C]" <text> (gMiflora, Group_Temperature,Group_Temperature_LivingRoom)

Which is a member of :
Group Group_Temperature(Group_Chart)

and the persitance file is now:

Strategies {
        // for rrd charts, we need a cron strategy
        everyMinute : "0 * * * * ?"

        default = everyChange

Items {
        // additionally persist weather info every minute
        Group_History* : strategy = everyUpdate, everyMinute
        Group_Chart* : strategy = everyUpdate, everyMinute

and the miflora clearly get updated:
2017-11-26 13:01:04.480 [ItemStateChangedEvent ] - Miflora_Sensor5_Temperature changed from NULL to 21.8

So how come no files are here?

[13:02:30] pi@openHABianPi2:/var/lib/openhab2/persistence/rrd4j$ ls

Earlier you stated that you are curious about the “entries” in that file. Do you have the file or not?
If you have it, try to stop OH, delete the file and then restart.

A further step would be to start logging DEBUG entries for rrd4j.
To do that log into the Karaf console and enter the command:

log:set DEBUG org.openhab.persistence.rrd4j

It seems like a mapping to the graph group item were the problem:

But it leads me to an other issue, I can not plot the average temperature of my 8 temperature sensor :frowning:

Group:Number:AVG Group_Temperature_LivingRoom(Group_Chart) "Avg. Indoor Temperature [%.1f °C]" <temperature>

Since this is not allowed and it then freezes the persistence(does not add data to any rrd4j persistence) I am stuck with plotting 1 of the temperature against the set temperature for now

I do not have any experience with groups.
However for such an average I would use a rule to calculate the average and save that to a dedicated item, which in turn can be persisted.

I have been thinking about it:) But for now I will get the rest working before adding more complexititvity to my system… I keep you posted

At least you have got rrd4j and it’s graphing working for now.

You just need to add Group_Temperature_LivingRoom to your persistence line in addition to Group_Chart*. I know of no other workaround right now but can confirm that doing so will persist the value of Group_Temperature_LivingRoom.

1 Like

@rlkoshak Where on Github should I report this issue and who to contact to get the documentation updated on this issue?

Also I do not quite understand this:
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_period==1]

Why can we use chart_period and not chart_period.state? and is it legal to combine two items in the statement?

Chart item=Heating_LivingRoom_Setpoint period=D refresh=30000 visibility=[chart_period+chart_selection==11]
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_period+chart_selection==12]
Chart item=Heating_LivingRoom_Setpoint period=M refresh=30000 visibility=[chart_period+chart_selection==13]
Chart item=Heating_LivingRoom_Setpoint period=Y refresh=30000 visibility=[chart_period+chart_selection==14]
Chart item=Heating_BedRoom_Setpoint period=D refresh=30000 visibility=[chart_period+chart_selection==21]
Chart item=Heating_BedRoom_Setpoint period=W refresh=30000 visibility=[chart_period+chart_selection==22]
Chart item=Heating_BedRoom_Setpoint period=M refresh=30000 visibility=[chart_period+chart_selection==23]
Chart item=Heating_BedRoom_Setpoint period=Y refresh=30000 visibility=[chart_period+chart_selection==24]

For the last part (using the sum of variables for visibility) I’m using a separate proxy-variable which gets set to the sum of variables by a rule, which gets triggered by any change of those variables.


This is not allowed. Please keep in mind, that we are talking of states, not numbers, so how to “add” ON and CLOSED? If the Items are of type number, the visibility takes a look at the state anyway.

However, there is absolutely not reason to summarize some states. Just use a Boolean and:
visibility=[chart_period==1 && chart_selection==10]

The reason, why there is no .state is, this is the sitemap. You can’t refer to details of an item other than it’s state in a sitemap. (Well, that’s not correct… but correct in matters of condition)

The openhab-docs repo is where you can file an issue.

Because in the sitemap you do not reference the .state, one the Item. The docs state the syntax for visibility is

visibility=[item_name operator value, item_name operator value, ... ]

So it does say that you only use the Item name, not Item.state.

Also, based on the line above and one of the examples

visibility=[Day_Time=="Morning", Day_Time=="Afternoon", Temperature>19]

So yes, you can use more than one Item to control the visibility. However, they are treated as OR meaning if any one of the comparisons are ture then the element will be visible.

In the third example above, a control for a lawn sprinkler will be visible if it is Morning, OR if it is Afternoon, OR if the temperature is above 19 °C. Combining multiple conditions, for example Morning AND above 19 °C is not supported. To control visibility based upon combining multiple Items, or on more complex conditions, consider defining and using an additional Item that is set by a Rule.

However, you cannot do math in the visibility clause. You can only perform boolean operations.

Is that supported now? The docs imply that isn’t allowed but there have been a lot of changes and I’m not sure the docs have kept up.

Ouch! You’re right, sorry… messed that up (The wish was father to the thought…)

1 Like

Ok, so I will create a new rule:

rule "Update graph"
    Item chart_period changed or chart_selection changed
   chart_visible.sendCommand(chart_period.state + chart_selection.state) 

And the sitemap:

Chart item=Heating_LivingRoom_Setpoint period=D refresh=30000 visibility=[chart_visible==11]
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_visible==12]
Chart item=Heating_LivingRoom_Setpoint period=M refresh=30000 visibility=[chart_visible==13]
Chart item=Heating_LivingRoom_Setpoint period=Y refresh=30000 visibility=[chart_visible==14]
Chart item=Heating_BedRoom_Setpoint period=D refresh=30000 visibility=[chart_visible==21]
Chart item=Heating_BedRoom_Setpoint period=W refresh=30000 visibility=[chart_visible==22]
Chart item=Heating_BedRoom_Setpoint period=M refresh=30000 visibility=[chart_visible==23]
Chart item=Heating_BedRoom_Setpoint period=Y refresh=30000 visibility=[chart_visible==24]

Yes, this version is better, though not correct, as it’s not possible to sumarize states :wink:
Please try

chart_visible.sendCommand((chart_period.state as Number) + (chart_selection.state as Number))