OH2 Item State Understanding

Hi, this is Frank. I am more or less new with Openhab2.
Currently i am also running Fibaro HomeCenter 2 but i am missing flexibility there. I am still using OH2 now since 2 month and i have successfull transfer a lot of zwave devices from Fibaro into the OH2 system.

My System are Installed into a virtual VM with lubuntu on my DS718+ Device. System looks like stable.

Now i stuck with my item states. If i starting PaperUI or BasicUI i should found often my devices with NULL value. If i stay there for a while, some devices change there status from NULL into the right state, i.e. Switch, Temperature, Humidity… . I do not understand the reason because the items states are NULL. I should have persistance with mariaDB active and running. I should found the right values in my persistance DB as well, but the restore of item states are only after a system reboot or? Please tell me if I made an error in reasoning.

Thanks in Advanced

Do you configure your items in a items file or via paperUI?

If you do it in a text file, like I do, if you reload the item file by chaning one item all items will set to NULL and then back to the vaule before. But this does not work on every time. Sometimes the values which are set by a binding stay at NULL until the binding updates them.

I use a rule to reset the value from MAPDB. Only way I found.

rule "PresistenceWiederherstellen"
	Item SW_PresistenceWiederherstellen changed to ON
	logInfo("Info", "PresistenceWiederherstellen")	

	gRestoreState.members.forEach[ item |
		logInfo("Logger","Itemname laden: "+item.name)
		logInfo("Logger","Itemname laden: "+item.state.toString)

Get it. Because of the new system i change every day the item textfile. Many Thanks for your explanation.

Unless you changed your item names, your persistence should still restore the previous values if you configured your strategies correctly: https://docs.openhab.org/configuration/persistence.html#restoring-item-states-on-restart
but and there is a but, you may find timing issues that require a workaround: https://docs.openhab.org/configuration/persistence.html#startup-behavior
and finally, MapDB is a fast and lightweight database (MariaDB may take longer for this operation) that a lot of users take for restoring numerical values (does not work for strings) on startup; you can have multiple persistence services, just make sure you define the correct one as your default.


I use exactly what you have written here. The problem we are talking about is not restart of OH, just reload of item file. Sometimes the reload of item file causes all items in the file to set to NULL and back to value due to persistance. But sometimes not. Then they hang on NULL until z-wave update.

Then i should have another question. Does a reload of item file (because of change) indicate a persistence “restoreOnStartup”?

How can this be checked? I can only see, that mostly the values of reloaded items come back, but sometimes not.

Another hint can be, that some items are in a different file which is not reloaded. But the reload of a item file causes all items n al litems files to set to NULL. One of my next thing is to consolidate all items to one item file. May be this will help.

Ah OK, read your post too fast…sorry…never saw that behavior you are describing though (but I do not use zwave either)