I’m creating a pair of scenes with ZBox Hub that detect a leak via either of 2 sensors, sound an alarm via the new siren, and clear it when the both sensors are clear.
I notice that in the Single Device block for this type of device on the trigger side has the following options:
When detecting a leak and “Use as trigger”, I need to use “Notification: Water Alarm (5)”.
However, with 2 devices, I only want to silence the alarm if both leak sensors do not detect water. The only way I could get this to work was to create 2 scenes:
Scene 1: All of these are true:
Device Siren, State, Turn on - not as a trigger, just as a condition
Device Sensor 1, Notification: Water Alarm (5), State Idle (0) - used as a trigger
Device Sensor 2, State, Leak cancelled - not as a trigger, just a condition
Scene 2: All of these are true:
Device Siren, State, Turn on - not as a trigger, just as a condition
Device Sensor 1, State, Leak cancelled - not as a trigger, just a condition
Device Sensor 2, Notification: Water Alarm (5), State Idle (0) - used as a trigger
Each scene is basically saying if the alarm is going, and one sensor is inactive, and the other becomes inactive, silence the alarm.
My question - what’s with the two different variables, “State” and “Notification: Water Alarm (5)”? They seem to mean the same thing, but need to be used in different ways.
Related, is there a way to do this via a single scene? I tried a few combinations but could not get it to work.
You could do it in a single Lua Scene, if that’s something you’re comfortable with.
Another way to do this (albeit more than a single scene) is to set up a “virtual switch,” i.e., global enum variable called, say, vWaterDetected with states ‘True’ and ‘False.’ Write two block scenes: one to set it ‘True’ if any of the devices senses water, the other to set it ‘False’ if none of the sensors detect water. Now you have an aggregate state of all water leak sensors.
Set up another block scene to trigger the siren alarm/notification when the global variable vWaterDetected goes ‘True’ and a another block scene to silence the alarm when the global variable goes ‘False.’
Note the four block scenes, above, can be easily done in two Lua scenes, if you’re comfortable doing that!
One advantage of doing it this way is that adding any number of additional water sensors means only editing the first two block scenes (or one Lua scene). Furthermore, should you wish to do something else–say, turn on a light when water is detected–do it using the global variable aggregate state!
YMMV, of course. The versatility of the Z-Box Hub lets you do this in many ways, including sending notifications to your phone when water is detected. Perhaps others have solved this problem in other ways and may wish to describe their solution…
I may try that with Lua – I’ve only scratched the surface there.
My first question still stands, though – you say “if none of the sensors detect water” – do I use “State, Leak cancelled” or “Notification: Water Alarm (5), State Idle (0)”? They don’t seem to both work in the same way.