Hallo liebe Foris,
ich habe folgendes DoIF definiert:Internals:
CFGFN
DEF ([myTwilight:twilight_weather] > 50 and [06:00-09:00|8]) (set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterbank on,{Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 80 and [06:25-09:00|8]) (set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 50 and [07:25-09:00|7]) (set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterban on, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 80 and [08:25-09:00|7]) (set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([6:00|8] or [7:00|7]) (set Rollo.Balkon pct 100, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] < 50 and [20:00-22:00]+int(rand(1800))) (set struc_Rollo pct 0, set FunkDose01,FunkDose03,FunkDose04 on, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([22:00]) (set Rollo.Balkon pct 0, set FunkDose01,FunkDose03,FunkDose04 off, {Log 3,"Events from device $DEVICE:$EVENTS"})
NAME DoIfRolloTest
NR 3111
NTFY_ORDER 50-DoIfRolloTest
STATE cmd_1
TYPE DOIF
Readings:
2016-03-23 10:38:40 Device myTwilight
2016-03-23 06:38:40 cmd_event myTwilight
2016-03-23 06:38:40 cmd_nr 1
2016-03-23 10:38:40 e_myTwilight_twilight_weather 100
2016-03-23 06:38:40 state cmd_1
2016-03-23 07:00:00 timer_10_c5 24.03.2016 07:00:00|7
2016-03-22 22:00:00 timer_11_c6 23.03.2016 20:00:00
2016-03-22 22:00:00 timer_12_c6 23.03.2016 22:00:00
2016-03-22 22:00:00 timer_13_c7 23.03.2016 22:00:00
2016-03-23 09:00:00 timer_1_c1 24.03.2016 06:00:00|8
2016-03-23 09:00:00 timer_2_c1 24.03.2016 09:00:00|8
2016-03-23 09:00:00 timer_3_c2 24.03.2016 06:25:00|8
2016-03-23 09:00:00 timer_4_c2 24.03.2016 09:00:00|8
2016-03-23 09:00:00 timer_5_c3 24.03.2016 07:25:00|7
2016-03-23 09:00:00 timer_6_c3 24.03.2016 09:00:00|7
2016-03-23 09:00:00 timer_7_c4 24.03.2016 08:25:00|7
2016-03-23 09:00:00 timer_8_c4 24.03.2016 09:00:00|7
2016-03-23 06:00:00 timer_9_c5 24.03.2016 06:00:00|8
Condition:
0 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 50 and DOIF_time($hash,$hash->{realtime}{0},$hash->{realtime}{1},$wday,$hms,"8")
1 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 80 and DOIF_time($hash,$hash->{realtime}{2},$hash->{realtime}{3},$wday,$hms,"8")
2 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 50 and DOIF_time($hash,$hash->{realtime}{4},$hash->{realtime}{5},$wday,$hms,"7")
3 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 80 and DOIF_time($hash,$hash->{realtime}{6},$hash->{realtime}{7},$wday,$hms,"7")
4 DOIF_time_once($hash,$hash->{timer}{8},$wday,"8") or DOIF_time_once($hash,$hash->{timer}{9},$wday,"7")
5 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) < 50 and DOIF_time($hash,$hash->{realtime}{10},$hash->{realtime}{11},$wday,$hms,"")+int(rand(1800))
6 DOIF_time_once($hash,$hash->{timer}{12},$wday,"")
Days:
0 8
1 8
2 8
3 8
4 7
5 7
6 7
7 7
8 8
9 7
Devices:
0 myTwilight
1 myTwilight
2 myTwilight
3 myTwilight
5 myTwilight
all myTwilight
Do:
0:
0 set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterbank on,{Log 3,"Events from device $DEVICE:$EVENTS"}
1:
0 set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"}
2:
0 set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterban on, {Log 3,"Events from device $DEVICE:$EVENTS"}
3:
0 set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"}
4:
0 set Rollo.Balkon pct 100, {Log 3,"Events from device $DEVICE:$EVENTS"}
5:
0 set struc_Rollo pct 0, set FunkDose01,FunkDose03,FunkDose04 on, {Log 3,"Events from device $DEVICE:$EVENTS"}
6:
0 set Rollo.Balkon pct 0, set FunkDose01,FunkDose03,FunkDose04 off, {Log 3,"Events from device $DEVICE:$EVENTS"}
7:
Helper:
event azimuth: 143.54
globalinit 1
last_timer 13
sleeptimer -1
timerdev myTwilight
timerevent azimuth: 118.07
triggerDev myTwilight
timerevents:
azimuth: 118.07
triggerEvents:
azimuth: 143.54
Internals:
Interval:
0 -1
1 0
10 -1
11 10
2 -1
3 2
4 -1
5 4
6 -1
7 6
Itimer:
Localtime:
0 1458795600
1 1458806400
10 1458759600
11 1458766800
12 1458766800
2 1458797100
3 1458806400
4 1458800700
5 1458806400
6 1458804300
7 1458806400
8 1458795600
9 1458799200
Readings:
0 myTwilight:twilight_weather
1 myTwilight:twilight_weather
2 myTwilight:twilight_weather
3 myTwilight:twilight_weather
5 myTwilight:twilight_weather
all myTwilight:twilight_weather
Realtime:
0 06:00:00
1 09:00:00
10 20:00:00
11 22:00:00
12 22:00:00
2 06:25:00
3 09:00:00
4 07:25:00
5 09:00:00
6 08:25:00
7 09:00:00
8 06:00:00
9 07:00:00
Regexp:
0:
1:
2:
3:
4:
5:
6:
All:
State:
Time:
0 06:00:00
1 09:00:00
10 20:00:00
11 22:00:00
12 22:00:00
2 06:25:00
3 09:00:00
4 07:25:00
5 09:00:00
6 08:25:00
7 09:00:00
8 6:00
9 7:00
Timecond:
0 0
1 0
10 5
11 5
12 6
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
Timer:
0 0
1 0
10 0
11 0
12 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
Timers:
0 0 1
1 2 3
2 4 5
3 6 7
4 8 9
5 10 11
6 12
Trigger:
Triggertime:
1458759600:
localtime 1458759600
Hash:
1458766800:
localtime 1458766800
Hash:
1458795600:
localtime 1458795600
Hash:
1458797100:
localtime 1458797100
Hash:
1458799200:
localtime 1458799200
Hash:
1458800700:
localtime 1458800700
Hash:
1458804300:
localtime 1458804300
Hash:
1458806400:
localtime 1458806400
Hash:
Attributes:
room Automatik
verbose 5
laut dem log wird wie folgt ausgelöst:
Line 30641: 2016.03.22 18:28:40.211 3: Events from device myTwilight:azimuth: 270.33
Line 37143: 2016.03.23 06:03:40.204 3: Events from device myTwilight:azimuth: 82.27
Line 37451: 2016.03.23 06:38:40.932 3: Events from device myTwilight:azimuth: 89.13
Belügt mich da das log, das dort plötzlich der azimuth drin steht, obwohl ich twilight_weather haben will?
Und wieso löst es um 18:28 aus? das ist doch weit weg vom Timer in
DOELSEIF ([myTwilight:twilight_weather] < 50 and [20:00-22:00]+int(rand(1800)))
*kopfkratz*
Wer kann mich erleuchten?
//bb
Zu deinem Fehler kann ich nix beitragen, aber:
wegen
([myTwilight:twilight_weather] > 50 and [06:00-09:00|8])
wird
([myTwilight:twilight_weather] > 80 and [06:25-09:00|8])
nie auslösen, weil der erste Teil immer schon wahr ist, wenn der zweite Teil wahr wird! Da müsstest du die Reihenfolge umdrehen.
Und was soll ([6:00|8] or [7:00|7]) bewirken? Falls es um 6 noch nicht > 50 ist, fahren die Rollos ganz hoch, zwischen 6 und 9 wieder halb runter, wenn es hell genug ist, sonst bleiben sie oben?
Zitat von: bloodybeginner am 23 März 2016, 10:50:20
Hallo liebe Foris,
ich habe folgendes DoIF definiert:Internals:
CFGFN
DEF ([myTwilight:twilight_weather] > 50 and [06:00-09:00|8]) (set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterbank on,{Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 80 and [06:25-09:00|8]) (set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 50 and [07:25-09:00|7]) (set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterban on, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] > 80 and [08:25-09:00|7]) (set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([6:00|8] or [7:00|7]) (set Rollo.Balkon pct 100, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([myTwilight:twilight_weather] < 50 and [20:00-22:00]+int(rand(1800))) (set struc_Rollo pct 0, set FunkDose01,FunkDose03,FunkDose04 on, {Log 3,"Events from device $DEVICE:$EVENTS"})
DOELSEIF ([22:00]) (set Rollo.Balkon pct 0, set FunkDose01,FunkDose03,FunkDose04 off, {Log 3,"Events from device $DEVICE:$EVENTS"})
NAME DoIfRolloTest
NR 3111
NTFY_ORDER 50-DoIfRolloTest
STATE cmd_1
TYPE DOIF
Readings:
2016-03-23 10:38:40 Device myTwilight
2016-03-23 06:38:40 cmd_event myTwilight
2016-03-23 06:38:40 cmd_nr 1
2016-03-23 10:38:40 e_myTwilight_twilight_weather 100
2016-03-23 06:38:40 state cmd_1
2016-03-23 07:00:00 timer_10_c5 24.03.2016 07:00:00|7
2016-03-22 22:00:00 timer_11_c6 23.03.2016 20:00:00
2016-03-22 22:00:00 timer_12_c6 23.03.2016 22:00:00
2016-03-22 22:00:00 timer_13_c7 23.03.2016 22:00:00
2016-03-23 09:00:00 timer_1_c1 24.03.2016 06:00:00|8
2016-03-23 09:00:00 timer_2_c1 24.03.2016 09:00:00|8
2016-03-23 09:00:00 timer_3_c2 24.03.2016 06:25:00|8
2016-03-23 09:00:00 timer_4_c2 24.03.2016 09:00:00|8
2016-03-23 09:00:00 timer_5_c3 24.03.2016 07:25:00|7
2016-03-23 09:00:00 timer_6_c3 24.03.2016 09:00:00|7
2016-03-23 09:00:00 timer_7_c4 24.03.2016 08:25:00|7
2016-03-23 09:00:00 timer_8_c4 24.03.2016 09:00:00|7
2016-03-23 06:00:00 timer_9_c5 24.03.2016 06:00:00|8
Condition:
0 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 50 and DOIF_time($hash,$hash->{realtime}{0},$hash->{realtime}{1},$wday,$hms,"8")
1 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 80 and DOIF_time($hash,$hash->{realtime}{2},$hash->{realtime}{3},$wday,$hms,"8")
2 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 50 and DOIF_time($hash,$hash->{realtime}{4},$hash->{realtime}{5},$wday,$hms,"7")
3 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) > 80 and DOIF_time($hash,$hash->{realtime}{6},$hash->{realtime}{7},$wday,$hms,"7")
4 DOIF_time_once($hash,$hash->{timer}{8},$wday,"8") or DOIF_time_once($hash,$hash->{timer}{9},$wday,"7")
5 ReadingValDoIf('myTwilight','twilight_weather','',AttrVal($hash->{NAME},'notexist',undef)) < 50 and DOIF_time($hash,$hash->{realtime}{10},$hash->{realtime}{11},$wday,$hms,"")+int(rand(1800))
6 DOIF_time_once($hash,$hash->{timer}{12},$wday,"")
Days:
0 8
1 8
2 8
3 8
4 7
5 7
6 7
7 7
8 8
9 7
Devices:
0 myTwilight
1 myTwilight
2 myTwilight
3 myTwilight
5 myTwilight
all myTwilight
Do:
0:
0 set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterbank on,{Log 3,"Events from device $DEVICE:$EVENTS"}
1:
0 set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"}
2:
0 set struc_Rollo pct 50, set struc_Licht.Wohnzimmer.Fensterban on, {Log 3,"Events from device $DEVICE:$EVENTS"}
3:
0 set struc_Rollo pct 100, set struc_Licht.Wohnzimmer.Fensterbank off, {Log 3,"Events from device $DEVICE:$EVENTS"}
4:
0 set Rollo.Balkon pct 100, {Log 3,"Events from device $DEVICE:$EVENTS"}
5:
0 set struc_Rollo pct 0, set FunkDose01,FunkDose03,FunkDose04 on, {Log 3,"Events from device $DEVICE:$EVENTS"}
6:
0 set Rollo.Balkon pct 0, set FunkDose01,FunkDose03,FunkDose04 off, {Log 3,"Events from device $DEVICE:$EVENTS"}
7:
Helper:
event azimuth: 143.54
globalinit 1
last_timer 13
sleeptimer -1
timerdev myTwilight
timerevent azimuth: 118.07
triggerDev myTwilight
timerevents:
azimuth: 118.07
triggerEvents:
azimuth: 143.54
Internals:
Interval:
0 -1
1 0
10 -1
11 10
2 -1
3 2
4 -1
5 4
6 -1
7 6
Itimer:
Localtime:
0 1458795600
1 1458806400
10 1458759600
11 1458766800
12 1458766800
2 1458797100
3 1458806400
4 1458800700
5 1458806400
6 1458804300
7 1458806400
8 1458795600
9 1458799200
Readings:
0 myTwilight:twilight_weather
1 myTwilight:twilight_weather
2 myTwilight:twilight_weather
3 myTwilight:twilight_weather
5 myTwilight:twilight_weather
all myTwilight:twilight_weather
Realtime:
0 06:00:00
1 09:00:00
10 20:00:00
11 22:00:00
12 22:00:00
2 06:25:00
3 09:00:00
4 07:25:00
5 09:00:00
6 08:25:00
7 09:00:00
8 06:00:00
9 07:00:00
Regexp:
0:
1:
2:
3:
4:
5:
6:
All:
State:
Time:
0 06:00:00
1 09:00:00
10 20:00:00
11 22:00:00
12 22:00:00
2 06:25:00
3 09:00:00
4 07:25:00
5 09:00:00
6 08:25:00
7 09:00:00
8 6:00
9 7:00
Timecond:
0 0
1 0
10 5
11 5
12 6
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
Timer:
0 0
1 0
10 0
11 0
12 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
Timers:
0 0 1
1 2 3
2 4 5
3 6 7
4 8 9
5 10 11
6 12
Trigger:
Triggertime:
1458759600:
localtime 1458759600
Hash:
1458766800:
localtime 1458766800
Hash:
1458795600:
localtime 1458795600
Hash:
1458797100:
localtime 1458797100
Hash:
1458799200:
localtime 1458799200
Hash:
1458800700:
localtime 1458800700
Hash:
1458804300:
localtime 1458804300
Hash:
1458806400:
localtime 1458806400
Hash:
Attributes:
room Automatik
verbose 5
laut dem log wird wie folgt ausgelöst:
Line 30641: 2016.03.22 18:28:40.211 3: Events from device myTwilight:azimuth: 270.33
Line 37143: 2016.03.23 06:03:40.204 3: Events from device myTwilight:azimuth: 82.27
Line 37451: 2016.03.23 06:38:40.932 3: Events from device myTwilight:azimuth: 89.13
Belügt mich da das log, das dort plötzlich der azimuth drin steht, obwohl ich twilight_weather haben will?
Und wieso löst es um 18:28 aus? das ist doch weit weg vom Timer in
DOELSEIF ([myTwilight:twilight_weather] < 50 and [20:00-22:00]+int(rand(1800)))
*kopfkratz*
Wer kann mich erleuchten?
//bb
Da Du nicht auf Ereignisse triggerst und DOIF die Eigenschaft hat bei einem Geräte-Ereignis alle im DOIF benutzten Readings zu triggern, muss das auslösende Ereignis nicht mit dem benutzten Reading übereinstimmen.
Die Befehlsreferenz sagt dazu:
ZitatGetriggert wird das Modul durch Zeitangaben bzw. durch Ereignisse ausgelöst durch die in der Bedingung angegebenen Devices.
, siehe auch hier: https://forum.fhem.de/index.php/topic,51117.0.html