Hallo zusammen,
irgendwie wollen meine DOIF für PH und Chlordosierung nicht so recht funktionieren.
PH dosiert immer um 18:00 und das auch wenn wert unter den 7.200 ist dafür um 18:15 nie...
Chlor daselbe hier um 18:45 und 19:15 immer dosieren und um 19:45 nie....
Hier mal die list:
Internals:
DEF ([18:00] or [18:30] and [PH_Sensor:pH] >7.200 and [Pool_Sonoff4CH:POWER1] eq "on")
(set Pool_Sonoff4CH POWER2 toggle)
FUUID 611eac34-f33f-f7a6-136b-25ff3c1283b2333e
MODEL FHEM
NAME DOIF_PH_Dosierung
NOTIFYDEV Pool_Sonoff4CH,global,PH_Sensor
NR 166
NTFY_ORDER 50-DOIF_PH_Dosierung
STATE cmd_2
TYPE DOIF
VERSION 24755 2021-07-15 16:40:59
Helper:
DBLOG:
cmd:
DBLogging:
TIME 1630598405.37698
VALUE 2
cmd_event:
DBLogging:
TIME 1630598405.37698
VALUE PH_Sensor
cmd_nr:
DBLogging:
TIME 1630598405.37698
VALUE 2
mode:
DBLogging:
TIME 1630000093.63124
VALUE enabled
state:
DBLogging:
TIME 1630598405.37698
VALUE cmd_2
READINGS:
2021-09-03 09:47:44 Device PH_Sensor
2021-09-02 18:00:05 cmd 2
2021-09-02 18:00:05 cmd_event PH_Sensor
2021-09-02 18:00:05 cmd_nr 2
2021-09-03 09:47:44 e_PH_Sensor_pH 5.998
2021-09-03 08:00:00 e_Pool_Sonoff4CH_POWER1 on
2021-08-26 19:48:13 mode enabled
2021-09-02 18:00:05 state cmd_2
2021-09-02 18:00:00 timer_01_c01 03.09.2021 18:00:00
2021-09-02 18:30:00 timer_02_c01 03.09.2021 18:30:00
Regex:
accu:
collect:
cond:
PH_Sensor:
0:
pH ^PH_Sensor$:^pH:
Pool_Sonoff4CH:
0:
POWER1 ^Pool_Sonoff4CH$:^POWER1:
attr:
cmdState:
wait:
waitdel:
condition:
0 ::DOIF_time_once($hash,0,$wday) or ::DOIF_time_once($hash,1,$wday) and ::ReadingValDoIf($hash,'PH_Sensor','pH') >7.200 and ::ReadingValDoIf($hash,'Pool_Sonoff4CH','POWER1') eq "on"
days:
do:
0:
0 set Pool_Sonoff4CH POWER2 toggle
1:
helper:
DEVFILTER ^global$|^Pool_Sonoff4CH$|^PH_Sensor$
NOTIFYDEV global|Pool_Sonoff4CH|PH_Sensor
event pH: 5.998
globalinit 1
last_timer 2
sleeptimer -1
timerdev PH_Sensor
timerevent pH: 5.998
triggerDev PH_Sensor
timerevents:
pH: 5.998
timereventsState:
pH: 5.998
triggerEvents:
pH: 5.998
triggerEventsState:
pH: 5.998
internals:
interval:
intervalfunc:
localtime:
0 1630684800
1 1630686600
readings:
all PH_Sensor:pH Pool_Sonoff4CH:POWER1
realtime:
0 18:00:00
1 18:30:00
time:
0 18:00:00
1 18:30:00
timeCond:
0 0
1 0
timer:
0 0
1 0
timers:
0 0 1
trigger:
triggertime:
1630684800:
localtime 1630684800
hash:
1630686600:
localtime 1630686600
hash:
uiState:
uiTable:
Attributes:
icon helper_doif
room 52_Pool,92_DOIF
Internals:
DEF ([18:45] or [19:15] or [19:45]and [ORP_Sensor:Redoxpotential] <700.0 and [Pool_Sonoff4CH:POWER1] eq "on") (set Pool_Sonoff4CH POWER3 toggle)
FUUID 611eaf96-f33f-f7a6-5415-e3347c8826143172
MODEL FHEM
NAME DOIF_Chlor_Dosierung
NOTIFYDEV global,ORP_Sensor,Pool_Sonoff4CH
NR 167
NTFY_ORDER 50-DOIF_Chlor_Dosierung
STATE cmd_2
TYPE DOIF
VERSION 24755 2021-07-15 16:40:59
Helper:
DBLOG:
cmd:
DBLogging:
TIME 1630602913.9957
VALUE 2
cmd_event:
DBLogging:
TIME 1630602913.9957
VALUE ORP_Sensor
cmd_nr:
DBLogging:
TIME 1630602913.9957
VALUE 2
state:
DBLogging:
TIME 1630602913.9957
VALUE cmd_2
READINGS:
2021-09-03 09:49:04 Device ORP_Sensor
2021-09-02 19:15:13 cmd 2
2021-09-02 19:15:13 cmd_event ORP_Sensor
2021-09-02 19:15:13 cmd_nr 2
2021-09-03 09:49:04 e_ORP_Sensor_Redoxpotential 791.2
2021-09-03 08:00:00 e_Pool_Sonoff4CH_POWER1 on
2021-08-23 18:05:05 mode enabled
2021-09-02 19:15:13 state cmd_2
2021-09-02 18:45:00 timer_01_c01 03.09.2021 18:45:00
2021-09-02 19:15:00 timer_02_c01 03.09.2021 19:15:00
2021-09-02 19:45:00 timer_03_c01 03.09.2021 19:45:00
Regex:
accu:
collect:
cond:
ORP_Sensor:
0:
Redoxpotential ^ORP_Sensor$:^Redoxpotential:
Pool_Sonoff4CH:
0:
POWER1 ^Pool_Sonoff4CH$:^POWER1:
attr:
cmdState:
wait:
waitdel:
condition:
0 ::DOIF_time_once($hash,0,$wday) or ::DOIF_time_once($hash,1,$wday) or ::DOIF_time_once($hash,2,$wday)and ::ReadingValDoIf($hash,'ORP_Sensor','Redoxpotential') <700.0 and ::ReadingValDoIf($hash,'Pool_Sonoff4CH','POWER1') eq "on"
days:
do:
0:
0 set Pool_Sonoff4CH POWER3 toggle
1:
helper:
DEVFILTER ^global$|^ORP_Sensor$|^Pool_Sonoff4CH$
NOTIFYDEV global|ORP_Sensor|Pool_Sonoff4CH
event Redoxpotential: 791.2
globalinit 1
last_timer 3
sleeptimer -1
timerdev ORP_Sensor
timerevent Redoxpotential: 791.2
triggerDev ORP_Sensor
timerevents:
Redoxpotential: 791.2
timereventsState:
Redoxpotential: 791.2
triggerEvents:
Redoxpotential: 791.2
triggerEventsState:
Redoxpotential: 791.2
internals:
interval:
intervalfunc:
localtime:
0 1630687500
1 1630689300
2 1630691100
perlblock:
readings:
all ORP_Sensor:Redoxpotential Pool_Sonoff4CH:POWER1
realtime:
0 18:45:00
1 19:15:00
2 19:45:00
time:
0 18:45:00
1 19:15:00
2 19:45:00
timeCond:
0 0
1 0
2 0
timer:
0 0
1 0
2 0
timers:
0 0 1 2
trigger:
triggertime:
1630687500:
localtime 1630687500
hash:
1630689300:
localtime 1630689300
hash:
1630691100:
localtime 1630691100
hash:
uiState:
uiTable:
Attributes:
icon helper_doif
room 52_Pool,92_DOIF
Um die Uhrzeiten muss glaub eine Klammer. Damit sollte sich dann zumindest lösen lassen, das bei einer Zeit immer getriggert wird, ohne auf die anderen Bedingungen zu achten.
siehe https://perldoc.perl.org/perlop#Operator-Precedence-and-Associativity
Dieser Ausdruck wird damit so ausgewertet:
( [18:45] or [19:15] or ( [19:45] and ([ORP_Sensor:Redoxpotential] <700.0) and ([Pool_Sonoff4CH:POWER1] eq "on") ) )
Wenn Du das anders willst (es sieht so aus) musst Du anders Klammern :)
Und wenn ich richtig verstehe solltest Du die Sensoren nur abfragen? Denn die sollen doch nicht triggern?
(([18:45] or [19:15] or [19:45]) and [?ORP_Sensor:Redoxpotential] <700.0 and [?Pool_Sonoff4CH:POWER1] eq "on")
Merke: Wenn man and und or (gilt auch für && und || ) in einer Bedingung mischt - muss man sich eigentlich immer die Klammern genau überlegen und setzen!
Gruß Otto
Zitat von: Otto123 am 03 September 2021, 11:10:00
siehe https://perldoc.perl.org/perlop#Operator-Precedence-and-Associativity
Dieser Ausdruck wird damit so ausgewertet:
( [18:45] or [19:15] or ( [19:45] and ([ORP_Sensor:Redoxpotential] <700.0) and ([Pool_Sonoff4CH:POWER1] eq "on") ) )
Wenn Du das anders willst (es sieht so aus) musst Du anders Klammern :)
Und wenn ich richtig verstehe solltest Du die Sensoren nur abfragen? Denn die sollen doch nicht triggern?
(([18:45] or [19:15] or [19:45]) and [?ORP_Sensor:Redoxpotential] <700.0 and [?Pool_Sonoff4CH:POWER1] eq "on")
Gruß Otto
Ja die Sensoren sollen abgefragt werden und wenn Wert zu hoch bzw. zu niedrig zu den Uhrzeiten der Sonoff4CH getriggert werden..
(([18:45] or [19:15] or [19:45]) and [?ORP_Sensor:Redoxpotential] <700.0 and [?Pool_Sonoff4CH:POWER1] eq "on")
(set Pool_Sonoff4CH POWER3 toggle)
so müsste es doch jeweils zu den Uhrzeiten wenn der Wert kleiner 700 ist den Sonoff Power3 schalten. Gestern abend wurde nur 18:45 geschalten, der Wert war bei ca. 620
Kann es sein das "or" durch "and" ersetzt werden muss?
EDIT: ja stimmt wohl jetzt. Da hab ich mit dem Handy die Klammern "überlesen", zu klein ;)
Du musst Klammern setzen!
Von "Punkt vor Strich" hast du schon mal gehört?
Gleiches hier mit "and vor or" ABER:
Irgendwas ODER Irgendwas anderes UND Egal was -> ODER Irgendwas ist eben bei Irgendwas wahr -> es schaltet egal was der Rest macht...
EDIT: dein DOIF ist wie folgt formuliert "Wenn 18:45 ODER 19:15 dann schalte ODER es ist 19:45 dann muss aber Redoxpotential passen UND Power on sein"...
EDIT: hatte doch auch Otto schon geschrieben...
Bei dir wird um 18:45 IMMER geschalten...
...ebenso eigentlich um 19:15...
Einfach ODER durch UND tauschen ist doch Quatsch!
Du musst überlegen bei welchen Bedingungen was passieren soll und entsprechend MIT KLAMMERN formulieren.
Ebenso überlegen was "triggern" soll und welche Werte zum Triggerzeitpunkt "nur passen" müssen...
EDIT: das mit Trigger/Abfrage hast du wohl mittlerweile... ;)
Gruß, Joachim
Moin,
ich denke die Logik ist so richtig.
Aber es wird wohl so sein, dass attr do always gesetzt werden muss.
Gruß Otto
Zitat von: Otto123 am 04 September 2021, 10:36:13
Moin,
ich denke die Logik ist so richtig.
Aber es wird wohl so sein, dass attr do always gesetzt werden muss.
Gruß Otto
oder ohne do always im Perlmode:
DOIF {if (([18:45] or [19:15] or [19:45]) and [?ORP_Sensor:Redoxpotential] <700.0 and [?Pool_Sonoff4CH:POWER1] eq "on") {fhem_set"Pool_Sonoff4CH POWER3 toggle"}}
Zitat von: Otto123 am 04 September 2021, 10:36:13
Moin,
ich denke die Logik ist so richtig.
Aber es wird wohl so sein, dass attr do always gesetzt werden muss.
Gruß Otto
Okay jetzt funktioniert es, das Attribut do always hat gefehlt.
Vielen Dank euch allen