Keep the item settings during reboot

Hi,

because the ASTRO-Binding hangs regularly, I let my Openhabian frequently restart via cron job. During the reboot some important states are lost. So what is the most useful and easy way to keep these values? Here are two examples:

Items:

Switch 			alarm_switch			"Enable alarm"		<alarm>			(gSzenen)
Switch 			holiday_switch			"Enable holiday"	<urlaub>		(gSzenen)

Sitemap:

Frame {
	Text label="Szenen" icon="smarthome" {
		Switch item=alarm_switch
		Switch item=holiday_switch
}

In use for rules like:

rule "Holiday_All_Off"
when
	Time cron "0 26 23 * * ?"
then
	if(holiday_switch.state == ON){
		sendCommand(all_lights, OFF)
		sendCommand(all_shutters, DOWN)
	}
end

Easiest way is to use persistence

http://docs.openhab.org/configuration/persistence.html

1 Like

Take a look here: Design Pattern: Group Based Persistence

especially the part mapdb.persist file, since all the data is restored there

1 Like