Rule machine natural light

I built this on rule machine to replicate the natural light scene on Philips hue with a motion trigger.

When I hit “run actions” to test my parameters, the rule runs as expected- turns on lights to corresponding color temperature.

However, the rule does not fire on it own after confirming my hue motion sensor is registering motion.

What gives?

Post the rule if you would.

Trying to post screenshots of it but it’s my first time using forum so trying to figure out how to get around “sorry you can’t embed media items in a post”

Ya new users can't right away. Hang in for a bit. @bobbyD can you give him a bump?

Please join the Hub owners - Hubitat to bypass some of the new user restrictions imposed by the platform.

3 Likes

Okay, here goes nothing.


That looks like it should work. I see you have logging enabled, which would be my next suggestion if you didn't. After that, it's to look for entries from this rule on the Logs page to see what you find. Any clues there?

Also, this is not related to your problem, but I'd suggest ESLE-IFs instead of a bunch of separate IF THENs; easier for both you and the hub when you only want one set of actions to run. No need to change anything now, though, since this should be equivalent in outcome and, again, won't cause this problem.

1 Like

Do my lines look adequately nested and all?

I tried looking for ELSEIF but couldn’t figure it out. Only ELSE and ENDIF showed at bottom of action table.

Your actions look adequately nested, which is to say not at all except one level inside each conditional, which is exactly what you want (sometimes people keep nesting without realizing it, which can be what you need sometimes but isn't here).

For ESLE-IF, you need to add it from the menus, similar to how you added IF THEN in the first place. It does not appear as a button because it requires additional input (and I guess the UI works best this way), whereas an ELSE or END-IF does not.

The last IF should be (Time between 3:01 AM and 6:59 AM) — not 3:01 PM.

2 Likes

What does the log show?

Honestly, I would just use Room lighting for this and set up time periods. ( I responded to your reddit post as well.) Room Lighting | Hubitat Documentation

Could be a couple issues:
1- You said you verified the motion sensor was picking up motion. So that rules out the first thought. Just make sure it shows in the logs for sure.

2 - Some lights are iffy when reporting status as to whether they are on or not. This is especially true of the older, non-Plus Zwave devices and several Zigbee bulbs. Room lighting has a feature that allows you to force on or off whether or not they think they're already on (and that might be a better app for what you're trying to do)

3 - Someone else already mentioned using Else-If's instead of separate If/Thens. That wouldn't necessarily cause a problem unless you lost track of where you were. The comment on the times on the last If then (Your AM's and PM's appear to be reversed)

I have a similar rule for a button controller that I did in RM. I use one if then followed by several else if's to set a variable with the color temperature. Once the variable is set, I then run actions to turn the lights on with the variables set in the former if then statement. I did this before Room lighting was available and just have not moved it because it is working.

I mentioned the "room lighting" app earlier. It can be used to control one device or several devices and has the option of setting up different settings based on modes or time periods. It also has the capability to Force On if already on and force Off if already off. If the problem is stemming from your switch/light not reporting back its correct status, then that should fix that problem.

Lastly, there are a plethora of means to activate in Room Lighting including motion, virtual switches (called an activator), and many other situations like doors that open, someone arrives, etc. You might want to give that a try.

1 Like

Good catch!

I rebuilt this thing a few times so who knows if that was there all along or just in the latest version.

I ended up fixing that, as well as factory resetting my hue motion sensor and now it works!

2 Likes

Update for everyone:

Got the rule working. There were a few things changed since my last update but I think factory resetting/repairing my hue motion sensor to hubitat did the trick.

I rewrote the rule using ElLSEIFS for completeness sake as well, while doing that I noticed I had a time set as PM where it should’ve been AM.

Rule has been working consistently for the whole day now!

1 Like

Thank you for the thorough reply! I definitely plan on taking a crack at the room lighting app.

With this being the first rule I built from scratch, I had a good idea of what I wanted for the ON rule and same for the separate OFF rule.

Something about the “all-inclusive” approach of room lighting turned me off for this specific use-case, since I know this will probably require some fine tuning on variables like time motion inactive for the OFF rule that goes with it.

Next step will be to incorporate a dummy switch into the off rule so that the “off if no motion after 15 min” rule can be overridden by a dummy switch that is on. That will be another fun first for me.

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