>D 40 IP=192.168.178.177 SB=2560:1535 ; time array für 10 Timer (je 3 elemente) ; Anzahl Timer mal 3 hier einsetzen, kann man hier vergrößern M:ts=0 30 M:ta=0 30 res=0 cnt=0 tag=0 from=0 to=0 pw=0 wcnt=0 enable=1 tdis=0 lpw=0 rtim=0 tmp=0 hr=0 min=0 once=0 >B ; Wochentage res=is(0 "So|Mo|Di|Mi|Do|Fr|Sa|") ; Monate res=is1(0 "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Okt|Nov|Dez") ; Timer Tabelle, bis N Einträge (siehe oben) ; von, bis, Tag, beliebig erweiterbar (Tag 1 = Sonntag) ; 10 = alle Tage ; 11 = Woche ; 12 = Wochenende ; -1 = Sonnenaufgang ;- 2 = Sonnenuntergang ; Zufallszeit in rtim rtim=0 ; Sonntag ts[1]=17.30 ts[2]=19.50 ts[3]=1 ts[4]=12.30 ts[5]=14.10 ts[6]=2 ts[7]=11.57 ts[8]=19.50 ts[9]=3 ts[10]=14.30 ts[11]=20.20 ts[12]=4 ts[13]=12.30 ts[14]=19.50 ts[15]=5 ts[16]=17.30 ts[17]=19.50 ts[18]=6 ; Samstag ts[19]=13.30 ts[20]=16.45 ts[21]=7 ts[22]=6.47 ts[23]=18.30 ts[24]=10 ts[25]=-1 ts[26]=-2 ts[27]=11 ts[28]=-1 ts[29]=-2 ts[30]=12 ; Random Init rnd(-10) =#copytime #copytime ; array kopieren und umrechnen for cnt 1 ts[-1] 3 tag=ts[cnt+2] from=int(ts[cnt])*60+(ts[cnt]*100%100) to=int(ts[cnt+1])*60+(ts[cnt+1]*100%100) if from==-60 then from=sunrise endif if to==-120 then to=sunset endif ; Zufallszeit einberechnen if rtim>0 then from+=rnd(rtim)-(rtim/2) to+=rnd(rtim)-(rtim/2) endif ta[cnt]=from ta[cnt+1]=to ta[cnt+2]=tag next ; subroutine für Timer Tabelle #wsub ; nur in webmode 0 (Tabelle in der auch die Sensoren erscheinen) if wm==0 then ; Uhrzeit, Wochentag und Datum anzeigen wcs {s}

%2.0hours%:%2.0mins%:%2.0secs%

{m}%is[wday]% %0day%-%is1[month]%
%0year%{e} wcs {s}
Timerliste:
{e} ; timerliste anzeigen for wcnt 1 ta[-1] 3 wcs {s}%0(wcnt/3+1)% : tmp=ta[wcnt+2] if tmp>=10 then switch tmp case 10 wcs täglich case 11 wcs Mo-Fr case 12 wcs Sa/So ends else wcs %is[tmp]% endif wcs => %2.0(int(ta[wcnt]/60))%:%2.0(ta[wcnt]%60)% - %2.0(int(ta[wcnt+1]/60))%:%2.0(ta[wcnt+1]%60)% if ta[wcnt+2]==wday then wcs => heute{e} else wcs {e} endif next wcs {s}
{e} endif >P ; hier kommt er nur hin wenn power über webui oder mqtt ; geschaltet wurde ; verhindere timer bis nächstem Umschaltpunkt tdis=1 >S if once==0 and tinit>0 then =#copytime once=1 endif ;jede Minute min=mins if chg[min]>0 then ; testen ob ein Timer Übereinstimmung zeigt pw=0 for cnt 1 ta[-1] 3 tag=ta[cnt+2] from=ta[cnt] to=ta[cnt+1] ;print %tag% %from% %to% if ((tag==wday) or (tag==10) or ((tag==11) and (wday>1) and (wday<7)) or ((tag==12) and ((wday==1) or (wday==7)))) then ;print >>> %tag% %from% %to% if time>=from and time0 then ; temporäre Sperrung abschalten tdis=0 endif ; Power setzen if pwr[1]!=pw and enable>0 and tdis==0 then =>power1 %pw% endif ; um Mitternacht Zeiten neu anpassen hr=hours if chg[hr]>0 and hr==0 then =#copytime endif endif >W ; checkbox @ck(enable "Timer aktiviert ") ; trennlinie @
; subroutine zur Erzeugung der Tabelle %=#wsub