Rule Machine Version 1.7 Released

This could be pretty hairy to implement. Are there certain types of devices for which doing this is key for you?

Hereā€™s my scenario: I have a lifx bulb in my living room that turns green when my garage door is opened, then turns off when garage door is closed. Then a few hours later, when my wife wants to read a book in the living room so she turns that light on. She unfortunately gets the green color because that was the last color on. She wanted a normal white color.

Is there any way to default these bulbs to turn on white no matter what hue they were on at before?

Similar situation for me. Have a bunch of hue bulbs and lights doing various colors, temps, etc. for ambient and decorative purposes. A couple of the Hue Iris lamps are also programmed to turn on red when a door is opened and off when the door is closed. However, the functionality I really want is door open = on/red & door closed = lamp previous state. If the lamp is off when a door opens there is no problem, but if the lamp is already on then the open/close routine clobbers the lampā€™s prior state.

@eric182, @Benji,

Sounds like lighting is the main thing, especially color.

2 Likes

Use IFTTT for color alert, works so much better. Mine blinks blue when garage opens, red when motion at the feon door. Anyway, to reset the light you can set a color you want when your wife turns the light on, just put a delay in rule. I am using that with my hue bulbs and works.

I just setup a couple rules for this the other day, im in the process of getting rid of pollster. So far its been working perfectly. I created a two polling scenarios, one for home and the other for night/away. Just create a momentary button tile, use ā€œonā€ for that button as a trigger, i used modes for my conditons and rule. Actions for true would be delay by however many minutes you want (i use 10 min for home and 30 min for night/away), turn on the momentary button tile and your custom command of poll() on nest thermostat. This will cause a polling loop of whatever minutes you choose. I can post a screenshot if you want.

1 Like

Something ugly happening here. Iā€™ve got a three-buton controller that worked fine yesterday. Now when I press Button 1, I get java errors and it shows each of the three buttons pressed. This is with 1.70/1.7.4a


2f8b7d83-445d-4e80-a350-c7c438e552bb 6:59:11 PM: error groovy.lang.MissingPropertyException: Exception evaluating property ā€˜1ā€™ for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: 1 for class: java.lang.String @ line 1700
2f8b7d83-445d-4e80-a350-c7c438e552bb 6:59:11 PM: info Button 3: Buttons button pushed
5317b17b-3e35-4263-b199-23c8aa19c652 6:59:11 PM: error groovy.lang.MissingPropertyException: Exception evaluating property ā€˜1ā€™ for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: 1 for class: java.lang.String @ line 1700
5317b17b-3e35-4263-b199-23c8aa19c652 6:59:11 PM: info Button 2: Buttons button pushed
56e48f57-8808-4252-a228-59b2b57a4da0 6:59:10 PM: error groovy.lang.MissingPropertyException: Exception evaluating property ā€˜1ā€™ for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: 1 for class: java.lang.String @ line 1700
56e48f57-8808-4252-a228-59b2b57a4da0 6:59:10 PM: info Button 1 - 78F for One: Buttons button pushed
b7c6e645-99e5-4177-a2c7-41984b82ff93 6:59:09 PM: debug Parse returned Buttons button 1 was pushed
b7c6e645-99e5-4177-a2c7-41984b82ff93 6:59:09 PM: debug Button 1 pushed
b7c6e645-99e5-4177-a2c7-41984b82ff93 6:59:09 PM: debug Parse description catchall: 0104 0006 01 01 0140 00 45A6 01 00 0000 02 00
6:59:06 PM: info Waiting on eventsā€¦

Sounds like the change I made to support ZWN-SC7 may have messed you up. Could you revert to version 1.7.2 and report if that works?

That would be the last commit to Github on Feb. 1. Click on History, then that commit, then View.

What is the device type that you are using for the button controller?

I backed out to Rule 1.72, and it works as previous.
Iā€™m using a ZBWS3. Itā€™s my Wife button: ā€œHoney Iā€™m chillyā€- ā€œOh, just press Button 1, Darlinā€ (turns the Ecobee up one degree for one hour).

