Hi all,
I’m using openHab 1.8.
My goal is to turn off multiple lights when a specific button on the hue dimmer switch is pressed.
I’m relatively new to openHAB and I think the problem is the rule I’ve created.
I have the following two items in the items file:
String HueTasteSchlafzimmerZeit "Zeit [%s]" (Wohnzimmer){ http="<[http://-huebridgeip-/api/-SecretID-/sensors/10:2000:JS(HueSwitchDatumTransformation.js)]" }
String HueTasteSchlafzimmerTyp "[%s]" (Wohnzimmer) { http="<[http://-huebridgeip-/api/-SecretID-/sensors/10:2000:JS(HueSwitchTasteTransformation.js)]" }
And the corresponding transformations:
HueSwitchDatumTransformation.js
(function(i) {
var json = JSON.parse(i);
return json['state']['lastupdated'];
})(input)
HueSwitchTasteTransformation.js
(function(i) {
var json = JSON.parse(i);
return json['state']['buttonevent'];
})(input)
The first item shows the exact time of when the button was pressed the last time.
The second item shows which button has been pressed.
The strings and the transformations work perfectly. I can see the values in the OpenHAB app and they update when i press a button.
Now the rule. I want a simple rule that turns off multiple lights (for the example I used only one bulb) when the OFF button on the dimmer switch is pressed long and then released. (buttonevent = “4003”).
My rule looks like this:
rule "AlleLichterAus"
when
item HueTasteSchlafzimmerZeit changed
then
if (HueTasteSchlafzimmerTyp == "4003")
{sendCommand(huewz1, OFF)}
End
Can anyone help me with this issue?
Thanks in advance for any help.