Motion sensor not turning on lights

I have a Zooz ZSE40 4-in-1 sensor that has a rule to turn on light on motion after 2200 and before sunrise and turn off 6 min later only if between 1000 and 0400 otherwise leave the light on. It has been working intermittently and this morning it did not trigger when I got up even though I could see the red light blink indicating motion. About 11 min later it worked as it should.

Looking at the log I see that the sensor is active many times when there is no motion which I think is why the lights are not turning on since the trigger is set for sensor to be active. Not sure why the sensor will be active when no motion or what I may have wrong in my rule.

Two ideas:

  1. Could your battery be low? Spurious motion events are something I've seen on a lot of my sensors when in such a condition (actually, it's mostly just the Iris v2 sensors that seem to do this; I had a Zooz battery die recently and it just stopped reporting and I don't think went crazy before that, but I'm sure it's not out of the question for any device)

  2. Was the time around 2:00 AM? If so, that is when the hub performs its daily backup and maintenance tasks, which may slow it down a bit. If your automation was simply delayed but otherwise worked as expected, that could be why.

With regards to your second paragraph, a motion event should trigger your rule that has this as a trigger, regardless of whether the event was real or spurious (but depending on how it's set up or what app you're using, it may need to go inactive first, so if that's not happening, then maybe). If you feel comfortable sharing the rule--especially if it's Rule Machine or something you may have questions about (Simple Lighting and Motion Lighting apps are sometimes also called "rules" but are a lot easier to set up)--feel free to do that as well.

I had this problem until I discovered the Zigbee connectivity was not strong enough. I have a regular Zooz On/Off switch paired with Hue Outdoor motion sensor.

Solution:
Bought a Peanut Power plug (as a repeater) and connected it half way between the sensor and the HE hub. Problem is gone ever since.

Look under Settings --> Zigbee Details --> Zigbee Logging

I am now getting a solid reception of lastHopLqi:255, lastHopRssi:-59

Did you look at the log for your app rule? I had problems with the "Don't turn off if already on" option in Motion Lighting. When I looked at the logs for the app rule I could see it was't turning the light on because it thought it was already on . . . .

I have attached my Rule Machine rule. Rule

Looking at the logs I am finding multiple entries every time the sensor goes from active to inactive. At 00:10 the sensor went active upon motion and turned on the light, then 6 minutes later it turned off just as expected.

At 05:32 the sensor logs active but the light did not turn on and the sensor went inactive. However at 05:43 the sensor went active again and this time turned on the light. I do not know why it did not work the first time.

The battery is 100% and the sensor is only about 20' from the hub.

You're rule has multiple problems: first, you probably want it to turn the lights off six minutes after motion becomes inactive, not six minutes after it becomes active. That way, it will remain lit if there is continuous motion. Second, with any rule, your actions run any time a trigger fires. Delays are not cancelled when it runs again; they'll just pile up unless you explicitly address them. Therefore, you're likely getting a bunch of scheduled "off" actions, one from each time motion became active, regardless of what happened in the meantime.

I can suggest a few fixes, but I'd really encourage you to consider first whether Rule Machine is the best option here. Two Simple Lighting child apps--one for on, one for off (since your conditions are different)--would handle this with ease and probably execute a bit faster since that's a smaller app. If you're trying to learn RM or want to do some crazy with this rule later, that's another story.

I thought by having the condition to check if the light was on that it would prevent the rule from running and preventing multiple delays.

Ah, I missed that check. That is probably true, assuming you don't turn the light off and it also accurately reports its state, but it's still probably not the best way to do this and I'm not sure you want the lights to turn off after 6 minutes regardless of whether there is still motion.

I'd strongly suggest Simple Lighting for this, but if you really want to try it with Rule Machine, something like this is how this kind of thing is usually done:

Triggers:

Hallway sensor *changed*

Actions:

IF (Hallway Sensor is active) THEN
  Cancel Delayed Actions
  IF (Time between 22:00 and Sunrise) THEN
    On: Fireplace Light, TV Light
  END-IF
ELSE
  IF (Time between 22:00 and 03:30) THEN
    Delay 0:06:00 (cancelable)
    Off: Fireplace Light, TV Light
  END-IF
END-IF

This will turn the lights off 6 minutes after motion goes inactive (that's when the condition for the ELSE is met: the opposite of the IF, active, is inactive) if the time condition is met. Note the "cancelable" flag set on the delay, which will cancel both the delay and everything after it when "Cancel Delayed Actions" is run. Also note the proper closing of each IF with an END-IF: you're missing those above, but since they're the last things in the rule, RM infers them for you, but here at least some of them matter.

Hope this helps!

Battery reporting isn't always accurate (though 100% is usually promising), and that's a reasonable distance from the hub but without RF vision you never know what obstacles could be blocking a signal in one direction or the other. Just some things to consider, though likely not a problem here.

Looking at your sensor's logs to determine if the motion events you expect to see really happen is what would help troubleshoot whether the problem is the device or automation, though there are likely problems with the existing automation and the above may help those.

I have looked at the logs and it shows the sensor going to active but the light does not turn on all the time. Sometimes it does and others it does not, when I test it the rule runs correctly. For what ever reason when it runs at night it is not consistent.

Your recommendation for creating the RM rule looks good, however I am unable to figure out how to enter this in the RM app. I really would like to learn how to use the app to enter nested if-then-else. In the mean time I am going to try the Motion Lighting App. My settings for this are as follows, not exactly sure this is correct but will see what happens tonight.
Rule2

The Motion Lighting App as I have it defined turns off the lights when I do not want it to. I read the options to mean that this rule will only run between 2200 and Sunrise, yet at 20:20 it turned off my lights.

You enter nested IFs in Rule Machine the same way you enter a single IF: when it gets to that point in your list of actions (I recommend building your rule in order line-by-line since you already know what it should be), for "Select Action Type to add," just select "Conditional Actions" and choose "IF (conditions) THEN." The END-IF action is also found under that same menu (though not until you add an IF).

Your ML app as configured will only turn the lights on between 2200 and sunrise but will turn them off any time except between 0330 and sunrise. You can use it to turn off lights that it didn't actually turn on in this way. Two Simple Lighting automations as I suggested above have much more naïve restrictions and could handle this, but I think you could do it with ML if you changed it to "don't turn off between 03:30 and 22:00" instead (correct me if I'm not thinking about your desired outcome correctly).

I created the two Simple Lighting automatons as suggested to turn on two lights but only one turned on at first motion. Then the second one turned on after the automation was triggered a second time. The automation and log file is shown below.

Honestly not sure what could be going on there. Have you verified that both TV Light Switch and Fireplace Light Switch consistently respond as expected when manually turned on/off via the device page? And do they reliably update their status to the hub when you perform phyiscal on/off events on the switch (I don't actually think Simple Lighting cares about that but it's probably good to know anyway)? What kind of devices are they?

I don't see any glaring issues with your setup. :man_shrugging:

My sensor is a ZooZ ZEN40 4-in-1, my bedroom switch is a ZooZ Zen27 dimmer, and I have 4 ZooZ zen26 switches. In addition I have a Aeotec WallMote and a Aeotec Smart Switch. Not a very large zwave network compared to others that I have seen. All lights will turn on/off correctly when I use the WallMote, turn on/off via the device or dashboard, and also if I use time based automation. It is only with the motion that I have problems.

Interesting. Your dimmers are new enough that status reporting shouldn't be a problem, not that I'd think it really matters here. The only thing I can think of is that your motion sensor reports two "active" events right in a row (some do because they send motion reports in two ways and the driver interprets both; since there is a dedicated driver for this device, which I assume you're using, they could probably "fix" that, though it's generally not problematic). Maybe something is getting messed up when two of your rules/apps fire so quickly right in a row, though I'm again not sure--the worst that should happen is, for example, the lights get an "on" command twice, again generally not problematic.

Maybe try this: create a Zone Motion Controller child app just for this sensor (I guess "motion aggregation" would be the best zone type). Use this "virtual" zone motion device in the automation instead to see if that helps. My hope is that the virtual device would only create one "active" event no matter how many times the Zooz reports it in the meantime, so that is one way to see if this "bouncing" effect is really the problem.

I am using the driver that HE installed when joining the device. I assume from your comment is that I should install a dedicated driver which I need to first download and install.

No, HE's native driver is specific to this device, and that's all I meant (they should probably fix this issue, though...people have been noticing issues like this with contact sensors and whatnot but I'm not sure if this one is on their radar).

Anyway, the second half of what I was saying is to use the (also built-in) Zone Motion Controllers app to create a "virtual" sensor, but only use this device when you're creating that zone (you should be able to figure out what I mean once you're in the app--"Motion Aggegation" is again probably the best zone type to choose). It's really meant for combining multiple sensors into one for any of a few different purpsoes, but it should also work fine just for this one, and assuming it "debounces" the sensor for you, I'd be curious if that solves the issue with your automation.

Thanks for your help. When I get home tonight I will try to add the virtual sensor and let you know how it goes.

I hate to beat the dead horse but can you share the Zigbee reception reading you are getting from the logs? I know you mentioned it was close enough but you never know.

Before adding a repeater, I was getting lastHopLqi: 255 , lastHopRssi: -87 and was experiencing that sort of behavior.

These devices are Z-Wave not Zigbee.