Need Help with Simple Rule Machine Logic for Motion Control of Lamp


(Bill Allemon) #1

I just installed Rule Machine for the first time and am having trouble with a relatively simple task.

I have a OSRAM bulb and would like it to turn on using my motion sensor (I’ve got that figured out), but would like it to also turn off if there is no motion after 10 minutes or so. In other SmartApps, there is usually a delay function. I’m not seeing that in Rule Machine.

Do I need to make two rules? One to turn the lamp on and other to turn it off, or is there a setting/feature that I’m not seeing?

Many thanks in advance for the help.


(Bruce) #2

Try this:

Condition: motion active
Rule: motion active
Action true: turn on light
Action false: turn off after a delay of x minutes, cancellable

When motion goes active, the light turns on. When motion goes inactive, the timer starts. If motion happens before the timer run downs, everything starts over. The light will turn off when motion is inactive for x minutes.


(Bill Allemon) #3

Of course, as soon as I post this question I find the answer.

For the benefit of others, there’s an option called “Tune on/off switches after a delay” which I didn’t see at first. :sunglasses:


(Bruce) #4

Yes, but you need Turn on/off after a delay, cancellable. The other one turns it off no matter what.


(Bill Allemon) #5

Thanks for the continued support and quick responses, Bruce. This is the first SmartApp I learned how to install and it’s awesome. Thanks for putting this together for us. :+1:


#6

I’m trying to do something similar, but can’t quite get it: I have a light and an Aeon Labs multi sensor. I was using SmartLighting to turn it on and off, but for some reason, SL keeps turning it off even when there is motion. So I figured I’d give Rule Machine a try. I set it up like this:

Define Conditions: Kitchen Sensor active
Define a Rule: Kitchen Sensor Active
Action for True: On: Kitchen Lights
Action for False: Delay by 1 Minute [Cancel] / Off: Kitchen Lights.

It turns on and off fine, and if I stay in the kitchen, the light won’t turn off. So that’s good. But, if I’m in the kitchen, and stand still for awhile so that the sensor changes state to “no motion”, and then, before the 1 minute is up, I move, turning the sensor state back to “motion”, then when I leave the kitchen at later time the light never turns off.

Can’t figure out what I’m doing wrong. Seems relatively straightforward.


(Bruce) #7

There has been a lot of this going on recently, which appears to be scheduling issues with the platform. I’m seeing the same things, with some motion-off actions never happening.

You should turn on Live Logging and watch this Rule as it changes state.


#8

Are you saying it’s supposed to work correctly, but there’s something wrong server -side?


(Bruce) #9

Without seeing exactly what you have set up, the answer is yes.

There have been issues with scheduled events in the platform, and motion off after some time needs a scheduled event to fire. If it doesn’t fire, the lights don’t turn off.

The only thing odd about what you reported, is that is should work most of the time.

You should turn on Live Logging in the IDE and watch this Rule as it changes state.


#10

Here is the log from this morning for “Kitchen”, which is the name of the SR rule. I went into the kitchen and the lights turned on. I went out, the motion sensor went inactive, and then I went back in a couple of times. Now the lights are on and they aren’t turning off. There is an error at 10:01:16, but I’m not sure what it means:
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:02:29 AM EST: info Kitchen: Kitchen Sensor motion inactive
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:01:16 AM EST: error java.lang.reflect.UndeclaredThrowableException @ line 1521
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:01:16 AM EST: info Kitchen: Kitchen Sensor motion active
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:01:11 AM EST: info Kitchen is False
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:01:11 AM EST: info Kitchen is False, but delayed by 1 minute
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:01:11 AM EST: info Kitchen: Kitchen Sensor motion inactive
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:00:50 AM EST: info Kitchen is True
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:00:50 AM EST: info Kitchen: Kitchen Sensor motion active
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:00:35 AM EST: info Kitchen is False
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:00:35 AM EST: info Kitchen is False, but delayed by 1 minute
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 10:00:35 AM EST: info Kitchen: Kitchen Sensor motion inactive
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 9:59:52 AM EST: info Kitchen is True
88eb575e-65cb-40a2-9a5d-e47adeaea8fd 9:59:52 AM EST: info Kitchen: Kitchen Sensor motion active


(Kevin) #11

I had this same issue & fixed it with a repeater the signal was to week on that side of my house. And my issue hasn’t come back, but that doesn’t mean ST isn’t having a server issue either.