>D 40 ; dieses Timer Script ist für ein Relais ausgelegt (power1) ; und passt in den Standard script Speicher wenn nicht gar zu viele ; timer definiert werden ;IP=192.168.178.177 IP=192.168.178.49 SB=2560:1535 ; time array für 20 Timer (je 3 elemente) ; Anzahl Timer mal 3 hier einsetzen, kann man hier vergrößern ; maximal 120 = 40 Timer M:tx=0 60 M:ta=0 60 res=0 cnt=0 tag=0 from=0 to=0 pw=0 lpw=0 p:enable=0 tdis=0 tmp=0 hr=0 min=0 once=0 ps="" >B ; Timer Tabelle Einträge getrennt mit Doppelpunkt ; von, bis, ; 4 stellige Zeit oder ; -1 = Sonnenaufgang ; - 2 = Sonnenuntergang ; Tag, (Tag 1 = Sonntag) oder ; 10 = täglich ; 11 = Woche Mo-Fr ; 12 = Wochenende Sa/So ; Zufallszeit in Minuten =#ts("0844:2130:1:0") =#ts("1430:1630:2:0") =#ts("-1:-2:3:0") =#ts("1430:1430:4:0") =#ts("1630:1630:4:0") ; Random Init rnd(-10) ; Zeiten übertragen =#copytime ; Monate res=is1(0 "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Okt|Nov|Dez|") ; Wochentage res=is(0 "So|Mo|Di|Mi|Do|Fr|Sa|") ; array aus string setzten #ts(ps) ; from tmp=st(ps : 1) from=int(tmp/100)*60+(tmp%100) ; to tmp=st(ps : 2) to=int(tmp/100)*60+(tmp%100) ; day + random time tmp=st(ps : 3) cnt=st(ps : 4) tag=tmp+(cnt/100) ; in array schreiben tx=from tx=to tx=tag #copytime ; array kopieren und umrechnen for cnt 1 tx[-1] 3 tag=tx[cnt+2] from=tx[cnt] to=tx[cnt+1] if from==-61 { from=sunrise } if from==-62 { from=sunset } if to==-61 { to=sunrise } if to==-62 { to=sunset } ; Zufallszeit einberechnen tmp=tag*100%100 if tmp>0 then from+=rnd(tmp)-(tmp/2) to+=rnd(tmp)-(tmp/2) endif ta[cnt]=from ta[cnt+1]=to ta[cnt+2]=int(tag) next ; subroutine für HTML 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 cnt 1 ta[-1] 3 tag=ta[cnt+2]&15 if tag>0 then wcs {s}%0(cnt/3+1)% : if tag>=10 then switch tag case 10 wcs täglich case 11 wcs Mo-Fr case 12 wcs Sa/So ends else wcs %is[tag]% endif wcs => %2.0(int(ta[cnt]/60))%:%2.0(ta[cnt]%60)% - %2.0(int(ta[cnt+1]/60))%:%2.0(ta[cnt+1]%60)% if tag==wday then wcs => heute{e} else wcs {e} endif 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 if chg[enable]>0{ svars } >W ; checkbox @ck(enable "Timer aktiviert ") ; trennlinie @
; subroutine zur Erzeugung der Tabelle %=#wsub