Add motion control to rule

In this rule I want to use a motion sensor to temporarily set the lights to white when there is someone in the driveway and then return to its previous state.

The switches turning on are HueCoCo scenes if that matters.

I was able to do this using Hue Labs but I'm struggling to figure out how to do this with RM4.

Select Trigger Events
When time is Sunset-30 minutes

Select Actions to Run
IF (Day is Monday(F) [FALSE]) THEN On: Driveway - Blue
ELSE-IF (Day is Tuesday(F) [FALSE]) THEN On: Driveway - Green
ELSE-IF (Day is Wednesday(F) [FALSE]) THEN On: Driveway - orange
ELSE-IF (Day is Thursday(T) [TRUE]) THEN On: Driveway - Purple
ELSE-IF (Day is Friday(F) [FALSE]) THEN On: Driveway - Red
ELSE-IF (Day is Saturday(F) [FALSE]) THEN On: Driveway - rgby
ELSE-IF (Day is Sunday(F) [FALSE]) THEN On: Driveway - yellow

I’ll look into this.. Not sure what set color (by name) in RM is actually sending to the driver... I’ll investigate and get back to you

1 Like

Sorry.. Thought I knew what this was referring to .. But I must back out as I’m not familiar with your devices...

No worries. The devices are (if I understand correctly) Hue scenes represented in Hubitat as virtual switches by the HueCoCo app. They don't have an off function which has been giving me some grief elsewhere.

I was jumping between forums and thought this was related to a driver I wrote.. But it did help me identify a bug in the driver I had been working on.. RM sends a null value for level on set color with this action.. I wasn’t catching on null for this value..

Ended up making this rule:

Name this Rule*

Select Trigger Events
Outside motion changed

Select Actions to Run
IF (Outside motion active(F) AND Mode in Early Morning, Evening, Night(T) [FALSE]) THEN On: Driveway - Bright
ELSE-IF (Outside motion inactive(T) AND Time between Sunset-30 minutes and 10:59 PM PST(T) [TRUE]) THEN Run Actions: Driveway lights night
ELSE-IF (Outside motion inactive(T) AND Time between 11:00 PM PST and Sunrise+30 minutes(F) [FALSE]) THEN Run Actions: Driveway 11:00pm

I'm sure there's a more elegant way but it works.

They do as of version 1.9, which I released three weeks ago. Turning off a scene will turn off the associated group (if it's a GroupScene, which would be a Room or Zone in the current Hue app) or lights (if it's a LightScene from v1 of the Hue app or some third-party apps). It will use the CoCoHue device(s) corresponding to that group or lights if it/they exist(s), otherwise it will turn them off directly via the Hue API, so something should definitely happen regardless of your current setup. :slight_smile:

When possible, my recommendation would still be to turn off the group or other device(s) yourself so you know exactly what is happening. The alternative to the implementation I did above would have been simply making scenes button devices with no "on" or "off," just "push." Hue has no concept of "turning off" a scene, so anything I'm doing is really a best-guess as to what users want. (I once wished I would have just made these button devices from the beginning to eliminate the confusion, but having "on" made them more versatile and useful in more apps. It's also what Hue B Smart, somewhat popular on ST and ported to Hubitat, does, so I didn't think this would end up being that big of a deal. But including it and hearing from people made me able to bounce ideas off of them about what they'd expect and I think the end result is better now that it would have been with just that.)

For your rule, I see you have something above that seems to work for you. It doesn't seem to be quite what you were asking in your original post, in which case you may be interested in RM's "Capture" and "Restore" actions (note that all attributes will be captured only if the bulb is on; if it's off, just the "off" state will be captured, and any color/level changes you make when on may surface if you turn the bulb on again in the future after your restore, which will just turn it back off; I helped someone through this--there are workarounds--in a different thread recently). But I might be misunderstanding something. Glad you have something figured out, though!

Wow thanks for taking the time to explain all of this to me.

I had tried to write my rule using the motion lighting app I think. I found the hue scene would trigger fine but would get stuck on. The log should (I'm paraphrasing here) couldn't turn off no off function associated.

As for the capture and restore. I found that with the Hue bulb because of how HE needs to poll Hue to get a bulb status it was entirely inaccurate. This is how I ended up with all of HueCoCo apps.