Motion turning off lights unexpectedly

I thought that I followed the example in the Rule machine documentation for turning on/off light on motion. For some reason the light is turning off every couple of minutes instead of waiting the 20 minutes of no activity. I would appreciate is someone could let me know what I have wrong.motion The goal here is to turn the light off after 20 min of inactive and if the rule runs again for it to check and make sure the light is currently off before sending the turn on command. I have attached some of the log for the rule here as well.

It looks like you forgot to check the "Cancel?" flag on your "Delay 0:20:00" action, which will mark the action as "cancelable" and make the "Cancel Delayed Actions" step do its thing--stop the rest of your ELSE from running it motion becomes active again before that delay is up (otherwise, the delays will keep piling up and the delayed "off"s will remain scheduled).

In related news, is there a reason you want to use Rule Machine for this? Motion Lighting can handle this with a lot fewer clicks. Nothing wrong with learning; just thought I'd ask!

3 Likes

Thanks for catching the missing cancelable flag. Can't believe I missed that.

I was using Simple Automation but it keep sending the turn on command even though the light was on, maybe when they fix the code to prevent this I will go back to SA. I looked at the Motion Lighting and I don't agree that is has fewer clicks. Having a programming background I fine that Rule Machine is much easier to understand than ML.

I use the motion lighting app and it's not sending multiple on commands for me. My rule:

Log:

2020-09-03 04_59_30-Past Logs

After playing around with Motion Lighting a few times you will get the hang of it.

I wanted to point out that there is another method that is a little more efficient for your rule that has been referee to the KISS method

That might help you squeak a few more Milliseconds out of your response time.

Things did not work as expected last night with my rules so I did some more research on Motion Lighting. Once I learned about how to turn on switches by mode and set modes for Morning, Day, Evening and Night it seems like it will be a good solution. Will be interesting to see what happens tonight.

One question I have on this is that I have two motion sensors which are controlled by separate ML. The upstairs sensor controls a light switch upstairs and light switch downstairs. The downstairs sensor only controls the downstairs switch. If the upstairs is triggered at night it assumes you are going to the bathroom and turns off after 6min. However if instead you go downstairs and trigger that sensor which says to turn off after 20min. Will the switch go off after the 6min specified by the upstairs sensor or will it go off after 20min as specified by the downstairs sensor?

The Motion Lighting rules are not working as planned. In addition the log files show java errors, the lights are turning off after 1 minute. Here are the two ML rules that I have. Since it is currently Evening Mode the lights should not be turning off at all.


Looking at the Location and Modes in settings it shows the current mode to be day which is not correct. Attached is also my Mode Manager settings.
Capture3

Looks like multiple things are going wrong. Also attached are some of the logs which I put into Excel to make it easier to read. There is a lot of action that is not needed in addition to the lights turning off after 1 minute. Whey setting colorTemp, dimmers null when I am not using dimmers nor anything with a colorTemp.

It’s bedtime for me, but in case you’re still working on this:

  1. You have to set this up in a way that the ML instance that didn’t turn on the lights, is told they are on (or off) because it isn’t checking. The area in ML with “switches to turn lights on”, “switches to turn lights off”, and switches to disable ML will be your friend here. You can create virtual switches that are turned on and off by ML.
  2. Mode manager is obviously not working right, since the mode in settings is the mode the hub is on. Check the Hub’s time in settings and update it if it’s incorrect. If it’s correct, just delete Mode Manager and reinstall it again. I’ve seen this happen before, but only when I was changing around times often as I figured out the right schedule for my setup.
1 Like

The goal here is quite simple but I think that going back to Rule Machine is the best solution to keep with the KISS approach.

Upstairs Sensor

  1. Between 22:30 – 03:30 The upstairs sensor will turn on the Fireplace light and TV Room light then turn off 6 min after motion ends.
  2. Between 03:30 – Sunrise the upstairs sensor will turn on the Fireplace light and TV Room light and leave on.

TV Room Sensor

  1. Between Sunset – 22:30 turn on TV Room light and leave on
  2. Between 22:30 – 03:30 turn on TV Room light and turn off after 20 min
  3. Between 03:30 – Sunrise turn on TV Room light and leave on.

In all cases if the light is already on do not send the command to turn it on again.
Here is the Rule Machine rule I have now, I will have to wait till tonight to see if it works as intended.
r1
r2

Yeah, I use Rule Machine for sensors, etc. and Simple Automation for scheduling, etc. I found the security app useless for me as well. I wish they would release sourcecode for some of their Apps so they could be improved.

Yeah, just use delay instead. It always works right once triggered.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.