Is it possible restore last state of the switch after openHAB restart?

I am using switch for mode definition (manually/auto). This mode define if a relay can be switched by rule or only by click.
Is there any chance define that after openHAB restart this switch restore last state ?

That’s what persistence and the restoreOnStartup is for.

Thanks, I already readed, but for me as not so skilled programmer is hard to understand description.

The link above provides a brief introduction to persistence and informs you that unless you’ve done something. to remove it, rrd4j is installed as a default persistence.

So, if you have a standard OH 3 instance you will have rrd4j installed. As it says, without further configuration, rrd4j applies restoreOnStartup on all supported Items and mentions that Switch Items are among the supported Item types.

So you are done. This Switch is already being restored to the last state on OH startup.

If you’ve created a custom rrd4j.persist file, make sure it includes restoreOnStartup as a strategy.

If you’ve removed rrd4j for some reason, either reinstall it, or if all you want is restoreOnStartup and don’t care about charting, install the MapDB add-on instead. Both include restoreOnStartup among the default strategies so there’s nothing to configure.

Yes you are right, switch status was restored
Problem is only with one string which is NULL

for this I must find other way how to handle

rrd4j doesn’t support Strings, but MapDB supports all Item types.