Arm the alarm if all opening (and/or) motion detectors are in good position

trigger: alarm in the process of arming

condition: if all opening detectors are « closed » (and/or) motion detectors are inactive.

inability to see the status of a detector in the if function?

You can do it with a « Get last state » block + « Condition on variables » :slight_smile:

To make an « AND », you can just put several conditions, it will work!

I’m still sorry, it doesn’t work. Let me explain: I create a scene triggered by: alarm in the process of arming, I perform an action: retrieve the last state of the opening detector, then I create a condition on the variable select the opening detector in question if different from Closed then I disarm the alarm, I send an SMS to report the open window otherwise: I send an SMS armed alarm. Result: whether the detector is open or closed, the countdown remains at 0 and nothing happens. It’s still a big problem how can you arm an alarm with an open window or door especially if you want to use the alarm in partial mode.

If I set the trigger as: alarm armed at the end of the countdown, the alarm goes into disarmed mode whether the detector is open or closed, and I receive no message. I think I’ll find another solution to replace my alarm, which won’t be useful to me anymore since operators are abandoning 2G. I’m a bit disappointed; I really liked this solution.

What an adventure! In fact, I just tried using the values 1 or 0 instead of Open and Closed, and it works with the armed alarm trigger. If I use the alarm arming trigger, it works, but if the window is open, it blocks the countdown at zero but doesn’t arm the alarm. We can say that the problem is largely resolved.

Well done for finding the solution with 0 and 1! I’ll explain why and how to finish setting up your scenario :slight_smile:

1. Why « Open » / « Closed » Didn’t Work

The « Condition on Variables » block compares the raw value stored by Gladys, not the label displayed in the interface. For a binary feature, the value is always 0 or 1, and « Open »/« Closed » is just the on-screen translation. Since the comparison is strict, "Closed" (text) is never equal to 1 (number): the condition was therefore never validated and the scene stopped silently, hence your « nothing happens ».

The values to use:

Sensor Type 0 1
Door Sensor Open Closed
Motion Detector No Movement Movement Detected

2. AND or OR?

A small clarification regarding my previous answer: within the same « Condition on Variables » block, conditions are linked by an OR (the block passes as soon as one is true). To make an AND, you need to add multiple « Condition on Variables » blocks: they must then all be validated for the scene to continue. This is reminded directly in the interface since version 4.84.3.

In your case, the OR is exactly what you need: you want to cancel the arming if at least one sensor is faulty. So one condition block, with one line per sensor:

  • Front Door - Opening = 0
  • Living Room Window - Opening = 0
  • Living Room Detector - Movement = 1

3. The Complete Scene

  1. Trigger: « Alarm Armed » (end of countdown)
  2. « Retrieve Last State »: one block per sensor (they must be above the condition block, otherwise the variables do not appear in the dropdown list, this answers your question « impossibility to see the state of a detector in the function if? »)
  3. « Condition on Variables » with the lines above
  4. « Send a Message »
  5. « Change Alarm Mode » → Disarmed

Make sure to send the message before disarming.

4. The Bug You Encountered with « Alarm in the Process of Armament »

There you encountered a real bug in Gladys, it’s not you: during the countdown, the house is still recorded as « disarmed » in the database (it only goes to « armed » at the end of the delay). Therefore the « Disarm » action does cancel the arming, but it returns an error « the house is already disarmed » before notifying the interface, hence the countdown that remains frozen at 0 while the alarm is not actually armed.

Until I fix this, stick with the « Alarm Armed » trigger: the alarm arms for a fraction of a second then disarms properly, and the interface updates correctly.

Fix for your issue:

I made 2 improvements for you:

  • Bug fix for the disarm bug
  • In scenes, the condition on variable displays the possible values instead of making the user guess 0 and 1

Both are live in 4.84.4: