Clock like boiler control

Is there a widget/plugin for OpenHAB which lets user control his boiler in a similar way to this device:

1 Like

There is no widget for your sitemap that will work like this.

You will need to adopt the Alarm Clock example (search the forum for Alarm Clock) to put editable start and end times on your sitemap and a rule to send ON/OFF commands to the boiler at those times.

If the times don’t need to be changed manually from the sitemap you can very easily set up that sort of control in rules.

Finally, one of the beautiful things about home automation is you are not stuck with just time. You can turn on and off the boiler based on events and combinations of events such as sunrise, sunset, temperature, whether you are home or not, etc.

I am a beginner at this.
I was copying the 4th example for the Alarm clock “7 Day Three Zone Scheduler with Boost Buttons” :
The code as it is in the example is functional but since I am using OH2 I was wondering about 2 topics:

  1. Are there any modifications needed for this code for OH2?
  2. I noticed that the settings for the alarms/timers are not saved. they are reset to the code values after a reboot. Is there a way for the settings to be saved somewhere so I will not need to re-enter the setting every time?


One thing to change will be the import statements - you don’t need those in OH2.
If you want the settings you have made to “survive” a reboot, you will have to persist your items:

I agree with Oli. The only changes I see needed is to remove all the imports that start with “org”.

And to persist the changes you need to create Items and use persistence to restore them on a reboot.

Could you please help me with how to use persistence in this specific code example?
What and where should I change the code?

Thank you!

There are no changes to the code.


I configured the MapDB persistence, I see the log storing the updates to the MapDB db.
However, when I start up the system the values are not restored.
I suspect the rule code re-initializes the values when system is started ignoring the stored values in mapdb.
example log:

20:39:05.597 [INFO ] [marthome.event.ItemStateChangedEvent] - DownWkSchedTimeHour changed from 17 to 3
20:39:05.607 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for DownWkSchedTimeHour
20:39:05.614 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored ‘DownWkSchedTimeHour’ with state ‘3’ in mapdb database

section of the rule:

rule "Initialization"
System started

 postUpdate(DownWkSchedTimeHour,  17)
 postUpdate(DownWkSchedTimeMinute, 30)

Is it correct? Do i need to modify the rule code?

First, do you have persistence configured with restoreOnStartup on the items? If so then you no longer need this system started rule.

Hi Rick, First I would like to say you are a great contribution to the community.
I have learned a lot from your posts.

As for the thread.
Yes, I think I did it correctly.
I have this mapdb.persist:

