Hallo,
wahrscheinlich übersehe ich etwa, aber was?
Ich möchte mit einem DOIF nach einer Zeit ein Userreading hochsetzen. Das Userreading heißt "Stufe". Jede Stufe ist für eine andere Zeitdauer gültig und wird dann weitergeschaltet. Das DOIF soll auf Änderung des Userreading als Event reagieren und die im DOIF eingestellte Waitzeit warten.
Mit setreading kann ich das Userreading setzen und das DOIF reagiert, die Stufe wird aber nur einmal weitergeschaltet.
Auf ein setreading im DOIF wird zwar das Userreading gesetzt aber kein Event ausgelöst.
Ich habe es mit trigger probiert, aber das löst ebenfalls im DOIF kein Event aus.
Wiki, Logfile und Forum haben mir leider keinen Tip gegeben.
Was mache ich falsch? Syntax?
Das DOIF ist erstmal ein Testdevice, ohne Wait. Da kommen später auch noch Befehle rein.
Der Dummy:
Internals:
CFGFN
NAME AS
NR 13236
STATE ???
TYPE dummy
READINGS:
2018-09-13 09:34:30 Stufe 1
Attributes:
room Test
das DOIF:
Internals:
CFGFN
DEF ([AS:Stufe]==0) (set M5_Onkyo power off)
DOELSEIF ([AS:Stufe]==1) ({Log 3, "Status auf Stufe 1"})(setreading AS Stufe 2,trigger AS Stufe:2)({Log 3, "Status 1 auf Stufe 2"})
DOELSEIF ([AS:Stufe]==2) ({Log 3, "Status auf Stufe 2"})(setreading AS Stufe 3,trigger AS Stufe:3)({Log 3, "Status 2 auf Stufe 3"})
DOELSEIF ([AS:Stufe]==3) ({Log 3, "Status auf Stufe 3"})(setreading AS Stufe 4,trigger AS Stufe:4)({Log 3, "Status 3 auf Stufe 4"})
DOELSEIF ([AS:Stufe]==4) ({Log 3, "Status auf Stufe 4"})(setreading AS Stufe 5,trigger AS Stufe:5)({Log 3, "Status 4 auf Stufe 5"})
DOELSEIF ([AS:Stufe]==5) ({Log 3, "Status auf Stufe 5"})
MODEL FHEM
NAME Stufentest
NR 13219
NTFY_ORDER 50-Stufentest
STATE initialized
TYPE DOIF
READINGS:
2018-09-13 09:45:50 cmd 0
2018-09-13 09:45:50 mode enabled
2018-09-13 09:45:50 state initialized
Regex:
attr:
cmdState:
wait:
waitdel:
condition:
0 ReadingValDoIf($hash,'AS','Stufe')==0
1 ReadingValDoIf($hash,'AS','Stufe')==1
2 ReadingValDoIf($hash,'AS','Stufe')==2
3 ReadingValDoIf($hash,'AS','Stufe')==3
4 ReadingValDoIf($hash,'AS','Stufe')==4
5 ReadingValDoIf($hash,'AS','Stufe')==5
devices:
0 AS
1 AS
2 AS
3 AS
4 AS
5 AS
all AS
do:
0:
0 set M5_Onkyo power off
1:
0 {Log 3, "Status auf Stufe 1"}
1 setreading AS Stufe 2,trigger AS Stufe:2
2 {Log 3, "Status 1 auf Stufe 2"}
2:
0 {Log 3, "Status auf Stufe 2"}
1 setreading AS Stufe 3,trigger AS Stufe:3
2 {Log 3, "Status 2 auf Stufe 3"}
3:
0 {Log 3, "Status auf Stufe 3"}
1 setreading AS Stufe 4,trigger AS Stufe:4
2 {Log 3, "Status 3 auf Stufe 4"}
4:
0 {Log 3, "Status auf Stufe 4"}
1 setreading AS Stufe 5,trigger AS Stufe:5
2 {Log 3, "Status 4 auf Stufe 5"}
5:
0 {Log 3, "Status auf Stufe 5"}
6:
helper:
globalinit 1
last_timer 0
sleeptimer -1
itimer:
readings:
0 AS:Stufe
1 AS:Stufe
2 AS:Stufe
3 AS:Stufe
4 AS:Stufe
5 AS:Stufe
all AS:Stufe
uiState:
uiTable:
Attributes:
room Test
So klappt es:
([AS:Stufe]==0) (set M5_Onkyo power off)
DOELSEIF ([AS:Stufe]==1) ({Log 3, "Status auf Stufe 1"})(setreading AS Stufe 2)({Log 3, "Status 1 auf Stufe 2"})(set Stufentest cmd_3)
DOELSEIF ([AS:Stufe]==2) ({Log 3, "Status auf Stufe 2"})(setreading AS Stufe 3)({Log 3, "Status 2 auf Stufe 3"})(set Stufentest cmd_4)
DOELSEIF ([AS:Stufe]==3) ({Log 3, "Status auf Stufe 3"})(setreading AS Stufe 4)({Log 3, "Status 3 auf Stufe 4"})(set Stufentest cmd_5)
DOELSEIF ([AS:Stufe]==4) ({Log 3, "Status auf Stufe 4"})(setreading AS Stufe 5)({Log 3, "Status 4 auf Stufe 5"})(set Stufentest cmd_6)
DOELSEIF ([AS:Stufe]==5) ({Log 3, "Status auf Stufe 5"})