Folgenden Code nutze ich um 2 Lichteten im Aquarium zu schalten
define Aq_Tageslicht DOIF (([10:00-14:00] or [17:00-21:00]) and ([AQ_LichtAuto] eq "on")) (set HM_AqLicht_Tag on) DOELSEIF (([14:00:01-16:59:59] or [21:00:01-09:59:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag off)
attr Aq_Tageslicht do always
define Aq_Mondlicht DOIF (([09:00-10:01] or [20:59-22:00]) and ([AQ_LichtAuto] eq "on")) (set HM_AqLicht_Mond on) DOELSEIF (([10:01:01-20:58:59] or [22:00:01-08:59:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
attr Aq_Mondlicht do always
Heute wurde das Mondlicht nicht ausgeschalten und im Logfile stand:
2016.03.24 22:00:00 3: CUL_HM set HM_AqLicht_Mond on
2016.03.24 21:00:01 3: CUL_HM set HM_AqLicht_Tag off
2016.03.24 20:59:00 3: CUL_HM set HM_AqLicht_Mond on
2016.03.24 17:00:00 3: CUL_HM set HM_AqLicht_Tag on
2016.03.24 14:00:01 3: CUL_HM set HM_AqLicht_Tag off
2016.03.24 10:01:01 3: CUL_HM set HM_AqLicht_Mond off
2016.03.24 10:00:00 3: CUL_HM set HM_AqLicht_Tag on
2016.03.24 09:00:00 3: CUL_HM set HM_AqLicht_Mond on
Um 22:00 hätte aber ein CUL_HM set HM_AqLicht_Mond off kommen müssen , leider kam ein on und so blieb das Licht natürlich an :-(
Teilweise funktioniert das ganze Tagelang ( dachte es wäre gelöst ) und dann kommt es immer wieder zu falschen Ein bzw. -Ausschaltbefehlen
Warum nutzt du Zeiträume zum Ein- bzw. Ausschalten? Fixe Zeiten reichen doch.
Oder du schaltest das Licht für einen gewissen Zeitraum ein (und den DOELSE-Zweig ohne Bedingungen/Trigger zum Ausschalten)
So hast du beides gemischt.
Zitat22:00 hätte aber ein CUL_HM set HM_AqLicht_Mond off kommen müssen
DOIF (([09:00-10:01] or [20:59-22:00]) and ([AQ_LichtAuto] eq "on")) (set HM_AqLicht_Mond on)
Wenn dann um 22:00:01, aber falls das System mal etwas länger braucht, kann eine Sekunde knapp sein.
Lösung? Versuch mal das oben geschriebene!
@Per,
erstmal Danke ! Ja Natürlich 22:00:01 :-) da hab ich mich vertippt ...
Ja genauso wie du es beschrieben hast , hatte ich es schonmal und hab es dann nach Empfehlung hier aus dem Board geändert.
https://forum.fhem.de/index.php/topic,47731.msg394352.html#msg394352 (https://forum.fhem.de/index.php/topic,47731.msg394352.html#msg394352)
Warum hast du dann einen neuen Thread eröffnet?
Kann es sein, dass du ein ganz anderes Problem hast? Bei mir werden z.B. Befehle verschluckt, wenn das Internet weg ist und das Mail-Modul alles blockiert :(
Nein, es wird nichts verschluckt !
Im Log-File sieht man ja das ein Befehl gesensendet bzw ausgeführt wird -- blöderweise aber der Falsche ;-)
Wo das Problem liegt, kann ich mir wirklich nicht vorstellen. Zumal ja 22:00:00 Mond = an noch richtig ist. Dir fehlt also "nur" der Befehl von 22:00:01.
Aber ich:
a: würde alles in ein DOIF packen
und
b: mit wait 0:3 und (set HM_AqLicht_Tag on) (set HM_AqLicht_Mond:FILTER=STATE!=off off) auf Nummer sicher gehen, bis der Fehler gefunden ist.
Zitat von: Aladin222 am 26 März 2016, 07:06:22
Nein, es wird nichts verschluckt !
Im Log-File sieht man ja das ein Befehl gesensendet bzw ausgeführt wird -- blöderweise aber der Falsche ;-)
Hast du die aktuell Version von DOIF vom 03.03? Ansonsten Ausgabe von "list Aq_Mondlicht", wenn es nicht geschaltet hat hier posten.
Gruß
Damian
Sorry , Per , das hab ich nicht gerafft :-(
Also mit wait und State ....
@damian ,
Jo , bin aktuell - blöd nur das der Fehler nicht Regelmäßig kommt !
Beim nächsten mal poste ich das List ...
Vielen Dank für eure Mühe
Snief, es war wieder soweit, diesmal hat das Mondlicht nicht ausgeschaltet:
Internals:
CFGFN /opt/fhem/FHEM/10_AqBeleuchtung.cfg
DEF (([09:00-10:01] or [20:59-22:00]) and ([AQ_LichtAuto] eq "on")) (set HM_AqLicht_Mond on) DOELSEIF (([10:01:05-20:58:55] or [22:00:05-08:59:55]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
NAME Aq_Mondlicht
NR 243
NTFY_ORDER 50-Aq_Mondlicht
STATE cmd_1
TYPE DOIF
Readings:
2016-03-28 22:26:42 Device AQ_LichtAuto
2016-03-29 20:59:00 cmd_event timer_3
2016-03-29 20:59:00 cmd_nr 1
2016-03-28 22:26:42 e_AQ_LichtAuto_STATE on
2016-03-29 20:59:00 state cmd_1
2016-03-29 10:01:00 timer_1_c1 30.03.2016 09:00:00
2016-03-29 10:01:00 timer_2_c1 30.03.2016 10:01:00
2016-03-29 22:00:00 timer_3_c1 30.03.2016 20:59:00
2016-03-29 22:00:00 timer_4_c1 30.03.2016 22:00:00
2016-03-29 20:58:55 timer_5_c2 30.03.2016 10:01:05
2016-03-29 20:58:55 timer_6_c2 30.03.2016 20:58:55
2016-03-29 08:59:55 timer_7_c2 29.03.2016 22:00:05
2016-03-29 08:59:55 timer_8_c2 30.03.2016 08:59:55
Condition:
0 (DOIF_time($hash,$hash->{realtime}{0},$hash->{realtime}{1},$wday,$hms,"") or DOIF_time($hash,$hash->{realtime}{2},$hash->{realtime}{3},$wday,$hms,"")) and (InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on")
1 (DOIF_time($hash,$hash->{realtime}{4},$hash->{realtime}{5},$wday,$hms,"") or DOIF_time($hash,$hash->{realtime}{6},$hash->{realtime}{7},$wday,$hms,"")) and InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
Days:
Devices:
0 AQ_LichtAuto
1 AQ_LichtAuto
all AQ_LichtAuto
Do:
0:
0 set HM_AqLicht_Mond on
1:
0 set HM_AqLicht_Mond off
2:
Helper:
event timer_7
globalinit 1
last_timer 8
sleeptimer -1
timerdev
timerevent timer_3
triggerDev
timerevents:
timer_3
triggerEvents:
timer_7
Internals:
0 AQ_LichtAuto:STATE
1 AQ_LichtAuto:STATE
all AQ_LichtAuto:STATE
Interval:
0 -1
1 0
2 -1
3 2
4 -1
5 4
6 -1
7 6
Itimer:
Localtime:
0 1459321200
1 1459324860
2 1459364340
3 1459368000
4 1459324865
5 1459364335
6 1459281605
7 1459321195
Readings:
Realtime:
0 09:00:00
1 10:01:00
2 20:59:00
3 22:00:00
4 10:01:05
5 20:58:55
6 22:00:05
7 08:59:55
Regexp:
0:
1:
All:
State:
Time:
0 09:00:00
1 10:01:00
2 20:59:00
3 22:00:00
4 10:01:05
5 20:58:55
6 22:00:05
7 08:59:55
Timecond:
0 0
1 0
2 0
3 0
4 1
5 1
6 1
7 1
Timer:
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
Timers:
0 0 1 2 3
1 4 5 6 7
Trigger:
Triggertime:
1459321195:
localtime 1459321195
Hash:
1459321200:
localtime 1459321200
Hash:
1459324860:
localtime 1459324860
Hash:
1459324865:
localtime 1459324865
Hash:
1459364335:
localtime 1459364335
Hash:
1459364340:
localtime 1459364340
Hash:
1459368000:
localtime 1459368000
Hash:
Attributes:
do always
Hatte die Zeiten wie geraten auch etwas angepasst ,leider auch ohne Erfolg :
OK, Schwein und Uhrwerk und so, da muss der Chef selbst ran :D
Noch einen Tipp: Wenn ich in solchen Konstrukten Fehler suche, packe ich die einzelnen, oder-verknüpften Bedingungen in einzelne DO(ELSE)IF-Zeilen. Dann ist das List zwar länger, aber die Rückmeldung leichter zuordenbar. Zumindest für mich.
Hat sich beim DOIF mal wieder was geändert und ich habs nicht mitbekommen?
Bei diesem DOIF einen Zeitbereich, also:
[10:00 - 14:00]
anzugeben, wenn man dann keinen DOELSE Fall hat, macht doch eigentlich keinen Sinn. Einen Zeitbereich für 'an' und einen Zeitbereich für 'aus' ist doch genau so unsinnig.
Entweder einen Zeitbereich für 'an', mit DOELSE für 'aus':
define Aq_Tageslicht DOIF (([10:00-14:00] or [17:00-21:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag on) DOELSE (set HM_AqLicht_Tag off)
oder aber eine Zeit für 'an' und ein DOELSEIF mit einer Zeit für 'aus':
define Aq_Tageslicht DOIF (([10:00] or [17:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag on)
DOELSEIF (([14:00] or [21:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag off)
Gruß
Ingo
Anhand des list-Outputs kann ich leider nicht erkennen, ob um 22:00 Uhr getriggert wurde (was ich allerdings annehmen). Ich vermute, dass die zweite Bedingung um 22:00 Uhr (warum auch immer) nicht wahr war.
Unabhängig davon würde ich den Vorschlag von automatisierer befürworten.
Gruß
Damian
Hi ,
ich habe es so wie oben geschrieben abgeändert :
define Aq_Tageslicht DOIF (([10:00] or [17:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag on) DOELSEIF (([14:00] or [21:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag off)
attr Aq_Tageslicht do always
define Aq_Mondlicht DOIF (([9:00] or [20:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond on) DOELSEIF (([10:01] or [22:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
attr Aq_Mondlicht do always
Aber wenn ich nun list AqMondlicht eingebe ,sind noch die alten Timer gesetzt - wie kann ich die denn löschen ?
Internals:
CFGFN /opt/fhem/FHEM/10_AqBeleuchtung.cfg
DEF (([9:00] or [20:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond on) DOELSEIF (([10:01] or [22:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
NAME Aq_Mondlicht
NR 232
NTFY_ORDER 50-Aq_Mondlicht
STATE cmd_2
TYPE DOIF
Readings:
2016-04-09 01:35:07 Device AQ_LichtAuto
2016-04-10 22:00:00 cmd_event timer_4
2016-04-10 22:00:00 cmd_nr 2
2016-04-09 01:35:07 e_AQ_LichtAuto_STATE on
2016-04-10 22:00:00 state cmd_2
2016-04-10 09:00:00 timer_1_c1 11.04.2016 09:00:00
2016-04-10 20:59:00 timer_2_c1 11.04.2016 20:59:00
2016-04-09 00:09:37 timer_3_c1 09.04.2016 20:59:00
2016-04-10 10:01:00 timer_3_c2 11.04.2016 10:01:00
2016-04-09 00:09:37 timer_4_c1 09.04.2016 22:00:00
2016-04-10 22:00:00 timer_4_c2 11.04.2016 22:00:00
2016-04-09 00:09:37 timer_5_c2 09.04.2016 10:01:05
2016-04-09 00:09:37 timer_6_c2 09.04.2016 20:58:55
2016-04-09 00:09:37 timer_7_c2 09.04.2016 22:00:05
2016-04-09 00:09:37 timer_8_c2 09.04.2016 08:59:55
Condition:
0 (DOIF_time_once($hash,$hash->{timer}{0},$wday,"") or DOIF_time_once($hash,$hash->{timer}{1},$wday,"")) and InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
1 (DOIF_time_once($hash,$hash->{timer}{2},$wday,"") or DOIF_time_once($hash,$hash->{timer}{3},$wday,"")) and InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
Days:
Devices:
0 AQ_LichtAuto
1 AQ_LichtAuto
all AQ_LichtAuto
Do:
0:
0 set HM_AqLicht_Mond on
1:
0 set HM_AqLicht_Mond off
Helper:
event timer_4
globalinit 1
last_timer 4
sleeptimer -1
timerdev
timerevent timer_4
triggerDev
timerevents:
timer_4
triggerEvents:
timer_4
Internals:
0 AQ_LichtAuto:STATE
1 AQ_LichtAuto:STATE
all AQ_LichtAuto:STATE
Interval:
Itimer:
Localtime:
0 1460358000
1 1460401140
2 1460361660
3 1460404800
Readings:
Realtime:
0 09:00:00
1 20:59:00
2 10:01:00
3 22:00:00
Regexp:
All:
State:
Time:
0 9:00
1 20:59:00
2 10:01:00
3 22:00:00
Timecond:
0 0
1 0
2 1
3 1
Timer:
0 0
1 0
2 0
3 0
Timers:
0 0 1
1 2 3
Triggertime:
1460358000:
localtime 1460358000
Hash:
1460361660:
localtime 1460361660
Hash:
1460401140:
localtime 1460401140
Hash:
1460404800:
localtime 1460404800
Hash:
Attributes:
do always
Zitat von: Aladin222 am 11 April 2016, 05:18:35
Hi ,
ich habe es so wie oben geschrieben abgeändert :
define Aq_Tageslicht DOIF (([10:00] or [17:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag on) DOELSEIF (([14:00] or [21:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Tag off)
attr Aq_Tageslicht do always
define Aq_Mondlicht DOIF (([9:00] or [20:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond on) DOELSEIF (([10:01] or [22:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
attr Aq_Mondlicht do always
Aber wenn ich nun list AqMondlicht eingebe ,sind noch die alten Timer gesetzt - wie kann ich die denn löschen ?
Internals:
CFGFN /opt/fhem/FHEM/10_AqBeleuchtung.cfg
DEF (([9:00] or [20:59]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond on) DOELSEIF (([10:01] or [22:00]) and [AQ_LichtAuto] eq "on") (set HM_AqLicht_Mond off)
NAME Aq_Mondlicht
NR 232
NTFY_ORDER 50-Aq_Mondlicht
STATE cmd_2
TYPE DOIF
Readings:
2016-04-09 01:35:07 Device AQ_LichtAuto
2016-04-10 22:00:00 cmd_event timer_4
2016-04-10 22:00:00 cmd_nr 2
2016-04-09 01:35:07 e_AQ_LichtAuto_STATE on
2016-04-10 22:00:00 state cmd_2
2016-04-10 09:00:00 timer_1_c1 11.04.2016 09:00:00
2016-04-10 20:59:00 timer_2_c1 11.04.2016 20:59:00
2016-04-09 00:09:37 timer_3_c1 09.04.2016 20:59:00
2016-04-10 10:01:00 timer_3_c2 11.04.2016 10:01:00
2016-04-09 00:09:37 timer_4_c1 09.04.2016 22:00:00
2016-04-10 22:00:00 timer_4_c2 11.04.2016 22:00:00
2016-04-09 00:09:37 timer_5_c2 09.04.2016 10:01:05
2016-04-09 00:09:37 timer_6_c2 09.04.2016 20:58:55
2016-04-09 00:09:37 timer_7_c2 09.04.2016 22:00:05
2016-04-09 00:09:37 timer_8_c2 09.04.2016 08:59:55
Condition:
0 (DOIF_time_once($hash,$hash->{timer}{0},$wday,"") or DOIF_time_once($hash,$hash->{timer}{1},$wday,"")) and InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
1 (DOIF_time_once($hash,$hash->{timer}{2},$wday,"") or DOIF_time_once($hash,$hash->{timer}{3},$wday,"")) and InternalDoIf($hash,'AQ_LichtAuto','STATE','','',AttrVal($hash->{NAME},'notexist',undef)) eq "on"
Days:
Devices:
0 AQ_LichtAuto
1 AQ_LichtAuto
all AQ_LichtAuto
Do:
0:
0 set HM_AqLicht_Mond on
1:
0 set HM_AqLicht_Mond off
Helper:
event timer_4
globalinit 1
last_timer 4
sleeptimer -1
timerdev
timerevent timer_4
triggerDev
timerevents:
timer_4
triggerEvents:
timer_4
Internals:
0 AQ_LichtAuto:STATE
1 AQ_LichtAuto:STATE
all AQ_LichtAuto:STATE
Interval:
Itimer:
Localtime:
0 1460358000
1 1460401140
2 1460361660
3 1460404800
Readings:
Realtime:
0 09:00:00
1 20:59:00
2 10:01:00
3 22:00:00
Regexp:
All:
State:
Time:
0 9:00
1 20:59:00
2 10:01:00
3 22:00:00
Timecond:
0 0
1 0
2 1
3 1
Timer:
0 0
1 0
2 0
3 0
Timers:
0 0 1
1 2 3
Triggertime:
1460358000:
localtime 1460358000
Hash:
1460361660:
localtime 1460361660
Hash:
1460401140:
localtime 1460401140
Hash:
1460404800:
localtime 1460404800
Hash:
Attributes:
do always
Sie wurden offenbar nicht korrekt gelöscht. Das muss ich mir in Ruhe mal anschauen. Hast du die Änderungen über die Weboberfläche vorgenommen?
*schäm ,
Nein ,ich habe direkt in der Config geändert :-(
Ist das ein absolutes no go ?
Gruß
Zitat von: Aladin222 am 11 April 2016, 14:49:30
*schäm ,
Nein ,ich habe direkt in der Config geändert :-(
Ist das ein absolutes no go ?
Gruß
Nein, aber in dem Fall werden die Readings nicht gelöscht. Wenn du über die Weboberfläche auf DEF klickst und dann auf modify ..., dann werden alle Readings gelöscht und sauber neu aufgesetzt.
Der Vorteil ist zusätzlich, dass ein Syntaxcheck erfolgt, der dich im Vorfeld auf Fehler hinweist.
Gruß
Damian
Hallo zusammen,
ist zwar keine "echte" DOIF-Lösung, aber in der Annahme, dass es Homematic-Devices sind, die geschaltet werden sollen: Wie wäre es mit einem simplen "on-for-timer 6000"?