Motion Sensor + Lights Issues

I am a newbie to Hubitat and have ran into two issue with my motion sensors + light strips.

The first issue comes from my rule sometimes not working. Here is my rule, as well as a log of my rule not working:

You can see that a bedside switch was double tapped. This turned off the Bed Light Strip, just like I wanted. I then have a rule that when Jordan's Motion Sensor is active, the Bed Light Strip turns on, IF the lights weren't already on. In the log, the rule states the Bed Light Strip is on. This isn't the case, as the log shows that the Bed Light Strip was turned off.

I have checked the device on Hubitat and it says the Bed Light Strip switch is on. It's not on, however, as confirmed from my button double tap and just looking at the lights. Any idea what's going on here?

My second issue comes from the same rule as above. The rule states that after a minute of inactivity, the light will turn off. Occasionally, the light won't turn off however. I haven't seen the log on this, but all I can think of is the motion sensor won't trigger the inactivity, as this should be the only thing preventing the light from turning off.

Other info:

  • My LED strips are from Kasa (KL400L5)
  • My motion sensors are from Sonoff (SNZB-03)
  • I installed four Zigbee repeating smart plugs from ThirdReality two days ago. I have followed the procedures from the "How to Build a Solid Zigbee Mesh" and nothing seems to be going offline now. Also, if someone knows how to get the plugs to stop reporting power, even thought I have the "Enable automatic power reporting" disabled, that'd be great.

Let me know if you need more info. Thanks!

The log does not show this. It would say “Bed Light Strip is off” in the logs. What app contains the bedside switch rule? While it might have turned off the strip in real life, the event was not registered in the logs and this is why your motion rule did not work.

Thanks! I'm using the Rule Machine app. Just to confirm, the "act: Turn off Bed Light Strip" doesn't mean the Bed Light Strip is off?

Correct. Go into the devices tab and select the Bed Light Strip. Once there, select events at the top and you would see if the strip actually got the off command.

In the logs, it would look like:


dev:1012023-09-22%2008%3A03%3A25.698%20PMinfoChloe's%20Lamp%20(Hue%20Bulb)%20switch%20is%20off

Looks different than yours but still states on or off. I triggered this log by activating the rule. Rule worked exactly like I wanted.

I'm not sure why it works sometimes and not others. Maybe a connectivity issue with my light? I'll try repairing and see if that helps. Appreciate the help btw.

I looked again at your first post. What is the polling rate for the Kasa light strip? As that is a local poll device, its status will not update right away. I think the default is 5 minutes, which is how long it will take for Hubitat to update its status. This would definitely cause the issues you are having.

pollInterval is 30 minutes. I can reduce this down to one. This sounds like the issue! I will reduce it to one minute and that should hopefully work :slight_smile:

Still having issues. Here is my log for my second problem:

Per my rule, after "Wait for event: Jordan's Motion Sensor motion inactive and stays that way for: 0:01:00", the Bed Light Strip should turn off. In my log, the "Off: Bed Light Strip" action is skipped. This results in my light staying on.

Secondly, I reduced my polling interval down to a minute. The device polls every minute now, however it doesn't correctly poll the switch status. The device will say it's on after polled, when it is off. I found out when I hit the Refresh button, the device switch status corrects itself. I've added a a "Refresh: Bed Light Strip" to the top of my rule and it seems to be working.

Between the motion sensors dropping off the network (this thread: Devices Dropping + Various Other Troubles - #12 by MapexNJD) and my rules struggling to work, my Hubitat experience has been quite frustrating...

Your Wait for Event is being canceled becsiee your rule was re-triggered (that is how waits work if you don't know; see: Rule 5.1 | Hubitat Documentation).

From what I can see, you never shared you entire rule, only your actions. The trigger events (and required expression, if used) are important pieces to know when troubleshooting a rule, so I would suggest that.

2 Likes

You’ll want to modify your rule slightly to prevent it from re-running. Try adding the following:

Required Expression: Private Boolean be true

Then in actions, have your first action after the if to set the Private Boolean to false. Your last action before the end-if should set the Boolean to true. This will keep your rule to only one instance at a time.

1 Like

Thanks for letting me know. Here's my rule here. Does this include everything?:

Thanks for this. Here is my updated rule with the Boolean. Did I do this correctly? Looks like I need to look into the rules more and get comfortable with them.

Also FYI, I have two of the same rule in my Hubitat. One is triggered from my wife's motion sensor. One triggered from mine. Wonder if this is causing issues?

In my similar actions for my Den's motion sensor, I put the END-IF before the WAIT FOR line. The trigger's IF made sure the light was set as desired, the IF condition was dealt with (End-If). Then the trigger just waits for inactivity until carrying on. (In my case a private boolean isn't necessary)

FWIW

1 Like

The updated rule will work as long as you have a required expression of the Private Boolean being true. The rule will only run one time until the Boolean gets set back to True.

As for having a rule for your wife's motion sensor, that would not be an issue as long as you have the same Private Boolean in her rule. Basically, this would allow for only one of the rules to be active at any given time.

Finally, if you wanted to condense everything down to one rule, I would look to combine your two motion sensors into one virtual motion sensor via Zone Motion Controller | Hubitat Documentation. Create a motion aggregation zone of the two motion sensors with a time out period of 1 minute. You could then take this new virtual sensor that is created and plug it into one rule with the same required expressions, triggers, and actions. Only difference would be that you would not need a "Stay that way for..." since the timeout on the virtual sensor is set for that. You would just need the virtual sensor to become inactive.

1 Like