Strategies {
default = everyUpdate
Items {
// persist all items once a day and on every change and restore them from the db at startup
gWaterWkSchedTime* : strategy = everyChange, restoreOnStartup
gUpWkSchedTime* : strategy = everyChange, restoreOnStartup
gDownWkSchedTime* : strategy = everyChange, restoreOnStartup
gWeekDays* : strategy = everyChange, restoreOnStartup
gTimerButtonsTimeout* : strategy = everyChange, restoreOnStartup
gTimerButtons* : strategy = everyChange, restoreOnStartup
gSchedSwitch* : strategy = everyChange, restoreOnStartup

and the items are exactly like in the example (4) code:

Group gTimerButtons
Group gTimerButtonsTimeout
Group gWeekDays
Group gDownWkSchedTime
Group gUpWkSchedTime
Group gWaterWkSchedTime
Group gSchedSwitch

Switch ADownstairs “Main Downstairs Switch [%s]” { gpio=“pin:16 activelow:yes force:yes”}
Switch AUpstairs “Main Upstairs Switch [%s]” { gpio=“pin:20 activelow:yes force:yes”}
Switch AWater “Main Hot Water Switch [%s]” { gpio=“pin:21 activelow:yes force:yes”}

Switch DownBoostSwitch “Boost Ground Floor” (gTimerButtons)
Switch UpstairsBoostSwitch “Boost Upstairs” (gTimerButtons)
Switch WaterBoostSwitch “Boost Hot Water” (gTimerButtons)

Number DownstairsBoostTime “Hours [%d]” (gTimerButtons)
Number UpstairsBoostTime “Hours [%d]” (gTimerButtons)
Number WaterBoostTime “Hours [%d]” (gTimerButtons)

Switch DownSchedSwitch (gSchedSwitch)
Switch UpstairsSchedSwitch (gSchedSwitch)
Switch WaterSchedSwitch (gSchedSwitch)

Switch EnableDownstairsScheduler (gSchedSwitch)
Switch EnableUpstairsScheduler (gSchedSwitch)
Switch EnableWaterScheduler (gSchedSwitch)

Switch DownWkSchedMonday “Monday” (gDownWkSchedTime)
Switch DownWkSchedTuesday “Tuesday” (gDownWkSchedTime)
Switch DownWkSchedWednesday “Wednesday” (gDownWkSchedTime)
Switch DownWkSchedThursday “Thursday” (gDownWkSchedTime)
Switch DownWkSchedFriday “Friday” (gDownWkSchedTime)
Switch DownWkSchedSaturday “Saturday” (gDownWkSchedTime)
Switch DownWkSchedSunday “Sunday” (gDownWkSchedTime)

String DownWkSchedTimeStartMessage "%s"
String DownWkSchedTimeEndMessage "%s"
Number DownWkSchedTimeHour “Hour [%d]” (gDownWkSchedTime)
Number DownWkSchedTimeMinute “Minute [%d]” (gDownWkSchedTime)
Number DownWkSchedTimeEndHour “Hour [%d]” (gDownWkSchedTime)
Number DownWkSchedTimeEndMinute “Minute [%d]” (gDownWkSchedTime)

Switch UpWkSchedMonday “Monday” (gUpWkSchedTime)
Switch UpWkSchedTuesday “Tuesday” (gUpWkSchedTime)
Switch UpWkSchedWednesday “Wednesday” (gUpWkSchedTime)
Switch UpWkSchedThursday “Thursday” (gUpWkSchedTime)
Switch UpWkSchedFriday “Friday” (gUpWkSchedTime)
Switch UpWkSchedSaturday “Saturday” (gUpWkSchedTime)
Switch UpWkSchedSunday “Sunday” (gUpWkSchedTime)

String UpWkSchedTimeStartMessage "%s"
String UpWkSchedTimeEndMessage "%s"
Number UpWkSchedTimeHour “Hour [%d]” (gUpWkSchedTime)
Number UpWkSchedTimeMinute “Minute [%d]” (gUpWkSchedTime)
Number UpWkSchedTimeEndHour “Hour [%d]” (gUpWkSchedTime)
Number UpWkSchedTimeEndMinute “Minute [%d]” (gUpWkSchedTime)

Switch WaterWkSchedMonday “Monday” (gWaterWkSchedTime)
Switch WaterWkSchedTuesday “Tuesday” (gWaterWkSchedTime)
Switch WaterWkSchedWednesday “Wednesday” (gWaterWkSchedTime)
Switch WaterWkSchedThursday “Thursday” (gWaterWkSchedTime)
Switch WaterWkSchedFriday “Friday” (gWaterWkSchedTime)
Switch WaterWkSchedSaturday “Saturday” (gWaterWkSchedTime)
Switch WaterWkSchedSunday “Sunday” (gWaterWkSchedTime)

String WaterWkSchedTimeStartMessage "%s"
String WaterWkSchedTimeEndMessage "%s"
Number WaterWkSchedTimeHour “Hour [%d]” (gWaterWkSchedTime)
Number WaterWkSchedTimeMinute “Minute [%d]” (gWaterWkSchedTime)
Number WaterWkSchedTimeEndHour “Hour [%d]” (gWaterWkSchedTime)
Number WaterWkSchedTimeEndMinute “Minute [%d]” (gWaterWkSchedTime)