My first real automation - switch + door sensor + siren!

So far I have my very simple sitemap showing some weather information as well as the status of a z-wave door sensor. That is all working fine.

I just got a z-wave siren and my goal is to add a switch (just a virtual button) to the site map so I can “arm” an alarm and with that turned on, if the door opens send a command to sound the alarm. Then be able to turn the switch to off to send the command to stop the alarm.

Yea, I have no idea what to do next. I can add a switch to the sitemap, but how to have that activate any code that sounds the alarm if the door is open. No idea. Any suggestions or examples you might know if I could look into?
Thanks for your help.

what make/model siren do you have ?

I have the Aeotec Gen 5 Siren. It is added to the z-wave network and shows up in habmin as the third device in the network.

Some suggestions…

I like to think of rules in terms of trigger/preconditions/actions. In pseudo-code…

rule "rule name"
    when
        <TRIGGER CONDITIONS>
    then
        if (<PRECONDITIONS>) {
            <ACTIONS>
        }
    end

The triggers cause evaluation of the preconditions and if the preconditions are true, then the actions are executed. The preconditions are optional, the “then” part of the rule might just be actions for simple rules.

In this case, a trigger is the door sensor state changing to “OPEN”. This would trigger a rule. In the rule body (the “then” part), the precondition is that the alarm switch item must be “ON”. The rule would check that precondition and if it is true, an “ON” command is sent to the siren.

To turn off the siren, send an OFF command to its switch item, probably through an interactive user interface.

You might also want a rule to send an “OFF” command to the siren when the alarm switch transitions to “OFF”.

The siren is apparently also multilevel device, so you should be able to set (?volume?) similar to a dimmer.

Aeon Gen 5 Siren manual

I’m at the same stage (with the same siren, but with a motion detector instead of a door sensor).
I have also defined a rule to trigger the alarm:

rule "Toggle_Alarm"
when
        Item LR_Motion received update
then
        logError("LR_Motion", "State changes are: " + LR_Motion.state.toString + "," + Alarm_State.state.toString)
        if (LR_Motion.state == ON && Alarm_State.state == ON) {
                logError("LR_Motion", Siren.state.toString)
                postUpdate(Siren, "ON")
        }
end

And I can see on the sitemap that the siren state is also changed to “ON” but it does not trigger the sound/lights. Apparently another command has to be sent to the siren to make it sound as well.

Do you need to send a command to the siren? The postUpdate will just change the openHAB state but probably won’t cause the binding to send a command to the siren device.

@steve1 thnx for the headsup. I read somewhere that the difference between sendCommand & postUpdate was that the first is synchronous action and the latter async. But apparently that was not the case.
I changed the postUpdate into sendCommand and it worked! :sweat_smile:

Thanks for posting this. I was looking for a siren as well.

I have this siren working when the door opens and that works fine. I am trying to learn how to control it. There are other settings like volume and sound type to configure.

Do I add another item for setting the sound/volume or can I add to the existing item with another command?

Thanks for any guidance!

You’re ahead of me then. A generic switch binding doesn’t appear to yield a tone once switched on. By chance can you share an example of the alarm declaration in your items config?

Regards, Stephan

Switch Siren “Siren” { zwave=“3:command=switch_binary,respond_to_basic=true” }

This is the simple line in the rule that turns it on, sendCommand(Siren, ON)
Anything else you do is extra on top, just be sure you can send a command to turn it off :wink:

I never did figure out how to change the sound or the volume. Those are configurations rather than commands, but how do you send a configuration via a rule??

The manual says:

The value2 (high byte) is used to adjust the volume:
Value2=0, do not change the current volume.
Value2=1, set the volume to 88 dB.
Value2=2, set the volume to 100 dB.
Value2=3, set the volume to 105 dB.

There is some sort of conversion to 8 bit numbering scheme or something? I have no idea, but would sure love to adjust the sounds and volume.

Configuration parameters can be changed via habmin.

Yes, but the instructions on this device don’t make how to do that very clear. The value the instructions reference is currently 258. These say the high byte is the sound and the low byte is the volume. How does that translate into a number in habmin?

Even so, can’t change things in habmin via a rule??
Thanks for any help!!

Take a look into the zwave database:
http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/90
I don’t have this device, but it looks to me you need to change parameter 37, f.e.:
13 is default, that means siren sound 1 is selected and the volume is set to 105db.
If you want to change to sound 2 and volume 100db, you would need to set parameter 37 to 22 and so on.