Custom Time schedule in Sitemap

Hello Community,

is it possible to create custom time schedules within a Sitemap?

I want to implement my watering system (exist out of Shelly Unis) into Openhab and want to schedule a timeframe for the watering.


  • Start Time
  • End Time


  • Start Time
  • Watering Time (in Minutes)

The Shelly integration is no Problem, but I’m not sure if I can implement time schedules within a Sitemap.

Thank you very much!

Short answer: No.

Long answer: Yes. But… :wink:

There is no direct option to do, because there aren’t any Widgets to set time via Sitemap. Create some Items (start_hour, start_minute, stop_hour, stop_minute…) to set hours and minutes, then create a rule to calculate the command to send to the shelly. There are tons of rules here to do this.

But some general thoughts about: Do you need to set exact minute and hour? Maybe ten minute steps would be sufficient. Or maybe it would even suffice to set time in a more simple way, e.g. “time 1”, “time 2” and “time 3” (chose from a list of possible values).

Another option would be to use a calendar.

Or don’t do it by time at all, but by sun, rain, humidity and temperature (and weather forecast).

Hello Udo,

thank you for your quick answer.

For “normal” watering it is sufficient to have a rule for a scheduled time, thats right. I only asked because it would be more individual if i can set the start-time within the app directly.

I think i will implement then switches for start-times (hard coded within the rule), but it would be very nice if we have a extra field (or calendar) to set custom time schedules in future.

i solved my problem with String items and defined it within the sitemap as “selection”.

In the picture you can see the “selection” named as “Startzeit” and “Minuten”, as i need to configure the start-hour and start-minutes.


