You could use JavaScript to do the trick. As I myself am not very familiar with JavaScript, I can’t give you a working code, but the idea wqould be to do the jsonpath within the JavaScript, then set the output to ON or OFF depending on the result.
At least there are some examples here in the community…
A new file called zigbee.js in your transform folder
The Javascript transformation installed!!
(function(dataString) {
var data = JSON.parse(dataString);
var lightState = data['29'].state.on;
var reply = "";
if (lightState) reply = "ON";
if (!lightState) reply = "OFF";
return reply;
})(input)
Not any more
Worked straight out of ‘the box’.
Very nice, and dare I say clever. Thanks both.
Now, the JavaScript is not generic for all my 31+ lights, but not all lights need polling.
This one does though, because when I turn off my reading light with the Ikea remote, the missus’s light on the other side of the bed is also turned off. Thanks again.
OpenHab makes it possible to learn something new (almost) every day.