Xiaomi Alarm Rule with Motion Sensor and Gateway

Hi everyone,

First of all I am 100% begginer on the openhab world. Installed OH2 before 3 days on a Raspberry Pi and yesterday I managed to enable two Aqara Wall Switches on my Google Home app. So I am totally new and I have no experience on scripts.

I installed on paperUI the Script add-on and I am trying to figure out how I will make the scenario below:

  1. A switch which will trigger the “Alarm” scenario (ON/OFF)
  2. Motion sensor to trigger the Gateway sound “alarm”
  3. Gateway “alarm” (or motion sensor in this case) will trigger all lights in my house

From those three above the hardest part for me is the first. Can I create a switch like this and how I can do that?

Any help will be highly appreciated!

Thank you.

Did you install the binding and find the things and items?

Yes I found all the things and the items are set. The rule is something that I totally miss.

It’s called a proxy switch, create the switch and use it in a rule.

Example item:

Switch Proxy_Motion "Motion Switch" <light> ["Lighting"]

Example rule:

rule "Auto ON Garage Motion Detection after One Hour when Garage is Open"
    Item Proxy_Motion changed from ON to OFF
    if(startMotionTimer === null && Proxy_Motion.state == OFF){
        Echo_Plus_TTS.sendCommand('The garage motion suspended for one hour')
            startMotionTimer = createTimer(now.plusMinutes(60)) [|
                Echo_Plus_TTS.sendCommand('Garage motion is now on')
                startMotionTimer = null

I use the rule to turn off the Alexa motion notification (for 1 hour) when I’m planning to be moving around in the garage and don’t want the constant message.

FYI, I could also use the expire binding with the proxy switch and not have the timer in the rule.