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 https://home.myopenhab.org/paperui/index.html#/extensions
So need to head home and try it out
{
"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.
java.lang.NullPointerException
at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.removeFutures(ExpressionThreadPoolManager.java:321)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.remove(ExpressionThreadPoolManager.java:291)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.scheduler.ExpressionThreadPoolManager$ExpressionThreadPoolExecutor.remove(ExpressionThreadPoolManager.java:308)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.removeTimers(PersistenceManagerImpl.java:321)[103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.stopEventHandling(PersistenceManagerImpl.java:377)[103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
at org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl.removeConfig(PersistenceManagerImpl.java:348)[103:org.eclipse.smarthome.core.persistence:0.9.0.b4]
at org.eclipse.smarthome.model.persistence.internal.PersistenceModelManager.modelChanged(PersistenceModelManager.java:85)[125:org.eclipse.smarthome.model.persistence:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:120)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
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
Heating_LivingRoom_Setpoint.rrd
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
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.
@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.
visibility=[chart_period+chart_selection==11]
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ā¦)
Ok, so I will create a new rule:
rule "Update graph"
when
Item chart_period changed or chart_selection changed
then
chart_visible.sendCommand(chart_period.state + chart_selection.state)
end
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
Please try
chart_visible.sendCommand((chart_period.state as Number) + (chart_selection.state as Number))
instead.