Why do rules stop working so often?

I have to admit this is getting pretty annoying with my motion lighting rules being so sensitive to ANY deviations. So long as I create a rule to turn a light on with motion, and never touch anything else, it works reliably. But try to turn that light on manually and turn it off, or so much as look at the hub wrong and the rule doesn't work anymore. The logs are a joke and tell you nothing.

Delete the rule, and re-create it exacty the same way it was before, and maybe it lasts a day, or a week, but eventually it dies again.

Add that to hub freezes, and this thing is burning up my spare time like nothing else

Am I missing something?

Can you post a copy of your rule? Maybe there is something in the Architecture of the rule that could be done a little differently to make it more reliable.

It couldn't be more simple. When motion sensor trips, turn on this light. I just tried it again. Deleted the rule, re-created it. Tested and worked. Then manually turned the switch on, then off from the dashboard, and then trip the sensor, and the rule gives you the middle finger forever after that.

How exactly does it deal with manual intervention? Because I noticed the same thing with a lock. I have a rule set to lock the door if it's in "night mode"; and it does JUST when night trips. But if you manually unlock it, it will stay open all night. Isn't the hub supposed to do checks and say, "Hey, this lock is open and it's night mode. I need to lock it"

Should I have to create yet ANOTHER rule to deal with the door being unlocked manually? Doesn't seem very smart to me.

Is the "basement switch" a non zwave plus by chance? If so, it won't reliably update it's on/off status. Motion lighting wont send the on command if it thinks its already on. You can also check the app state for your rule too. I have a couple older non zwave plus switches and experience what your describing from time to time.

1 Like

I had a non Plus Zwave device and experienced the same. Polling helped but my solution was to swap the switch to an outbuilding where I had a GE Zwave Plus dimmer. At some point I will replace the switch but at the moment where the switch is won't cause me grief.

Your lock rule just needs more conditions. If lock unlocked AND Door is closed AND mode is night. Otherwise the rule only evaluates when the mode becomes night. This way the rule executes whenever the door is closed and unlocked at night.

Hubitat like most HA products is only as smart as you make it.

@pgitta - I think you might be misunderstanding how these basic automations are designed to work. Generally speaking, rules fire when an event takes place (e.g. when the mode changes.) They do not continuously check for things like manual switch changes. You have to account for each possible change/event and come up with an action. If you want to handle each and every possibility, you’ll need to use Rule Machine and learn to write rules. Apps like Simple Lighting and Mode Lighting are basic apps that can handle straightforward automation needs very well. However, if you want to handle every scenario possible, that’s going to take a lot more work and testing of your rules.

4 Likes

Sorry to say it but I been with problems with motion lighting for months, same simple rule like the one posted but 5 minutes delay, sometimes works, sometimes doesn't. Doesn't matter if is a z wave plus, non plus(with poller), zigbee Sengled color bulb, zigbee Iris plug, Yeelight color bulb or some magic home wifi led strips the rule will fail with no errors in the logs, sometimes I had to delete the rule and re create it to make it work again. I think this is the only issue I have with HE, everything else been very good.

I’ve got weird issues like this too.

I’m still investigating. One of which I’ve moved my Lutron hub yesterday to the center of the house to address one light switch. The Lutron app thinks it’s off too but yet the light remains on every once and a while. I’m thinking signal issue.

Yesterday I had a problem with a rule taking action on being away.... I’m still investigating and I’m not sure if it’s Hubitat at all.

Sounds like the issue I've had with motion lighting. Once in a while, it won't do anything the first time despite the change in sensor state appearing in HE just fine (this is with wired motion sensors through Envisalink). When it fails to turn on the lights and once motion stops, if I wait longer than the auto-off time to trip the motion sensors again, it works fine.

Here is a question: Do you sometimes operate your lights with switches outside of ML? Like in leaving the room and hitting the button? This needs to be setup correctly ML otherwise ML has no idea it was turned off and that can create the problem you are describing

Nope! I originally used it to control three peanut switches. Now it controls those plus a caseta dimmer and switch. The only means of turning my basement lights on or off has been motion lighting.

Why would this be relevant if you're using a smart outlet? If the outlet is in an off state, if the motion is active it turns the lights on.
Now the lights are on.
If you were to turn the switch off with its button, the state is once again "off". Now why wouldn't The hub just turn the switch back on when it detected motion again? It makes no sense to me

In other words, it seems to me that if you stood next to the switch dancing around and continually turning the switch off, the lights should essentially be flashing on and off with the rule fighting you to keep them on.
Any other outcome means "rules" mean nothing.

That’s not how things work in Motion Lighting. It turns on the light only the first time motion is seen. Until motion is inactive for the complete timeout, and it turns the light back off, it will not turn the light back on.

If you want the behavior you’ve described, you’ll need to use Rule Machine. Use both motion “changes” and the light switch “changes” as your triggers. The write the conditional actions as you see fit to control the lights.

Because the ML app is designed to not turn on lights that it thinks are already on. So, if you're going to turn the light off outside the app, you need to allow the app to be aware of this. There is an option in the Options for Off that does this, where you tell it what switch will turn the lights off.

Without this feature, the app would be sending on commands every time motion went active but the lights were already on. That is a lot of extra traffic on your mesh network, best avoided.

If you want the behavior you describe of fighting on and off, then use a Rule Machine rule fired by motion active. You can get that result, if that's what you really want. Such a rule would send an on command for every motion active event.

1 Like

Okay, I think I understand that, but that doesn't explain the problem I and others have posted about how the lights just stop being turned on with motion at random. In my case I notice it more if I dare to deviate the slightest from leaving it all on automatic. In other words if I turn the switch off and back on manually or something like that, most of the time the rule just never works again until I delete it and recreate it

I guess I sort of digressed into a discussion of what happens when the switch is turned off etc etc. my main original problem still exists. The rule just stops working.

I suspect there may be a bug somewhere where as you say, he thinks the switch is already on and refuses to send the command ever again.

Please, could you post a screenshot of this option? Maybe this is my issue, I'm not sure.

The next time this happens look at the device page in the UI and see what state HE thinks the light is. Also look at the events. This should give you an idea if HE thinks the light is on and therefore does not send another on command.

What matters usually is what state Motion Lighting thinks the light is in. This can be found on its app status page, Application State, variable named "on". If true, it thinks the lights are on.

@vjv

This is very strange, and might be indicative of a light switch that is not properly reporting physical status changes to the Hubitat Hub. What brand/model of switches are you using? It is well known that early GE/Jasco Z-Wave (the non-Plus variety), as well as some Leviton Z-Wave switches, do not properly report physical status changes to the hub. This can cause the hub to believe a switch is in a different state versus the actual state of the device. As you can imagine, Hubitat Apps are written for well behaved devices, and thus a device that does not report its status reliably will cause problems like those that you are describing. I grew weary of these old switches and dimmers and decided to bite-the-bullet and bought Lutron Caseta devices to replace all switches, dimmers, and fan controllers in my home. Everything 'just works' now, and I really like having a dedicated lighting controller in the form of the Lutron SmartBridge Pro2. If has great local LAN integration with Hubitat, as well as having native integrations with Amazon Alexa, Google Home, Logitech Harmony, SmartThings, Apple HomeKit, etc... And, it always 'just works', thereby exorcising the types of gremlins you might be having with your switches/dimmers.

2 Likes