What's a good way to execute an alarm sequence (15 second warning before full alarm)

Situation: a bunch of door and motion sensors + 3 Zigbee Tuya siren (which supports different sounds)

I want to achieve the following:

  1. When a sensor is triggered...

  2. All sirens in the house start giving a subtle warning sound @ 50% volume. This warns the user
    that the alarm is about to go off. This shall go on for 15 seconds...
    --->if the user cancels the alarm, then all sirens are turned off.

  3. After 15 seconds, the same sirens will go into alarm mode (panic sounds @ max volume). This shall go on for at least 10 minutes

This is how I am planning to do this:

RULE # 1 (Alarm Sequence)
I'll first create a rule for the sirens.. This rule will not have triggers, just the actions. This way i can have different Rules (with the actual triggers) that will run the actions of this rule.

The actions for this rule shall be:
Action 1: Run custom action > playSound -> Beeps @ volume 50% for 15 seconds
Action 2: Run custom action > playSound -> Alarm @ volume 100% for 600 seconds (Delay = 15 seconds)

Concept: The warning beeps will play first 15 seconds, followed by the full alarm siren.

RULE #2: Trigger
Several triggers (sensors and SOS buttons) in several areas with different conditions that, if met, will Run the Rule Actions of RULE #1 (start alarm sequence)

RULE #3 Cancel Button
The same SOS buttons, if double pressed, will Stop RULE ACTIONS of RULE #1 and Disarm the Security

I've not tried this yet but so far in theory this could work.... But I'm wondering

  1. Do you guys have an idea of a better way to do this

  2. How will this behave if several sensors were triggered all running the same rule action = will this result in duplicate executions (stacking)?!

  • eg. Burglar enters the door (triggers door sensor), moves into the hallway (triggers motion detector) ... so both sensors will have different rules all firing actions of RULE #1 (alarm sequence)
  1. I also to give the user option to hit the panic button, with the following behavior:

if user Presses the panic button
A. During the warning beeps, full alarm is engaged. (This way if it's a real emergency the user does not need to wait for 15 seconds before the alarm goes off)

B. When sirens are inactive (no triggers), alarm sequence is started (This is a way for user to manually trigger the alarms, but has 15 seconds to cancel. Of course if during this warning sequence user pushes the panic button again then warning sequence is skipped, full alarm engaged.(same behavior in A)

1 piece, is I think the tuya siren uses a driver similar to the dome siren, which has a pre-alarm beep. So check the driver page.
Here is my dome siren


I think I can get close to this... but I'm just mocking this up so I am not sure everything will work. I went ahead and put the triggers in the same rule as the actions. There may be a more elegant way to achieve this.

The main rule will need a variable named "trigger_device". In my example, the armed condition is a hub mode, but you could also use a hub variable or some other way of testing that the system is armed.

The required expression is that the system is armed. In my example "Test" is the armed mode. Make sure to select "cancel pending actions if the required expression becomes false".

For triggers, use all the perimeter devices and all the panic buttons (single pressed). All panic devices must have 'panic' in the name. Please imagine my 'Test button' is actually named 'Panic button 1'.

Here are the actions:

First action: set the variable trigger_device to the %device% that triggered the rule

First if/then loop:
If private boolean is true and trigger device was NOT named 'panic' then this is a new activation from a perimeter device.

  • play alarm sound at volume 50 (in my rule this is represented by setting the volume of a radio)
  • play alarm sound at volume 100 in 15 seconds delayed, cancelable
  • stop alarm sound in 10 minutes, cancelable
  • set private boolean back to true in 10 minutes, cancelable

Second if/then loop:
If the rule was triggered by a 'panic' device:

  • set private boolean to false (prevents reactivation by perimeter device)
  • cancel pending actions
  • play alarm at volume 100 immediately
  • stop alarm, delayed 10 minutes, cancelable
  • set private boolean true, delayed 10 minutes, cancelable (in case the panic happened after a perimeter activation and boolean was set to false)

To disarm or cancel an activated alarm:
Rule #2: When a panic button is double-clicked, change the mode to anything but the armed mode (so in my example, anything but "Test"). This will cause the required condition on this rule to go false and any pending actions to be cancelled. The disarm rule will also need to send a stop/off to the siren device and set the private boolean to true on the main rule in case it was left at false.

If you want to be able to send a panic when the system isn't armed:
Create another rule with trigger: any panic button is pressed
set mode to armed
delay 1 second (I think this will be needed, but not sure)
run custom action on panic button 1: 'press button 1'

Again, maybe not the best way... certainly not the only way... but I think that would do what you want to do.

The only thing I'd need to confirm is that on a second activation of the rule by a panic button, that the pending actions of the first activation are canceled by the "cancel delayed actions" command. I think that's how it works, but I am not certain.


Can you give some more information how this 'pre-alarm beep' option works?

Hi Krassimir, I have the option off, but when activated it would create a series of tones during the countdown, before sounding the alarm when HSM detected an intrusion, and then after the set delay period the full alarm kicks in.
Now the dome siren is Z-wave+ and the tuya is zigbee and I'm not sure if Mike did something with the native HE Dome driver or if this is something programmed into the Dome siren's firmware,
I've since turned off the feature, as I have keypads that beep during delay plus a Google home announcement "enter code or police will be called"