Don’t forget to add the blinking red LED!
Ok so i am completely new to rule machine and pretty much automation all together. I am trying to setup a simple kitchen light with a motion sensor. Here’s what I’m shooting for:
- If motion is detected after sunset then turn on light
- Automatically turn off light after 3 minutes of no motion
- Disable motion activation if the physical switch is turned on
How would I go about this?
Is the physical light switch within the range of the motion sensor? If so, #3 probably won’t work.
No it is blocked by a doorway so if I turn the switch on the motion sensor doesn’t detect any motion.
Cool. Then this will work for you. You need a rule and a conditional trigger:
Condition: motion active
Rule: motion active
Action for true: turn on light
Action for false: turn off light pending cancellation, 3 minutes
Enable/disable with Private Boolean: set to on
Trigger events: Physical switch on, physical switch off
Condition: light on
Action for true: Rule Boolean for the Rule set to false
Action for false: Rule Boolean for the Rule set to true
The first rule is just a motion activated light, that turns off after 3 minutes. The Conditional trigger does the disabling, by sensing the physical switch turning on or off, and then setting the first rule’s Boolean truth accordingly. Setting it to false disables the rule, so the lights won’t turn off when the timer runs out. Setting it to true, allows normal motion activation.
Depending on the switch, and which hub you have (V1 or V2), there may be issues with the physical switch part. First of all, there could well be a lag between turning on the switch and ST recognizing that event. That problem will be covered most likely by the 3 minutes before motion off wants to turn off the light. The other issue is that the switch has to report an
isPhysical event. There have been issues with this off and on. Easy to tell by looking at the logs for the switch to see if Physical is being reported when you turn the switch on or off.
Is it possible to increment the thermostat by a set amount rather than specify an absolute temperature? Use case is a routine I use called ‘an hour of warmth’ which temporarily sets the thermostat a little warmer than I typically keep it for an hour and then back down to the normal set point. However, depending on the mode the thermostat has different set points and ideally if I ran the routine it would set the thermostat a specified number of degrees higher than the current set point rather than to an absolute temperature.
No, this feature does not exist. However, if you know the setpoints, you could use Thermostat Mode as a condition, and set it based on that, and then back. You would need a separate rule for heating and cooling, a some trigger mechanism for up and another one for down. Pretty messy, but doable.
Ok, thanks. There would be other use cases for this, like if you want to make incremental temperature changes during activities like beer fermentation (another hobby of mine ). I’m sure there are much higher development priorities on your list but it never hurts to mention it.
This feature has been released. See this post:
Bruce this works perfect with my nest thermostat. Glad I spent an hour last night messing around with custom commands to try and adjust the heat by 1 degree, haha. This took less than a min to setup now, thanks for all that you do for the community.
Works flawlessly with my CT100 using a custom device type. Thanks!
Is there any sort of written tutorial on how to get the most out of Rule Machine, or is it just a matter of reading through many threads on the subject?
I’m particularly interested in learning how to set up a convenient way to temporarily disable a rule with out having to delete it and then start over when I want to use it again.
It sounds like the use of the Private Boolean feature might be preferable to the Virtual Switch approach (which I have used), but I’m have some difficulty figuring out the PB approach.
The easiest way to go about selectively disabling a SmartApp, be it a Rule or just about anything, is to restrict it to a special mode, one that you don’t use, one that exists solely for this purpose. You could call it Disable. Then in the More Options section of a Rule, select Only When Mode is and set it to Disable. Then, that rule is toast until you remove the restriction.
If you want to do this programmatically, you could use Enable/Disable with private Boolean, also under More Options. Some other rule could set this rule’s private Boolean to false, and that would disable it, or set it back to true to re-enable it.
I have a virtual switch called “RM Disable” that I use for that purpose. I like that better than using a fake Mode because 1) the state of it is readily visible while the current mode is not, and 2) it’s very easy to turn on/off, again while the mode is not.
I think you misunderstood my post. The current mode or changing the mode has nothing at all to do with this. The mode restriction is just a mechanism that kills the rule without deleting it.
Exactly. And using a virtual switch to disable the rule (“Switch to disable Rule”) works in the same way, yes? And the switch has the advantages that I listed vs the mode, yes?
Options are good. There are lots of ways to do this.
Personally, when I want to turn off a rule, I show it pictures of Hillary Clinton at the beach!
Are there 2 different ways to turn off lights (Actions for False) with motion stop?
I’ve seen the “Delay These Action” with minutes of delay with “Cancel on truth change”
(this is what I have for all my rules now)
…and "Turn on or off these switches after a delay, pending cancellation (default is OFF)
Are both of these similar when applied to a motion sensor in condition and rule?
I have set up a rule (“Front Morning”) to run my outside lights each morning between 06:18 and 07:20: a)on days that I work and b) only when the result of another rule (“SunriseCheck”) is true (see below for both rules).
This morning, the result of SunriseCheck should have been False because the math works out to be negative (I.e., sunrise was too early). But the lights ran anyway. When I looked at both rules, the results of SunriseCheck were still shown as true. I went into SunriseCheck and then hit “Done” - which evaluated the rule and changed the results to False in both rules. The lights then turned off. So although it appears my math/logic is fine, the lights ran when they shouldn’t have because it appears SunriseCheck didn’t run/evaluate on its own.
Edit: I also added a capture of SunriseCheck’s history
So after all that, my question is: Should SunriseCheck have been evaluated because it was called from Front Morning or do I need to add a trigger to SunriseCheck to force it to evaluate before Front Morning runs. In other words, did I miss something or was it due to a Smart Things issue?
Hope that all makes sense. TIA