How to restore the settings after you restart the server in openhab 3 UI

Tags: #<Tag:0x00007f1735a2ec68>

Hi. how to restore the settings after restarting the server. I installed MapDB and created a mapdb.persist document in openhab. config. In the file propel :

Strategies {

    default = everyUpdate

}

Items {

    // persist all items on every change and restore them from the db at startup

    * : strategy = everyChange, restoreOnStartup

}

but the openhab 3 UI settings are not saved. On the temperature setting widget null

First of all, by default openHAB comes with rrd4j configured to save every supported Item type and restoreOnStartup by default. So you really only need MapDB if you need to save and restore Items not supported by rrd4j (e.g. String Items). If you do use MapDB, you will want to create a custom rrd4j.persist file to stop it from restoreing the values on startup too.

Secondly, there is a ton of stuff that goes on between the restoreOnStartup and what get’s shown in the UI. So the question is, what is the actual state of the Item? NaN is a way for JavaScript to report that you are trying to use something as a number that isn’t a number. There are a lot of things that could cause that like Units of Measurement beyond the Item failing to be restored.

I created (Number Ystavka “Уставка [%.1f %unit%]” (gLiving_Room_HVAC) [“Setpoint”,“Temperature”]) without a channel and created a step widget for it. This is a parameter for setting the temperature of the thermostat. I want it to return to its original state after a reboot.
I have now switched back to rrd4j but items do not return to the set state after a reboot. It was the same when I used MapDB.
what should I do to get my items back to their previous state after a reboot?

Do you have .persist files? If so what’s in them? Have you set the default persistence service in the settings?

there is nothing in the persist files. in the settings there is a check mark on rrd4j.what is the most interesting openhub 3 on windows, I keep the state items. And on raspberries pi it will not save the state after a reboot. Сan I reinstall openhub 3 on raspberries? I understand correctly? openhub 3 by default saves the state of items after reboot?

Tell me please. one question for you.Can i do remote access to configuration files to openhab 3. i would like settings my openhab remotely.i would like to use VS-Code when i am on my work. Server is my home at that time. How do it?

How did you install? If openHABian do you have zram enabled? Are you restarting the whole machine or just openHAB?

If you config everything through the UI you can get to it through myopenhab.org. If you want to use VSCde, Sadly the answer is if you have to ask you probably can’t do it, at heart not safely. You’ll either need to open up your home network to at least one port and set up an ssh service. But then anyone and can see and access that port so it will be under constant attack.

I recorded the image of the openhabian on the HDD USB and connected it to the raspberry pi. After that openhabian was established. To reboot, I turn off the power to the raspberry board. I am emitting a power outage. I want to return the items settings to their original state when the electricity is turned on.

Thanks a lot for answering the second question. I configure openhub via config files. It is a pity that I cannot configure remotely in this way.

What did they give me with my openhabian so that he could restore items after reboot?

That’s a really bad idea. Even with an HDD yanking the power can result in corrupted files. And, since you have openHABian you likely have zram configured. That means everything is stored in RAM. When you yank the power everything that is in RAM gets lost without being written out to disk.

You should:

  1. Never yank the power from any machine. Always shut it down first.
  2. If you are on an HDD, ZRAM is doing nothing for you. Disable it.

Even with zram, if you shut the machine down instead of yanking the power, it will write out the contents from RAM and be able to restore it later.

did I understand correctly? If I use a hard drive, the persistence service will not save items? I have not configured zram. if I use a USB flash drive instead of a hard drive, then the data will be saved by the persistence service? But the flash drive often breaks.

No you misunderstood completely.

If you use openHABian, it configures zram by default. You need to change that or else every time you pull the power you will lose everything saved in RAM. And you don’t need zram configured because you don’t need to limit the number of writes to the drive. So disable it.

And you should never just pull the power from any computer. You run the very real risk of corrupting files and file systems regardless of the type of storage you are using. If you had not been pulling the plug like this your Items would have been restored.