Can you do me a favor, and remove the comment marks from line # 1631, which should have a log.debug on it. Then, save and publish. Turn on Live Logging in the IDE, and when you press a button, that Rule is going to write something to the log from that log.debug. Iā€™d really like to see that!!

Iā€™m pretty certain most of the use cases for this functionality would be lighting and indeed as you say, colour.

Like @jkeith00 I have exactly the same scenario except with a garage door in that when my outdoor lights turn on at sunset they have a specific colour @ 10% (usually seasonal related) set with one rule, when I open the garage door I set them to white @ 100% with a second rule and then I set them back to the colour I had them set to before @ 100% with a third and final rule.

I also set my front door light to white @ 100% when my Ring Doorbell detects motion (through IFTTT), of course I then reset it back after a set amount of time, thatā€™s another two rules.

You can quickly see how the rules build up and how easily a ā€˜revertā€™ function could reduce them.

[quote=ā€œ2l82try1, post:26, topic:37355ā€]
Actions for true would be delay by however many minutes you want (i use 10 min for home and 30 min for night/away), turn on the momentary button tile and your custom command of poll() on nest thermostat. This will cause a polling loop of whatever minutes you choose. I can post a screenshot if you want. [/quote]
Hey, thanx for posting this! It seems self-evident in retrospect, but it had never occurred to me to use a delay on the button that activated the custom command to create a loop. It works perfectly! Like you, Iā€™m using a shorter delay for Home, and a longer one for Night/Away. Itā€™s combined into one rule - Home for the True condition; Night/Away for False.

Version 1.7.5 Released

This version addresses scheduling issues in SmartThings. See this post:

Rule github: https://github.com/bravenel/Rule-Trigger/blob/master/smartapps/bravenel/rule.src/rule.groovy. Save and Publish for me.

Ahh this is a great idea!

Can you post a screenshot? I have it working, but it seems to only loop 3 times. Here is what I have:

ā€œNest Auto Updateā€ is a Momentary Button Tile in which I have in the trigger set as a ā€œSwitchā€ and the trigger is when it turns on. Im using "Turn onoff these switches after a delay (default is off) I have it turning on after the delay. Minutes of delay is 10.

What am I missing?

Thanks for the help.

If itā€™s running 3 times and then stopping, that is a platform issue. When it quits, go into the IDE / My Locations / List SmartApps / this rule. It shows itā€™s scheduled jobs and past job executions there. That might shed some light on whatā€™s going on.

I have mine setup to delay the entire rule and only ā€œturn onā€ the momentary button tile. Hereā€™s how I have mine setup.

I hope this is the right place for a question about creating a rule.
I have a bathroom with a Smart Switch, a Motion Sensor, and a Open/Close Sensor.
The Open /Close is on the toilet.
I want the light to come on with motion, and remain for 1 minute after no motion.
If the toilet is open then it will keep the light on, once the toilet closes it goes back to the 1 minute countdown on the motion sensor.
Then, if someone turns the smart switch off I want all of this disabled for a period of time, say 5 minutes.
Is this possible?
Iā€™m sure it is, but I cannot wrap my brain around how to do it.
Thanks in advance for any help, your app rocks!

Here is a stab at it. May not be exactly right, but close.

First rule:
Conditions: motion active, toilet closed
Rule: motion active AND toilet closed
Action true: light on
Action false: delayed light off 1 minute, cancellable
Disable switch: virtual switch on (see below)

Motion goes active while the toilet is closed, turns on the light; motion inactive starts timer. If toilet opens (or motion becomes active again), then cancel turn off (light still on); toilet closes, motion goes active, then goes inactive, starts the timer. After 1 minute, light goes off.

For the disable part, you will need a virtual switch.

Trigger 2
Trigger: smart switch off
Actions: turn on virtual switch, turn off virtual switch after 5 minutes

So when someone turns off the smart switch, that turns on the virtual switch, which disables the first rule. After 5 minutes, the virtual switch is turned off, and the first rule is enabled again.

Iā€™m not certain about the first rule, and the assumption that motion will be active again after toilet closes, but it that is correct, then this should work.

1 Like

Thank you very much @bravenel !

Unfortunately, we cannot cancel a timer once itā€™s set, and because of that youā€™ll need to work around a solution like Bruce laid out above.