Hallo,
ich habe ein Problem mit meinem DOIF. In diesem Konstrukt klappt die Abschaltzeit nicht. Im Moment bin ich in der Testphase, deshalb sind Monat und Tag auf Anfang Nov. gestellt.
Später soll das ab 25.12 laufen, dass heißt: Tag wird auf 25 und Monat auf 12 gesetzt.
Aber da ist noch ein Fehler drin:
Gestern war Samstag, und ich hatte erwartet, dass um 23:00 dieses DOELSIF greift:
DOELSEIF
([switch.di.02.rp.01.EG.ku.SD.dum] eq "on")
(set rp.02.EG.ku.SD.Kochinsel off)
Aber leider blieb der Aktor an.
Das Dummy-Device "switch.di.02.rp.01.EG.ku.SD.dum" ist ein Softswitch, der nichts weiter machen soll, als den ersten Teil des DOIFs zu aktivieren, wenn "Advent" (Advent==1), das Datum erreicht wird und der Softswitch auf "on" steht.
Der Aktor soll dann abgeschaltet werden, wenn die jeweilige Schaltzeit erreicht wird (22:00, 23:00, 02:00).
Diese "Automatik" deaktiviert man, indem der Softswitch auf "off" steht. Dann hat der Aktor "Dauersaft" und es greift dieses DOELSEIF.
DOELSEIF
([switch.di.02.rp.01.EG.ku.SD.dum] eq "off")
(set rp.02.EG.ku.SD.Kochinsel on)
[/code]
Kann jemand helfen? Warum greift die Abschaltzeit nicht?
Christian.
Hier noch der komplette CODE:
(((([07:00-08:00|12345] and [?hl.01.Feiertag] eq "none" or
[16:30-22:00|12345] and ([?hl.01.Feiertag] eq "none" and ![?state.NRW.Ferien.dum]) or
[08:30-23:00] and [?state.NRW.Ferien.dum] or
[08:30-23:00] and [?hl.01.Feiertag] ne "none" or
[08:30-23:00|60]) and Advent==1 and $mday>=1 and $month==11) or
[16:15-23:00] and [?hl.01.Feiertag] eq "Heiligabend" or
[08:30-02:00] and [?hl.01.Feiertag] eq "Silvester")and [switch.di.02.rp.01.EG.ku.SD.dum] eq "on")
(set rp.02.EG.ku.SD.Kochinsel on)
DOELSEIF
([switch.di.02.rp.01.EG.ku.SD.dum] eq "on")
(set rp.02.EG.ku.SD.Kochinsel off)
DOELSEIF
([switch.di.02.rp.01.EG.ku.SD.dum] eq "off")
(set rp.02.EG.ku.SD.Kochinsel on)
Was meinst Du damit? and Advent==1
Zitat von: Ellert am 27 November 2016, 12:57:53
Was meinst Du damit? and Advent==1
sicherlicher die sub Advent
https://forum.fhem.de/index.php?topic=42209.0 (https://forum.fhem.de/index.php?topic=42209.0)
Hallo,
ja genau Advent ist eine SUB zur Bestimmung der Advendszeit. Die Funktion ist auch ok. Habe ich mehrfach getestet.
Ich werde mein DOIF mal abspecken und es mit einem Dummy Aktor testen...
Christian
Hallo,
so, ich habe das Konstrukt mal abgespeckt, aber es läuft nicht!
((([07:00-08:00|12345] or
[16:50-16:52|60]) and Advent==1 and $mday>=1 and $month==11 ) and [automatik] eq "on")
(set Lampe on)
DOELSEIF
([automatik] eq "on")
(set Lampe off)
DOELSEIF
([automatik] eq "off")
(set Lampe on)
Offenbar mache ich einen Gedankenfehler. Die Ausschaltzeit darf offenbar nicht im ersten TEil der DOIFs stehen, sondern muss im ersten DOELSEIF -Zweig stehen, oder?
Danke,
Christian
Hallo,
habe es noch weiter abgespeckt, aber ich kriege es nicht hin. Wo liegt mein Fehler?
([19:33-19:34] and [?automatik] eq "on")
(set Lampe on)
DOELSEIF
([automatik] eq "off")
(set Lampe on)
DOELSE
(set Lampe off)
Das Dummy-Device Automatik soll bei automatik eq "on" die Lampe nach dem Zeitplan ansteuern.
Bei automatik eq "off" soll die Lampe immer leuchten!
Hier passiert jetzt Folgendes:
Das DOIF funzt, wenn Automatik auf "on" steht, so wie es soll.
Schalte ich Automatik auf "off", wird cmd 2 ignoriert und es greift cmd3. Und das ist falsch!
Die Aufgabe hört sich einfach an, ist aber offenbar zu kompliziert für mich!
Hat niemand einen Tipp für mich?
Christian
Bau den 2. Zweig mit or in den 1. Zweig ein.
Hallo Ellert,
danke für den Tipp, das sieht ganz gut aus, allerdings soll mir das DOIF drei Zustände anzeigen.
Automatik ein: Zeitschaltung ein (cmd1, grün)
Automatik ein: Zeitschaltung aus (cmd2, rot)
Automatik aus: Zeitschaltung deaktiv (cmd 3, grau).
Da muss ich noch mal gucken, wie das gehen könnte..
Christian
Hallo,
ich habe nur diese Lösung für meine Anwendung gefunden. Einschalt- und Ausschaltzeit muss ich wohl in einen DOIF und DOIFELSE-Zweig aufsplitten. Anders kriege ich das nicht hin, wenn ich die o.a. Stati (Lampe im Zeitschaltbetrieb ein <grün>, Lampe im Zeitschaltbetrieb aus <rot>, Zeitschaltung deaktiv <grau>) visualisieren möchte:
Internals:
CFGFN
DEF ([14:08] and [?automatik] eq "on")
(set Lampe on)
DOELSEIF
(([14:09] and [?automatik] eq "on") or [automatik] eq "on")
(set Lampe off)
DOELSEIF
([automatik] eq "off")
(set Lampe on)
NAME Zeitschaltuhr
NR 3214
NTFY_ORDER 50-Zeitschaltuht
STATE deaktiv
TYPE DOIF
Readings:
2016-11-28 14:07:24 Device automatik
2016-11-28 14:07:24 cmd 3
2016-11-28 14:07:24 cmd_event automatik
2016-11-28 14:07:24 cmd_nr 3
2016-11-28 14:07:24 e_automatik_STATE off
2016-11-28 14:07:24 state deaktiv
2016-11-28 14:08:00 timer_1_c1 29.11.2016 14:08:00
2016-11-28 14:09:00 timer_2_c2 29.11.2016 14:09:00
Condition:
0 DOIF_time_once($hash,$hash->{timer}{0},$wday,"") and InternalDoIf($hash,'automatik','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
1 (DOIF_time_once($hash,$hash->{timer}{1},$wday,"") and InternalDoIf($hash,'automatik','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on") or InternalDoIf($hash,'automatik','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
2 InternalDoIf($hash,'automatik','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "off"
Days:
Devices:
1 automatik
2 automatik
all automatik
Do:
0:
0 set Lampe on
1:
0 set Lampe off
2:
0 set Lampe on
3:
Helper:
event timer_2
globalinit 1
last_timer 2
sleeptimer -1
timerdev automatik
timerevent off
triggerDev
timerevents:
off
timereventsState:
state: off
triggerEvents:
timer_2
triggerEventsState:
state: off
Internals:
0 automatik:STATE
1 automatik:STATE
2 automatik:STATE
all automatik:STATE
Interval:
Itimer:
Localtime:
0 1480424880
1 1480424940
Readings:
Realtime:
0 14:08:00
1 14:09:00
Regexp:
0:
1:
2:
All:
State:
Time:
0 14:08:00
1 14:09:00
Timecond:
0 0
1 1
Timer:
0 0
1 0
Timers:
0 0
1 1
Trigger:
Triggertime:
1480424880:
localtime 1480424880
Hash:
1480424940:
localtime 1480424940
Hash:
Attributes:
alias Zeitschaltuhr
cmdState on|off|deaktiv
devStateIcon .*on:light_wire_system_1@lightgreen .*deaktiv:light_wire_system_1@grey .*off:light_wire_system_1@red
group Scripte
icon scene_x-mas@green
room 99-Test
Bei diesem kurzen Testcode ist das auch kein Problem, allerdings sind die Bedingungen für den produktiven Betrieb etwas komplexer (siehe erster Post) und das DOIF wird ziemlich unübersichtlich...
Christian