Rule not working but can't see why

I'm setting up what I think is a simple rule. When I enter my room, and it's dark (e.g. between Sunset and Sunrise), I want the light to turn on. But it's not...

Any ideas would be appreciated.

Thanks,
Paul

I agree this should always be a first step when rules don’t run as intended.

Logging has to be turned on in the rule’s settings page first, though (dropdown menu next to the run actions button in OP screenshot).

1 Like

Ok, thanks. I'll have a look at logging.

I set the Logging on and tried "Run Action" and it worked but it's still not working when it's supposed to be.

The logging is on for that, I believe.

Here's what I get:

So, maybe it's not awake?

That’s a log filtered for the motion sensor device events.

What about the log of the rule itself?

1 Like

Also it seems a little odd that the device logs active events but no inactive events.

Try going to the device’s settings page and see if the sensor clearly goes from inactive, to active, to inactive when you move in front of it then stay out of its detection zone.

That’s the log of the rule actions only. You can enable “events” and “triggers” in the rule logging dropdown menu as well.

But according to that log, your rule is turning the plug on.

I think that logging is on, too, if I followed your instructions above properly.

That seems odd, indeed, and if it matches actual device events, it could be the problem. Check the "Events" button/tab on the motion sensor itself to see what you get. You should see both "active" and "inactive" events for "motion," or at the very least an "active" event when you think there should be one--otherwise there was no motion event, and your rule will never trigger. (This is where trigger logging in the rule could come in handy, but checking here would give the same knowledge.) That is likely a problem with the sensor or driver but not a problem with the rule.

Also, note that your rule is technically missing an END-IF, though it's not related to your problem and RM will infer one just fine in this particular case. :slight_smile: (But it's a good idea regardless.) And if you're only trying to turn on lights with motion, then Simple Automation Rules can also do what you want and is much easier to set up than Rule Machine--especially if you also want to turn the lights off when you're done. But again, not related to this problem...and neither will fix any problem if it's a device or driver issue (which at this point is just a guess on my part, so hopefully the suggestions provided by marktheknife will help you figure this out).

The Simple Automation Rule was working fine. I'd walk into the room and the lights would go on. It's just that I didn't need that all day long, so I wanted the conditional rules that Rule Machine offers, e.g. when it's dark. Am I wrong about that?

I have been struggling a bit with using Rule Machine. I find it's hard to edit things once created. I have deleted the Rule many times to re-do it, thinking I missed something.

How do I put an END to it?

Thanks for everyone's help.

Simple Automations allows you to set restrictions for when the automation will run.

2 Likes

That's helpful. Maybe I'll just go back to the SAR.

I was also trying to explore Rule Machine to learn about it with what I thought was a pretty simple task. I must be doing something wrong.

Thx

Fair enough, just wanted to make sure you were aware of the time restriction options in SA. :slight_smile:

I've used Rule Machine for a few rules, but only use it where I need to, as I find the editing/updating if you have to make a change to be pretty tedious compared to SA, Motion Lighting, and Event Engine (a community app that allows you to make some fairly complex automations using an easier interface similar to SA.