Sonoff tasmota basic as an alarm trigger - or how to use the sonoff state?

Running Openha2 latest on PI3b.
I do have now (thanks Vincent) also a sonoff tasmota basic up an running. I see the state of the sonoff reflected in my basic ui - all OK so far.

Now my next adventure where I need your help. I would like to use the state “ON” from the sonoff as an alarm trigger. I do have a PIR connected to the sonoff what switchs the sonoff “ON” for a second and OFF again. After 9 seconds the PIR can fire again for a second and so on.

Now I would like to use this activation of the sonoff as a “counter” and when activated 3 times in a minute I would like to switch an already existent Z-WAVE+ plus switch which is activating a sirene.

Now I would need someone who can help me with to build a rule cause I never will get it allone :frowning:

My sonoff item is called Sonoff1
Switch Sonoff1 {mqtt=">[broker:cmnd/sonoff1/POWER:command:*:default],<[broker:stat/sonoff1/POWER:state:default" }

and the Z-Wave+ item is called
zwave_device_296beed3_node4_switch_binary

So I have no idea how to transfer the sonoff state into a counter and when this counter is reaching 3 - switching my zwave+ switch for lets say 3 minutes.

Hope someone can support me with this

Hello Boris,

Try, have a go, we are not here to write code for you but to guide you
Make a start
Get to rule to trigger your zwave when motion is detected to start with
Then read about variables and timer in the docs and the forum
Have a go, you can’t break anything and you will learn a lot
When you get stuck search the forum before asking for help
When you really get stuck ask for help

Enjoy, break things and learn

Check:

https://github.com/openhab/openhab-distro/blob/master/features/distro-resources/src/main/resources/rules/demo.rules

1 Like

Boris,
Start small
One rule to switch the light when motion is detected

Look at the tutorials and the rules docs:

https://docs.openhab.org/tutorials/beginner/rules.html

https://docs.openhab.org/configuration/rules-dsl.html

Don’t try to bite more than you can chew at start. The rule that you propose it actually quite complex. Start simple and add more functionality as you learn more.