@mortommy I tried to implement your solution in my system, unfortunately I can’t get it running.
I’m using openHab 1.8.
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 "Hue Taste Schlafzimmer Zeit [%s]" { http="<[http://-huebridgeip-/api/-SecretID-/sensors/10:2000:JS(HueSwitchDatumTransformation.js)]" }
String HueTasteSchlafzimmerTyp "Hue Taste Schlafzimmer Typ [%s]" { http="<[http://-huebridgeip-/api/-SecretID-/sensors/10:2000:JS(HueSwitchTasteTransformation.js)]" }
sensor 10 is one of my hue dimmer switches.
The transformations are in the folder transform and look like this:
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)
Now the rule. I want a simple rule that turns off a specific light 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 you help me with this issue?
Thanks in advance for any help.