Text label="Gardena Sprinkler" icon="gardena" {
      Frame label="Sofort / Übersicht" {
        Switch item=bew_man_leitung1 label="Leitung 1" icon="gardena"
        Switch item=bew_man_leitung2 label="Leitung 2" icon="gardena"
        Switch item=bew_man_leitung3 label="Leitung 3" icon="gardena"
        Switch item=bew_man_leitung4 label="Leitung 4" icon="gardena"
        Switch item=bew_man_leitung5 label="Leitung 5" icon="gardena"
        Switch item=bew_man_leitung6 label="Leitung 6" icon="gardena"
        Selection item=bew_dauer label="Dauer (in Minuten)" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]

      Frame label="Programmierung" {
        Text label="Auswahl Leitungen" icon="faucet" {
          Switch item=bew_leitung1 label="Leitung 1"
          Selection item=bew_dauer_zeit_1 label="Dauer 1" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
          Switch item=bew_leitung2 label="Leitung 2"
          Selection item=bew_dauer_zeit_2 label="Dauer 2" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
          Switch item=bew_leitung3 label="Leitung 3"
          Selection item=bew_dauer_zeit_3 label="Dauer 3" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
          Switch item=bew_leitung4 label="Leitung 4"
          Selection item=bew_dauer_zeit_4 label="Dauer 4" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
          Switch item=bew_leitung5 label="Leitung 5"
          Selection item=bew_dauer_zeit_5 label="Dauer 5" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
          Switch item=bew_leitung6 label="Leitung 6"
          Selection item=bew_dauer_zeit_6 label="Dauer 6" mappings=[15="15 Mins", 20="20 Mins",25="25 Mins",30="30 Mins",35="35 Mins"]
        Text label="Auswahl Tage" icon="calendar" {
          Switch item=bew_day_1
          Switch item=bew_day_2
          Switch item=bew_day_3
          Switch item=bew_day_4
          Switch item=bew_day_5
          Switch item=bew_day_6
          Switch item=bew_day_7
        Selection item=bew_zeit_std label="Startzeit" mappings=[03="03 Uhr",04="04 Uhr",05="05 Uhr",06="06 Uhr",07="07 Uhr",08="08 Uhr",19="19 Uhr",20="20 Uhr",21="21 Uhr",22="22 Uhr"]
        Selection item=bew_zeit_min label="Minuten" mappings=[00="00", 15="15",30="30",45="45"]


// funktionelle Leitungen für Auswahl automatischer start
String bew_zeit_min "Minuten" <time>
String bew_zeit_std "Stunde" <time>
Number bew_dauer_zeit_1 "Dauer" <time>
Number bew_dauer_zeit_2 "Dauer" <time>
Number bew_dauer_zeit_3 "Dauer" <time>
Number bew_dauer_zeit_4 "Dauer" <time>
Number bew_dauer_zeit_5 "Dauer" <time>
Number bew_dauer_zeit_6 "Dauer" <time>
Switch bew_leitung1 "Leitung 1" <switch>
Switch bew_leitung2 "Leitung 2" <switch>
Switch bew_leitung3 "Leitung 3" <switch>
Switch bew_leitung4 "Leitung 4" <switch>
Switch bew_leitung5 "Leitung 5" <switch>
Switch bew_leitung6 "Leitung 6" <switch>
Switch bew_day_1 "Montag" <switch>
Switch bew_day_2 "Dienstag" <switch>
Switch bew_day_3 "Mittwoch" <switch>
Switch bew_day_4 "Donnerstag" <switch>
Switch bew_day_5 "Freitag" <switch>
Switch bew_day_6 "Samstag" <switch>
Switch bew_day_7 "Sonntag" <switch>

// funktionelle Variablen / Items
Switch bew_aus_alle_man "Alle Leitungen aus" <none> {autoupdate="false"}
Switch bew_aus_alle "Alles aus (9, 12, 18 Uhr)" <switch>
Switch bew_timer_triggered "Timer Bewaesserung" <switch>
Switch bew_timer_day "Timer Tag" <switch>

// funktionelle Leitungen zum manuellen starten
Number bew_dauer "Dauer" <time>
Switch bew_man_leitung1 "Leitung 1" <switch>
Switch bew_man_leitung2 "Leitung 2" <switch>
Switch bew_man_leitung3 "Leitung 3" <switch>
Switch bew_man_leitung4 "Leitung 4" <switch>
Switch bew_man_leitung5 "Leitung 5" <switch>
Switch bew_man_leitung6 "Leitung 6" <switch>


for day-schedule:

rule "Bew_timer_triggered auto"
	Time cron "0 30 00 * * *"


rule "Bew_day_schedule"
	Time cron "0 2/5 * * * *"
  //Item test_switch received command
  var iDoW = now.getDayOfWeek().toString()
  //logInfo("Gardena", "Tag: " + iDoW)

  if(iDoW == "MONDAY" && bew_day_1.state == ON) {
  else if(iDoW == "TUESDAY" && bew_day_2.state == ON) {
  else if(iDoW == "WEDNESDAY" && bew_day_3.state == ON) {
  else if(iDoW == "THURSDAY" && bew_day_4.state == ON) {
  else if(iDoW == "FRIDAY" && bew_day_5.state == ON) {
  else if(iDoW == "SATURDAY" && bew_day_6.state == ON) {
  else if(iDoW == "SUNDAY" && bew_day_7.state == ON) {
    //logInfo("Gardena", "Tag: Regel Sonntag aktiv.")
  else {
    //logInfo("Gardena", "Tag: Regel nicht aktiv.")


Rules for program start:

  • The rule checks if the program was already run today (item bew_timer_triggered)
  • The rule calculate out of the choosen hour and minutes and the actual time if the time passed to activate the program
  • the rule checks the rule checks if i want to run the program today and have a look if the “bew_timer_day” value is ON (how i calculate if the item is switched ON or OFF you can see above in the other rules)
  • the program start and checks for each watering-system, if i switched it ON and how long i want to have it ON.
//Regeln für zeitgesteuerte Wochenbewässerung

rule "Bew_leitungen_zeitgest"
  //Item test_switch received command
  Time cron "0 0/5 * * * *"
    val String stunde = now.getHour().toString()
    val String minute = now.getMinute().toString()
    if (Integer::parseInt(minute) < 10) {
      minute = "0" + minute
    //logInfo("Gardena", "Bewässerungsprogramm: Minuten " + minute)
    var akt_stdmin = stunde + minute
    val stdmin_itm = bew_zeit_std.state.toString + bew_zeit_min.state.toString

    val Number akt_stdmin_n = Integer::parseInt(akt_stdmin)
    val Number stdmin_itm_n = Integer::parseInt(stdmin_itm)

    //pruefen ob nicht schon einmal gelaufen heute
    if(bew_timer_triggered.state == OFF) {
      logInfo("Gardena", "Bewässerungsprogramm: Gate 1 erreicht.")
      //logInfo("Gardena", "Bewässerungsprogramm: Uhr aktuell: " + akt_stdmin + " | Timer: " + stdmin_itm)
      //logInfo("Gardena", "Bewässerungsprogramm: Uhr aktuell: " + akt_stdmin_n + " | Timer: " + stdmin_itm_n)

      //pruefen ob Uhrzeit ueberschritten wurde
      if( akt_stdmin_n > stdmin_itm_n ) {
        logInfo("Gardena", "Bewässerungsprogramm: Gate 2 erreicht.")

        //pruefen ob richtiger Wochentag
        if(bew_timer_day.state == ON) {

          logInfo("Gardena", "Bewässerungsprogramm: Gate 3 erreicht.")
          logInfo("Gardena", "Starte Bewässerungsprogramm.")

          if(bew_leitung1.state == ON) {
            var dauer_str = bew_dauer_zeit_1.state.toString
            var Long dauer1 = Long.parseLong(dauer_str)
            var dauer_sek1 = dauer1 * 1000 * 60
            //logInfo("Gardena", "Sekunden: " + dauer_sek1)

            //sendBroadcastNotification("Gardena: Leitung 1 geöffnet.")
            createTimer(now.plusMinutes(dauer1), [|
              //sendBroadcastNotification("Gardena: Leitung 1 geschlossen.")
          if(bew_leitung2.state == ON) {
            var dauer_str = bew_dauer_zeit_2.state.toString
            var Long dauer2 = Long.parseLong(dauer_str)
            var dauer_sek2 = dauer1 * 1000 * 60

            //sendBroadcastNotification("Gardena: Leitung 2 geöffnet.")
            createTimer(now.plusMinutes(dauer2), [|
              //sendBroadcastNotification("Gardena: Leitung 2 geschlossen.")
          if(bew_leitung3.state == ON) {
            var dauer_str = bew_dauer_zeit_3.state.toString
            var Long dauer3 = Long.parseLong(dauer_str)
            var dauer_sek3 = dauer1 * 1000 * 60

            //sendBroadcastNotification("Gardena: Leitung 3 geöffnet.")
            createTimer(now.plusMinutes(dauer3), [|
              //sendBroadcastNotification("Gardena: Leitung 3 geschlossen.")
          if(bew_leitung4.state == ON) {
            var dauer_str = bew_dauer_zeit_4.state.toString
            var Long dauer4 = Long.parseLong(dauer_str)
            var dauer_sek4 = dauer1 * 1000 * 60

            //sendBroadcastNotification("Gardena: Leitung 4 geöffnet.")
            createTimer(now.plusMinutes(dauer4), [|
              //sendBroadcastNotification("Gardena: Leitung 4 geschlossen.")
          if(bew_leitung5.state == ON) {
            var dauer_str = bew_dauer_zeit_5.state.toString
            var Long dauer5 = Long.parseLong(dauer_str)
            var dauer_sek5 = dauer1 * 1000 * 60

            //sendBroadcastNotification("Gardena: Leitung 5 geöffnet.")
            createTimer(now.plusMinutes(dauer5), [|
              //sendBroadcastNotification("Gardena: Leitung 5 geschlossen.")
          if(bew_leitung6.state == ON) {
            var dauer_str = bew_dauer_zeit_6.state.toString
            var Long dauer6 = Long.parseLong(dauer_str)
            var dauer_sek6 = dauer1 * 1000 * 60

            //sendBroadcastNotification("Gardena: Leitung 6 geöffnet.")
            createTimer(now.plusMinutes(dauer6), [|
              //sendBroadcastNotification("Gardena: Leitung 6 geschlossen.")
          logInfo("Gardena", "Bewässerungsprogramm beendet.")