Motion activated lights rule repeating

I'm having a problem with the repeat action getting stuck and not exiting. Can't figure it out, wondering if a rule machine expert can lend a hand here.

Sometimes I can see the light in that room has turned on by itself or maybe didn't turn off on it's own.

Also, occasionally when I am in and out of a room with this rule, the trigger doesn't activate after several successful attempts. (ie. triggered on when I enter, auto off after I leave, triggered on, auto off, then I enter and the room stays dark). You can see the motion sensor activating, but the command just never happens.

Sensors used Linptech z-wave presence sensor ES1

You'll need to post the logs as well. This will give folks a better chance to spot an issue. My first thought is that Hubitat and the switch are getting out of sync somehow. Does the rule work better if you remove the "command only switches that are on/off"? What type of switch are you using that needs the repeatable action?

1 Like

Also, am I right in thinking the first repeat is happening every 2 seconds with a 15 second delay? Is that what you want? Not sure how that would work...

Light switch is a Zooz Zen71 Switch. I'll try removing that command and seeing what happens. If I remember correctly, it was toggling the switch even when it was on which is why I added that in.

The repeat action was put in because the trigger wasn't turning off the switch every time... I don't remember why I put it on the ON command.

I think I forgot to turn on logging, just turned it on and will post again later. Current logs I have are the following.


I have to apologize for my limited memory on this, but I think the intention was to do the 2 second repeat, then after it turns the light on, to give a 15 second delay before it considers running the second part of the rule.

Starting to see some issue with that now that you pointed it out. I think I need a wait for actions command?

So to be clear, I want this presence sensor to simply activate the light switch and create a delay where it doesn't switch off the light for a period of time. Then after there is no presence detected after that set time.. to turn off the lights

Not to worry, the ideal scenario for most automation is that you set it up and it just works and you don't have to re-visit it....

To me it feels like it is worth taking a step back and writing down what you want the rule to do, just in general, plain English, ignoring any technical aspects, e.g. When I walk in the room I want the lights to turn on, 5 minutes after I leave I want the lights to turn off.

1 Like

You could always try to simplify the rule. See if something like this works:

Triggers:
Motion sensor Active

Action
Turn on light
Wait for Event - Motion sensor inactive and stays XXX minutes
Turn off light

You wouldn't have to worry about repeats or anything like that.

2 Likes

Yea, that was my first approach and it was glitchy.

Here's the logs

I'll try that again and see what happens.. but I know it was just not working for me before. Occasionally I was seeing the lights on all by themselves or off and not activating. Personally I'd rather not have all those repeats anyway.

What does your mesh look like? You might have some Zwave mesh problems that would explain the missed commands.

The sample I provided should work and be significantly easier to troubleshoot.

1 Like

What does my mesh look like? :thinking:

Not sure.. so I did some digging around and I found this,

Is it safe to say that the only devices that are actually allowing mesh are the ones in the "Shared devices"?

Should I turn on "enable mesh" on all devices that have the capability?

On sort of a different topic, but still same... yet different... I also noticed that in logs, this rule shows as "repeating", although it's not and in the rule itself it does not show repeating where normally it would if it were repeating. Not sure if this is a glitch in how the system reports. You can see the last log is yesterday at 8:10pm when it properly removed the code.

Updated rule per your suggestion. I removed the "else" sequence which I found originally suggested in another thread somewhere

Doesn't seem to work, I found the lights on again. Here's the new logs

You are getting the errors because you are using a changed event as the trigger. The suggested rule used an active trigger.

You should try to fix your device issues. There should be no need to repeat commands. Post a picture of your Z-Wave device detail table. Settings → Z-Wave Details.

2 Likes

@bill.d is correct. The suggested rule only used Motion active as the trigger. Personally, I do not use "change" as a trigger. I like my triggers specifically defined. If you wanted to use a rule similar to "change", I would use both Motion Active and Inactive as Triggers, It would be something like:

Tiggers:
Motion Active
Motion Inactive

Actions:
If Motion Active, turn on light
Else-If Motion Inactive, turn off light
End-If

The above sample is very similar to your "change" rule. The actions are the same.

I do think you need to troubleshoot the Zwave mesh to figure out why the light is not receiving the commands.

1 Like

Ah, I can see that now. With the new rule, there's no reason for it to have a changed trigger since inactive isn't even being used as a trigger... and I now it makes sense what that part about "multiple simultaneous rule execution error" means.

At least 020 is a ghost. This list looks like it may be partial - I don't see the CNC2 switch. You need to get it removed as even a single ghost can cause performance problems.

1 Like

There's more..


I'll take a look

All the records without a link in the 'Device' column are ghosts and need to be removed. Since they have neighbors you'll likely need to use an external stick to remove them. You've got several devices communicating at 9.6 kbps and/or with lots of route changes. Those conditions can cause problems too. It's pointed out in the link, I think, but your first part of fixing the issue should be to shut the hub down, unplug it for 30 seconds, start it up again.