my OH runs on a windows machine, sometimes you need to restart a windows machine
once i restart the system and restart OH it loads up with values set as NULL this stops my rules from working i have to toggle certain switches so that the rules start working again
eg i have a moviemode switch its set in all my lighting rules to not change the lights if this is switched to on once restarted it gets set to NULL
is there a way to set these values on startup or do i need edit my rules to account for this
I suggest you to have a look at persistence and RestoreOnStartup - a simple persistence service like MapDB could be exactly what you’re looking for
Persistence is something that i plan on getting setup i want to record a few values of different items
but it seems complicated and im still trying to understand the basics of just rules , items ect all my setup has been done with paperui apart from a few simple text rules people have helped me create
so iv been scared to dip my toes into that part and alot of other parts until i understand more
i will still look into what you suggested thanks for your response
i have looked at what you recomended
is this db only use for the startup restore
Don’t be afraid, it’s not that complicated. Quick and dirty as a first reference:
- install persistence MapDB
- put it as “default persistence” in PaperUI settings
- create a file
/etc/openhab2/persistence and give it content like this:
default = everyChange
* : strategy = everyChange, restoreOnStartup
On every state change, the current state (and only the current!) is persisted for that item; RestoreOnStartup instructs to… restore the state of each item on startup, huh
Just try it!
there are alot of things that i didnt understand about computers and iv never learned by being scared of trying new stuff on computers give me a moment
all these text files have been scaring me since i started all this last month lol
im running on windows is this in conf/persistence
i have done what you said using the location above not the one you gave the KARAF says its refreshed the model
is that done now then ? do i need to add my items to the file i created
Of course you’re right, $CONFDIR/persistence would be the correct suggestion - but you found it anyways When you’re using * so you tell to store every item, so no further configuration needed at this point. You store every item on every change and restore it on every startup to its last state.
* : strategy = everyChange, restoreOnStartup
You can temporarily set the log level in Karaf console to DEBUG for this persistence, then you’ll see what it’s doing:
openhab> log:set DEBUG org.openhab.persistence.mapdb
2018-01-08 08:32:01.656 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Sun_Azimuth
2018-01-08 08:32:01.662 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Sun_Azimuth' with state '125.41' in mapdb database
2018-01-08 08:32:01.671 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Sun_Elevation
2018-01-08 08:32:01.679 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Sun_Elevation' with state '-0.09' in mapdb database
If you really want to work without persitence for the time being, then you can also set Item’s at system startup via a rule! I urgently recommend a persistence!
rule"Remove Item Status NULL"
if (moviemode.state == NULL) moviemode.sendCommand(OFF)
i have followed the steps above and setup mapdb persistence the reason i want to avoid some tasks is i dont want to bite off more than i can chew
i have a few posts on here asking how to do some things they have been left open at the moment some are complicated and are going to require more time and learning to get right
alot of learning how to use the text files
setting up persistence for temps and other items
adding calander events
adding my hue motion sensors
its a complicated and expensive hobby thats just a tiny list of the things i want too do but dont understand soon maby
Do it step by Step … not all at the same time … and do it in right Order
Persistentce should be on the Top of ToDo !
i have followed the steps posted above just restarted my system and set the log to debug persistence
12:00:23.899 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for Movie_Mode_Trigger
12:00:23.899 [INFO ] [marthome.event.ItemStateChangedEvent] - Movie_Mode_Trigger changed from ON to OFF
12:00:23.900 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'Movie_Mode_Trigger' with state 'OFF' in mapdb database
i dont think it restored the values on startup looks like it was still set to NULL after start
2018-01-08 11:57:41.583 [ItemStateChangedEvent ] - Movie_Mode_Trigger changed from NULL to ON
seems to be ok after second restart maby NULL value was saved ?
After restart is Init Value NULL and then the MapDB set it’s stored Value …
the change to moviemode was done by me manually and it changed from NULL to ON and then i pressed it off manually and it changed from ON to OFF
it might be ok now will check again
i will also get back to you on the rule you were helping me create for my hue light iv had a few backup problems (Unrelated Data Backup) still sorting them as we speak
Thanks thats that problem solved
how do i remove the logging it keeps showing in my log when things are stored ?
openhab> log:set INFO org.openhab.persistence.mapdb
These DEBUG log setting is also forgotten when you restart openHAB 2 as you didn’t make it permanent in the config file.
thanks for that and thanks for your help