Hello,
I have been working on a script using BLE-Shelly-Blu and BLE-Events-Handler, first time to work with this controller.
I am able to use Shelly Blu door and window sensor to turn on/off 1 relay, but I want to use 2 or more door window sensors to activate a single relay.
When any sensor is open, the relay energizes...works fine.
But
I want to have all sensors closed to de-energize the relay, I was trying to use "AND" in the condition statement but I am unable to get it working.,
Here is the code I have been working on.
/** SCENE START 4 - Shelly BLU Scanner example **/
{
conditions: {event: "shelly-blu", address: "b0:c7:de:2c:7e:9a", window: 0} &&
{
conditions: {event: "shelly-blu", address: "b0:c7:de:41:5a:5c", window: 0}
},
action: function (data) {
// prints the data parsed from Shelly blu device
console.log("Shelly BLU device found", JSON.stringify(data));
//toggles the first built-in relay
Shelly.call("Switch.Set", { id: 0, on: false });
//Shelly.call("Switch.Toggle", { id: 0 });
},
},
/** SCENE END 4 **/
Can anyone advise on how to combine these conditions to set the switch to OFF
I can get one sensor to work if I comment out the && second sensor...
Thanks in Advance,
Jim