Trouble with motion rule: zwave, expire, aeotec multisensor 6

Hi All,

I was wondering if someone could help me as for weeks I’ve been struggling with creating a reliable rule that works. It works most of the time but is not reliable enough to use to replace a light switch.

I’m trying to create a rule so my light switches on when motion is detected then turns off after a set amount of no activity. Also everytime motion is detected I would like the countdown timer to reset and start counting down again. Once set correctly the light should never go off if someone is in the room.

I have tried lots of different variations of the rule below without success. It kind of works but if for instance I set the timer for 1 min then dance in front of the sensor for 10 min it the lights go off on occasion and in some instances it takes at least a minute for the light to come back on again.


  • Raspberry Pi 3
  • Razberry 2
  • Aeotec multisensor 6


  • Z-wave
  • Expire

What I’ve tried:
I’ve tried a couple of different motion sensors and the Aeotec on works best as that is plugged in via USB.

I’ve set parameter:
3: Motion sensor reset timeout: to 15 seconds
4: Motion sensor sensitivity: Maximum
5: Motion sensor triggered command: Send Binary Report CC


  1. Is the expire binding capable of reseting once a command is sent again? It appears it does kind of work…

  2. Should I even use expire or should I just add a timer to my rule or something?

  3. Is my rule OK?

Any help/guidance would be much appreciated thanks everyone! :wink:


Switch Swi_MSensor_Motion         "Motion"  { channel="zwave:device:zwave:node4:alarm_motion" }
Switch Swi_MSensor_Motion_Proxy   "Proxy"   { expire="1m,command=OFF" }
Switch Swi_Light                  "Light"   { channel="zwave:device:zwave:node19:switch_binary" }


rule "Sensor motion turns on proxy"
        Item Swi_MSensor_Motion changed from OFF to ON

rule "Sensor proxy turns on light"

        Item Swi_MSensor_Motion_Proxy changed from OFF to ON

rule "Proxy expires light"
        Item Swi_MSensor_Motion_Proxy received command OFF 
        if (Swi_Light.state == ON) 
        if (Swi_Light.state > 0) 

I run into the same problem.

In my understanding:
PIR Motion detected
Switch Swi_MSensor_Motion goes to ON
Motion detect time end (15sec.)
Switch Swi_MSensor_Motion goes to OFF

This is the case for my philio PIRs. They are working perfect.

The AEOTEC does not have this behaviour in any case. Sometimes yes, soemtimes no. I tried to override the not reset status OFF with expire binding. But this does not fix it at all. in 50% of the cases a retrigger of PIR is does not change status of switch to ON.

For me it looks like the aeorec implementation is not the best.

I agree that the sensor could be temperamental at times but this is as is expected with any wireless device. However even when I set my expire at 10 minutes it is still not reliable. Therefore even if it does not detect motion all of the time I should still be OK.

For example, if I set the expire to 10 minutes then dance in front of it, the Aeotec sensor will have 40 opportunities to reset the timer back to 30 minutes (with 15 second parameter set) so the light should never go off in this time. That is not the case though.

I wonder if someone could let me know if my rule is as it should be or if there is a better way to achieve what I’m after?

I have that working a couple of places. I know I have your first 2 rules combined into one. I cannot check right now but I seem to remember a command to reset the proxy?

I have also this multisensor 6 but not really troubles.
The sensor is not the fastest but is okay for me so far.

I guess you have the wrong parameter, “detect time end” is the time how long the sensor will ignore motion.
There is another parameter where you can set the time until it will send an “OFF” signal.
So in my rule no need for expiry or anything else, just a simple “ON” (depending on luminosity) and “OFF”.

That is in the proxy Item definition.

No, I meant a parameter:

Just seen that this the parameter @Curtis mentioned above :roll_eyes:

1 Like

I’ve done the same config with the two parameters.

But as I wrote before, sometimes it is working perfect, sometimes not. No OFF is received by teh z-wave switch item related to this channel.

Philio PIR is more relyable here.

Yes I’m not that confident with rules just yet so most of my rules are split so I can get my head around them a bit easier.

Yes my proxy item is reset using the expire binding so that is not included in my rule

Switch Swi_MSensor_Motion_Proxy "Proxy" { expire="1m,command=OFF" }

If you could post your working rule here when you get chance that would be really helpful thanks as I can test :+1:t2:

@Bruce_Osborne is correct, I don’t do anything with the off command of the sensor as my proxy does that for me. When the sensor sends the ON command that is the only trigger I require. With parameter 3 set to 15 sec it should send the ON command every 15 seconds if I’m constantly moving in front of it. Or at least that is what I assume.

Thanks all for helping me with this.

I have altered this ruleto suit my home using Hue lights Aeotec MultiSensor 6 (with default settings) and have absolutely no issues with motion detection for lighting`

I don’t have this device, but I am familiar with many others and what you describe does not sound correct. With this parameter set to 15, the sensor will not send OFF until 15s after it stops detecting motion. I agree with what @chris4789 is suggesting and this is how all my motion automation works. There is no need for timers or expire, since the sensor takes care of this for you.

Have you tried removing expire and setting parameter 3 to the time you want the light to stay on?

Should your sensor remain continuously triggered, the light will always timeout with your existing rule.

Considering different logic:
When motion start detected,turn on light. Set timer off/cancel.
When motion end detected, begin timer.

I agree yes I could make it simpler and have the sensor do the expire job but I would have more control my way. For instance what if I want a switch in the OpenHAB UI to turn off motion detection so the manual light switch then acts normally. Doing it in the parameter would essentially hard code the ability so I could not switch it off once set.

As it stands the sensor sends an on command then an off command after 15 seconds.

I don’t follow you. To disable the automation, just add a proxy Item to the rule that turns the light on and off with motion. If the proxy Item is on, then do nothing, similar to what you have now.

Doh, yep I had a think about my message after I sent it and yes I could do what you suggest. I’ll try thanks. I’ll adjust my rule, will remove the expire and increase parameter the 3 to my prefered expire time.

1 Like

That’s what you think, but we cannot see it.
With the rules sending commands, your events.log should provide an excellent evidence trail of what is sensed, what your rules are doing and when.
A snippet of a dance session would be good.

I have 2 of the same sensors.
The OFF command is sent 15secs AFTER the movement stopped, not 15 secs after the movement.
That’s why a fixed expire won’t work in this case.

To use a fixed expire the timeout has to set to a very small value (e.g. 1 sec).


Try something this…

rule "Sensor motion changed"
    Item Swi_MSensor_Motion changed
    if (Swi_MSensor_Motion_Disable.state == OFF) {

Swi_MSensor_Motion_Disable is the proxy Item for disabling the rule.

:grin: Don’t suppose a video would be helpful too. While dancing and creating some logs I noticed @Spaceman_Spiff post…

This makes soooo much more sense now!!! Understanding this will help me a lot. So I need to look into a different method.