Hallo
Dieses Doif geht leider nicht kommt eine Fehlermeldung beim set Befehl
wahrscheinlich ist die @ list noch leer beim setzen von set
wo liegt hier mein Fehler?
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"":state:$_ eq "on" and $TYPE eq "Milight_Device" and $room eq "wohnzimmer"] off)
Danke Ines
Ein "list" von jeweiligen Geräte (wohnzimmer_hub, irgendwelcer Milight_Device, und DOIF selbst) in Codetags würde helfen
Ich möchte damit per harmony mein gesamtes licht im wohnzimmer auschalten
ein ist vom doif
Internals:
DEF ([wohnzimmer_hub:activity] eq "PowerOff") (set [@"":state:$_ eq "on" and $TYPE eq "Milight_Device" and $room eq "wohnzimmer"] off)
NAME alle_lampen_aus
NR 796
NTFY_ORDER 50-alle_lampen_aus
STATE cmd_2
TYPE DOIF
Readings:
2017-05-18 15:53:28 Device wohnzimmer_hub
2017-05-18 15:53:26 cmd 2
2017-05-18 15:53:26 cmd_event wohnzimmer_hub
2017-05-18 15:53:26 cmd_nr 2
2017-05-18 15:53:28 e_wohnzimmer_hub_activity Fernsehen
2017-05-18 15:53:26 state cmd_2
Regex:
State:
State:
Cond:
Myreadings:
Condition:
0 ReadingValDoIf($hash,'wohnzimmer_hub','activity') eq "PowerOff"
Devices:
0 wohnzimmer_hub
all wohnzimmer_hub
Do:
0:
0 set [@"":state:$_ eq "on" and $TYPE eq "Milight_Device" and $room eq "wohnzimmer"] off
1:
Helper:
event Connected
globalinit 1
last_timer 0
sleeptimer -1
timerdev wohnzimmer_hub
timerevent Connected
triggerDev wohnzimmer_hub
timerevents:
Connected
timereventsState:
state: Connected
triggerEvents:
Connected
triggerEventsState:
state: Connected
Internals:
Itimer:
Readings:
0 wohnzimmer_hub:activity
all wohnzimmer_hub:activity
Trigger:
Attributes:
room harmony
Das hier geht leider auch nicht
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:"on" and $TYPE eq "MilightDevice" and $room eq "wohnzimmer"] off)
Ein "list" von jeweiligen Geräte (wohnzimmer_hub, irgendwelcer Milight_Device, und DOIF selbst) in Codetags würde helfen
ok dann noch die list
Lampe
Internals:
DEF RGBW MilightBridge 5
INIT 1
IODev MilightBridge
LEDTYPE RGBW
NAME Milight_Bogenlampe
NR 773
NTFY_ORDER 50-Milight_Bogenlampe
SLOT 5
SLOTID 5
STATE off
TYPE MilightDevice
Helper:
Dblog:
Transitioninprogress:
Logdb:
TIME 1495132003.78528
VALUE 0
Readings:
2017-05-18 20:26:43 brightness 0
2017-05-15 22:19:29 brightness_on 80
2017-05-18 20:26:43 discoMode 0
2017-05-18 20:26:43 discoSpeed 0
2017-05-18 20:26:43 hsv 0,100,0
2017-05-18 20:26:43 hue 0
2017-05-18 02:10:38 previousState 0,100,1
2017-05-18 20:26:43 rgb 000000
2017-05-18 20:26:43 saturation 100
2017-05-18 20:26:43 state off
2017-05-18 20:26:43 transitionInProgress 0
Helper:
COMMANDSET on off toggle dimup dimdown discoModeUp:noArg discoSpeedUp:noArg discoSpeedDown:noArg night:noArg white:noArg toggleWhite:noArg pair unpair restorePreviousState:noArg saveState:noArg restoreState:noArg hsv rgb:colorpicker,RGB hue:colorpicker,HUE,0,1,360 saturation:slider,0,100,100 preset dim:slider,0,4,100 brightness:slider,0,4,100
colorLevel 0
targetHue 0
targetSat 100
targetTime 1495132003.31884
targetVal 0
whiteLevel 0
COLORMAP:
176
175
175
174
174
173
173
172
171
171
170
170
169
168
168
167
167
166
166
165
164
164
163
163
162
161
161
160
160
159
159
158
157
157
156
156
155
154
154
153
153
152
152
151
150
150
149
149
148
147
147
146
146
145
145
144
143
143
142
141
140
140
139
138
137
137
136
135
134
134
133
132
131
131
130
129
128
128
127
126
126
125
124
123
123
122
121
120
120
119
118
117
117
116
115
114
114
113
112
112
111
110
109
109
108
107
106
106
105
104
103
103
102
101
100
100
99
98
97
97
96
95
95
94
93
93
92
91
91
90
89
89
88
87
87
86
85
85
84
83
83
82
81
81
80
79
79
78
77
77
76
75
75
74
73
73
72
71
71
70
69
69
68
67
67
66
65
65
64
63
63
62
61
61
60
59
59
58
57
57
56
55
54
54
53
52
51
50
50
49
48
47
46
46
45
44
43
42
42
41
40
39
38
38
37
36
35
34
34
33
32
31
30
30
29
28
27
26
26
25
24
23
22
22
21
20
19
18
18
17
17
16
15
13
12
11
10
9
8
6
5
4
3
2
1
254
253
252
251
250
249
247
246
245
244
243
242
240
239
238
237
236
235
233
232
231
230
229
228
226
225
224
223
223
222
222
221
221
220
220
219
219
218
218
217
216
216
215
215
214
214
213
213
212
212
211
211
210
209
209
208
208
207
207
206
206
205
205
204
204
203
202
202
201
201
200
200
199
199
198
198
197
196
196
195
195
194
194
193
193
192
192
191
191
190
189
189
188
188
187
187
186
186
185
185
184
184
183
182
182
181
181
180
180
179
179
178
178
177
177
GAMMAMAP:
0
4
4
4
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmdQueue:
Attributes:
IODev MilightBridge
alexaName lampe sofa,bogenlampe,sofalampe
alias couchlicht
colorCast 0,-5,0,0,-10,-29
devStateIcon {(MilightDevice_devStateIcon($name),"toggle")}
event-on-change-reading state,transitionInProgress
genericDeviceType light
group Licht
homebridgeMapping Brightness=brightness,cmd=dim
lightSceneParamsToSave hsv
restoreAtStart 1
room Alexa,wohnzimmer
userattr Milight_Tischlampe attr lightSceneParamsToSave lightSceneRestoreOnlyIfChanged:1,0 userattr
webCmd on:off:dim:hue:night:rgb ffffff:rgb ff0000:rgb 00ff00:rgb 0000ff:rgb ffff00
und von der Harmony
Internals:
CONNECTS 2
ConnectionState LoggedIn
DEF crypt:53535c0a5e0a5a4241500050765e0f020b5f4c5b0b5e crypt:535b5e0f5f104b4302 192.168.178.38
FD 4
LAST_CONNECT 2017-05-18 15:53:28
LAST_DISCONNECT 2017-05-18 15:53:26
NAME wohnzimmer_hub
NOTIFYDEV global
NR 761
NTFY_ORDER 50-wohnzimmer_hub
STATE Connected
TYPE harmony
ip 192.168.178.38
Readings:
2017-05-17 21:13:10 activity Fernsehen
2017-05-17 21:13:10 currentActivity Fernsehen
2017-05-17 21:12:45 previousActivity PowerOff
2017-05-18 15:53:28 state Connected
Config:
activity:
HASH(0x120bb294)
HASH(0x125e38c0)
HASH(0x12515e00)
HASH(0x11bf6000)
HASH(0x10a9bb94)
HASH(0x12601eb8)
Content:
contentDeviceHost https://content.dhg.myharmony.com/1.0/Device;{deviceProfileUri}
contentImageHost https://d1tk8oqnnsddt5.cloudfront.net/1.0/station/{stationId}/image;maxX=40;maxY=40
contentServiceHost https://content.dhg.myharmony.com/1.0/Service/{providerId}
contentUserHost https://content.dhg.myharmony.com/1.0/User;{userProfileUri}
householdUserProfileUri svcs.myharmony.com/res//household/7786805-eYySIUBWgmP9wOJI+Rq7pvVrNsRXTZ87hTTGDIn4YWQ=/user/default
device:
HASH(0x12532bfc)
HASH(0x1268e514)
HASH(0x126272a0)
HASH(0x12686b60)
HASH(0xad28e4c)
HASH(0x125c1d04)
HASH(0x11fffeb4)
HASH(0xfc0bb48)
HASH(0x12567c14)
Global:
locale de-DE
timeStampHash aac56581-5d5d-4b7c-9c4f-f4f3c8cc4106eee1e9d9-2738-45d7-b838-b9c8946da21f/29aa545d-1dd5-480c-862d-f8f6da09e72a55745467-87bb-4820-8174-0bbab44d9c749da1f905-cac8-4487-912a-7470e45250cf10412387Wohnzimmerde-DEDESilverlightWebClient0-17252322261965160454europe%2fberlin1;2bac3eae4ca127e5345e55f7b3325b89
sequence:
Discoveryinfo:
accountId 9505252
current_fw_version 4.12.36
discoveryServerUri https://svcs.myharmony.com/Discovery/Discovery.svc
email adolfocurade@gmail.com
friendlyName Wohnzimmer
host_name Wohnzimmer
hubId 97
hubProfiles {Harmony="2.0"}
ip 192.168.178.38
minimumOpenApiClientVersionRequired 1
mode 3
openApiVersion 2
port 5222
productId Pimento
protocolVersion {XMPP="1.0", HTTP="1.0", RF="1.0", WEBSOCKET="1.0"}
recommendedOpenApiClientVersion 1
remoteId 10412387
setupSessionClient SilverlightWebClient
setupSessionIsStale true
setupSessionSetupType
setupSessionType 0
setupStatus 0
uuid 0a04f2bb-3089-42f9-be9d-96870e513eb9
Helper:
PARTIAL
UserAuthToken
password crypt:535b5e0f5f104b4302
username crypt:53535c0a5e0a5a4241500050765e0f020b5f4c5b0b5e
Attributes:
alexaName harmony
room Alexa,Sonos,harmony
webCmd activity
Dann kann es nur MilightDevice und nicht Milight_Device sein.
Funktioniert sowas (nicht getestet)?
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"":state:$_ eq "on" and $TYPE eq "MilightDevice" and ($room =~ m/wohnzimmer/)] off)
nein funktioniert bei mir nicht
dieses hier auch nicht ([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:"on" and $TYPE eq "MilightDevice" and $room eq "wohnzimmer" ,"defaultdummy"]
Dieses hier scheint zu gehen
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:"on","defaultdummy"] off)
stand so in der Commandref (defaultdummy) hatte ich vorher wie immer nicht gelesen.
Aber warum geht es nicht wenn ich versuche $TYPE mit abzufragen....
Den Fehler mit Milight_Device hatte ich schon gesehen und korrigiert gehabt.
Ines
Ines sei bitte so nett und schreibe Log Ausgaben oder/und Code in Codetags. So wie Du es oben bereits getan hattest, sonst kann man das nicht vernünftig lesen.
Danke
Kann es sein, dass es eher an den $room Parameter als an den $TYPE hängt?
Du solltest bedenken, dass
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:"on","defaultdummy"] off)
das Gleiche ist wie:
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on","defaultdummy"] off)
also nicht: $_ eq "on"
Danach kannst du testen:
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on" and $TYPE eq "MilightDevice","defaultdummy"] off)
usw.
Ach kool, jetzt kommt ein Regexp Expert!
Also, wenn ich richtig verstanden habe, will inesa alle Devices vom TYPE Milight ausschalten, die "on" sind, aber nicht unbedigt "Milightetwas" heissen, und die im Raum "wohnzimmer" sind.
Wie sollte man das schreiben?
Und meine Frage dazu: Wenn mein Device in mehrere Räume ist, z.B. wohnzimmer, alexaRoom, webAccessRoom, was ergibt $room?
Ja ich will alle Lampen vom Type MilightDevice im Wohnzimmer die auf on stehen damit auschalten per Tastendruck auf meiner Harmony :)
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on" and $TYPE eq "MilightDevice","defaultdummy"] off)
wenn ich bei diesen hier enfach ein
Wenn ich noch den Raum mit abfrage würde das so aussehen?
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on" and $TYPE eq "MilightDevice" and $room eq "wohnzimmer","defaultdummy"] off)
Ines
Zitat von: amenomade am 19 Mai 2017, 16:10:47
Ach kool, jetzt kommt ein Regexp Expert!
Also, wenn ich richtig verstanden habe, will inesa alle Devices vom TYPE Milight ausschalten, die "on" sind, aber nicht unbedigt "Milightetwas" heissen, und die im Raum "wohnzimmer" sind.
Wie sollte man das schreiben?
Und meine Frage dazu: Wenn mein Device in mehrere Räume ist, z.B. wohnzimmer, alexaRoom, webAccessRoom, was ergibt $room?
in $room steht genau das, was im Attribut room steht.
daher bei Abfrage z. B. nach wohnzimmer:
[@"":state:$_ eq "on" and $TYPE eq "Milight" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"]
define notifyMilightWohnzimmerOff notify wohnzimmer_hub:activity:.PowerOff set .*:FILTER=TYPE=Milight_DeviceFILTER=room=wohnzimmer:FILTER=state=on off
Hier mal wie man es mit einen Notify lösen könnte.
Muss wirklich alles zusammen hängen?set .*:FILTER=TYPE=Milight_DeviceFILTER=room=wohnzimmer:FILTER=state=on
Ein notify wäre natürlich auch eine alternative :)
Das Doif von Damian hier
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on" and $TYPE eq "MilightDevice" ,"defaultdummy"] off)
funktioniert.
Dieses leider nach Raum gefiltert aber nicht
(set [@"":state:$_ eq "on" and $TYPE eq "MilightDevice" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"]off)
Ines
Zitat von: inesa394 am 19 Mai 2017, 19:13:26
Ein notify wäre natürlich auch eine alternative :)
Das Doif von Damian hier
([wohnzimmer_hub:activity] eq "PowerOff") (set [@"^Milight":state:$_ =~ "on" and $TYPE eq "MilightDevice" ,"defaultdummy"] off)
funktioniert.
Dieses leider nach Raum gefiltert aber nicht
(set [@"":state:$_ eq "on" and $TYPE eq "MilightDevice" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"]off)
Ines
Vor off muss ein Leerzeichen und mit $_ eq "on" hat es bei dir vorhin auch nicht funktioniert, daher
(set [@"":state:$_ =~ "on" and $TYPE eq "MilightDevice" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"] off)
und wenn es nicht funktioniert, dann poste ein list von einem MilightDevice-Device, welches ausgeschaltet werden soll.
Zitat von: amenomade am 19 Mai 2017, 18:49:37
Muss wirklich alles zusammen hängen?set .*:FILTER=TYPE=Milight_DeviceFILTER=room=wohnzimmer:FILTER=state=on
Meines Wissens, JA
ich hätte erwartet:
set .*:FILTER=TYPE=Milight_Device:FILTER=room=wohnzimmer:FILTER=state=on
Zitat von: CoolTux am 19 Mai 2017, 17:58:43
define notifyMilightWohnzimmerOff notify wohnzimmer_hub:activity:.PowerOff set .*:FILTER=TYPE=Milight_DeviceFILTER=room=wohnzimmer:FILTER=state=on off
Hier mal wie man es mit einen Notify lösen könnte.
Sorry übersehen. Ja da hast Du dann richtig erwartet.
define notifyMilightWohnzimmerOff notify wohnzimmer_hub:activity:.PowerOff set .*:FILTER=TYPE=Milight_Device:FILTER=room=wohnzimmer:FILTER=state=on off
Es hat geklappt
(set [@"":state:$_ =~ "on" and $TYPE eq "MilightDevice" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"] off)
danke Damian lag am fehlenden Leerzeichen das state:$_ =~ "on" hatte ich schon mit drin :)
Wobei mir jetzt das notify einfacher vorkommt. Vor allen dieses regexp $room =~ /(^|,)wohnzimmer(,|$)/
erschließt sich mir nicht.Naja hauptsache es funktioniert erst mal.
Ines
Zitat von: inesa394 am 19 Mai 2017, 20:30:37
Es hat geklappt
(set [@"":state:$_ =~ "on" and $TYPE eq "MilightDevice" and $room =~ /(^|,)wohnzimmer(,|$)/,"defaultdummy"] off)
danke Damian lag am fehlenden Leerzeichen das state:$_ =~ "on" hatte ich schon mit drin :)
Wobei mir jetzt das notify einfacher vorkommt. Vor allen dieses regexp $room =~ /(^|,)wohnzimmer(,|$)/
erschließt sich mir nicht.Naja hauptsache es funktioniert erst mal.
Ines
mit /(^|,)wohnzimmer(,|$)/
wird nur sichergestellt, dass der Raum auch dann gefunden wird, wenn mehrere Räume einem Device zugeordnet sind. Diese werden ja mit Komma getrennt angegeben und das wird hier erkannt.
Für deine Anforderung dürfte die set-Filter-Syntax ausreichen.
Bei komplexeren Abfragen dürfte set-Filter irgendwann an seine Grenzen stoßen. Bei DOIF kannst du beliebigen Perl-Code in die Filter-Abfrage packen insb. ReadingsVal und co.
Die DOIF-Aggregationsfunktionen sind in erster Linie für Anzeigen/Abfragen gedacht. Die Nutzung dieser als set-"Filter" ist nur ein Abfall-Produkt ;)
Zitat von: inesa394 am 19 Mai 2017, 20:30:37Wobei mir jetzt das notify einfacher vorkommt.
FILTER ist nicht vom
notify abhängig, das geht in jeder
set-Kombination, also auch bei
DOIF oder direkter Eingabe in die Komandozeile.
ok und weil mein Milight Licht zwei räumen zugeordnet ist war dies die richtige Syntax damit es funktioniert.
Dann hätte das notify so auch nicht funktioniert oder sehe ich das falsch
Ines
Probiere es einfach aus. Gebe den set Befehl vom Notify einfach oben in die Eingabezeile von FHEMWEB ein.