And my apologies if I sounded rude - trying to code in a noisy household with a sick dog can be unproductive and frustrating!
@alfista2600:
HOw did you figure the root cause out?
Could you please share, because I struggle with the same behavior
Thanks in advance.
It had to do with the formatting of the values, I believe.
For example. If I had:
Switch switch_office_lamp "Office" <switch> {some binding}
it would temporarily show the value but if I had:
Switch switch_office_lamp "Office [%s]" <switch> {some binding}
It would work as expected.
Hi @rlkoshak,
since migration to OH2 I am struggling with persistence and tried to follow your path. Especially because I would like to use āpreviousStateā.
However, rrd4j (in your Tier 2) does not work on switches (e.g. previousState == OFF), right?
How do you manage to get those previousStates then?
Thanks!!
Rrd4j does work for Switches, at least it used to. Are you not getting the right value or are you getting null?
This was the case for OH 1 (switches have been stored as 0 or 1).
In OH 2 this is not the case anymore - rrd4j is working for numbers only - right?
At least this is the ācommon understandingā I have read about so farā¦
That is correct. rrd4j is just for numbers. If Switches (and presumably Contacts) are no longer stored as 1 and 0 then rrd4j wonāt work. You can look at SQLite which is also an embedded DB (i.e. no separate server to set up) though others have had some problems getting JDBC working and Iāve yet to figure out why people are having problems or how to help. Iām personally pretty happy with InfluxDB, though Iām having a problem with the recent change where calls to maximumSince and minimumSince are failing with an error.
Iām not sure I have a good solution to recommend.
Yes, I am one of them - see here:
I followed your recommendation about (3 Tier aproach).
I even tried H2 with the same result.
Thanks for your help, though.
Well, I can say that the InfluxDB tutorial worked very well for me. It isnāt embedded but it seems to work.
The issue with SQLite, at least for me, is that there is a bug in the 3.8.11.2 version of sqlite_jdbc. Updating this to a more recent version allowed the persistence to start up without error. This was on a Raspberry Pi and as far as I can tell the bug is related to the arm platform though that is not certain. I wasnāt able to figure out how to update it properly so just copied a newer version of the library overtop of the existing one with the old name.
In my case it was wrong config file name. I wanted to have jdbc-sqlite based persistence and put config as sqlite.persist
to /etc/openhab2/persistence
. It was enough just to rename config to jdbc.persist
and everything worked fine.
I think itās must be mentioned somewhere in documentation that config file names must match service names.
Hi,
it would be of great help if the āone minuteā restriction as well as the string restriction were a comment in the rrd4j.persist file (see below).
Finally it is not clear if Switch or Contact items can be stored or not.
I would be happy if you could add this to the repository so that the demo files will include this hint in the future.
Kind regards,
Axel
// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
// for rrd charts, we need a cron strategy of one minute (mandatory to make rrd charts work)
everyMinute : "0 * * * * ?"
}
Items {
// storable items have to be of type Number
// rrd does not store strings !!!
DemoSwitch,NoOfLights,Window_GF_Toilet,Heating* : strategy = everyChange, everyMinute, restoreOnStartup
// let's only store temperature values in rrd
Temperature*,Weather_Chart* : strategy = everyMinute, restoreOnStartup
}
I second that, BUT: it is always a good idea to follow the docs where you can find:
For rrd4j to work, the strategy everyMinute has to be used
and
NOTE: rrd4j is for storing numbers only.
Thanks man. I was going nut with postgresql.persist!
I think that sometimes openhab is so powerful and flexible that you donāt know what to do. Some more examples would be great.