Could someone please help me with a rule?

Hey guys. I have these recessed lights in my living room. Flipping the switch on then off then back on puts them into night light mode. I have a ZB mini relay behind a physical switch. I need a rule to flip the switch on then off then back on but with a delay in between.

I made a rule before but it was too fast for the relay and it just made the lights flicker on and off forever. Half a second is still not long enough. I think it'd be good with about a 1 second delay.

Here are the lights I have.

The ZBmini.

I've tried and for some reason I don't think I can get the delay long enough. Appreciate anyone who has a few minutes to write it up for me.

Trying to understand... From the recessed light documentation, it almost sounds like it toggles between downlight and nightlight modes every time it is turned on?

Or is there some timing apsect to it, if left off for a while it comes back on in the same mode, but if off for a short period it switches modes?

If you already created a rule you could just try a few different delays for it and see which one works. A good test would be to try the switch manually yourself and see about how long it takes to do it that way. Then you can try to replicate that in a rule.

Then again... it could be a feature that only happens with manual presses. There might be some other way to enable the nightlight mode when you are doing it over ZigBee.

Honestly, I would replace the bulbs with smart ones or use a smart dimmer with regular dimmable bulbs...

On off on will go to night light. On off .......10 seconds on regular light. You are correct sir.

What is the intended trigger of this? Mode change in the hub? Physical action?

My intention is "Alexa turn on the living room lights" with one flip on which it already does via the ZBmini.

I would like "Alexa turn on the living room night lights" to turn the switch on, then off and then back on via the ZBmini.

Last time I made this rule I believe I could not make the delay more than 1 second which would make the relay go crazy in the wall and flicker the lights. The only way I was able to stop this was to turn it off via the devices page in Hubitat.

Should be able to achieve what you want with basic rules. Have Alexa turn on a virtual switch and then turn on your light, then add your required wait time, and then turn your light off, add the required wait time, then on again.

To turn the light off when not in use, make a second basic rule that just turns the light off when the virtual switch that Alexa is linked to turns off.

This works but then doesnt stop. The lights keep going on and off. I have to remove the rule to shut them off.

@user359 can you screenshot the top of your rule, including the trigger? If your trigger is the light turning on the first time, it would explain the loop you describe. I agree with @SmartHomePrimer, easiest way is to have a virtual switch that is exposed to Alexa for the "night light" routine, and use that virtual switch "on" as the trigger event.

You also only have those delays set for 1 second. I thought you had mentioned before that was too short to work properly.

Now the 1 second is working fine. I am triggering it with the Zbmini, never thought that it would loop like that. Ill try a virtual switch and see if that works.

Ok so how do I link the virtual device to my ZBmini controlling the actual light fixtures?

I tried copying the Zigbee ID but that didnt work.

The rule is how they get tied together - your actions should still be to turn on/off the zbmini, e.g.

Alexa turns on the virtual switch via Hubitat, then Hubitat controls the zbmini to trigger the night light mode.

With this, you also need to consider how the night light virtual switch gets turned off - from Alexa again?

When Night Lights (virtual switch) turns on,
Turn on zbmini (ZigBee relay)
Wait 1s
Turn off zbmini
Wait 1s
Turn on zbmini

Before, if the trigger and actions was the zbmini, the last action (turning zbmini on) would trigger the rule to start again, leading to the flickering/flashing behavior you reported

1 Like

Create the virtual device (you don't input any ID's). In your rule a trigger will turn on/off that virtual device which in turn will trip something else etc...

I have to put the kids to bed but I think I get it now. Thank you guys so much.

Ill report back.

It works! I would have never figured that out. Thanks so much.

alexa turn off the overhead lights = works!


Of course theres a hangup now. i turn them off via "Alexa turn off the overhead lights" but this doesnt turn the virtual switch off so next time I go to turn on the "night lights" Alexa sees them as being on already and doesnt trigger the rule.

Is there a way to get that virtual switch to poll for its current state?