Last Stage After reboot

Hello, I am woundering is it possible to set everything to how it’s benn after raspberry pi reboot ?
Any help is appreciated. :slight_smile:

You will have to provide a lot more details about what you are looking for.

At first, look what you are asking for doesn’t make a whole lot of sense.

Are you thinking about persistence (OH remembering item state after a reboot?) ? If so and you only want it to remember last state, check out mapdb persistence.

Look like what I need, could you link me to a detailed guide of the usage of it? E.G I want to have my item “templinked” to contain it’s value after a reboot. :slight_smile:

I want to savo the value of an item for E.G “templinked” value was “1” before reboot, and after the reboot I want it to go back to that value :slight_smile:

Then you need Persistence with the restoreOnStartup strategy. As Alpoy mentioned, MapDB is a great choice for this.

Quick question can I have more than one persistences E.G mapdb and rrdj4

Absolutely yes. See Design Pattern: Group Based Persistence for one way to do it.

@rlkoshak made a great article about persistence. (Whoops, beat me to it)

In summary:

  1. Install mapdb persistance addon.
  2. Add a group called gRestoreOnStartup (or whatever you want to call it)
  3. Update mapdb.persist with the contents:
    Strategies {
      default = everyChange
    }
    
    Items {
      // persist items belonging to the group on every change and restore them from the db at startup
      gRestoreOnStartup* : strategy = everyChange, restoreOnStartup
    }
    
  4. Add templinked to the group gRestoreOnStarup
1 Like

The MAPdb addon doesnt seem to install properly because neither it creates a config file or a .persist file. :slight_smile:

You should be the one to create it then ;).

I have done that, but still neither it saves the data from templinked and neither it shows up in the default persist. under paperui, I have to enter it manually and it doesnt create a config file of its own.

Oh right, do you see:

What are the relevent errors in openhab.log?

2017-09-26 16:23:52.837 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-persistence-mapdb’: Permission denied

Looks like openHAB doesn’t own the folders anymore. Assuming you installed openHAB automatically (i.e. through apt or openhabian):

sudo chown -R openhab:openhab /etc/openhab
sudo chown -R openhab:openhab /var/lib/openhab2

2017-09-28 18:26:49.275 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-persistence-mapdb’: Error restarting bundles

I’d follow the instructions in this post for that: [Solved] Bindings not updating? - #2 by wborn

Didn’t help :frowning: