Turn on light at sunset IF another outlet is on

I have a dog camera plugged into a smart outlet that turns on another smart bulb when the dog camera outlet is turned on. During the day, there is enough light to where it's wasteful to have the smart bulb on.

I would like to create a rule that checks if the dog camera outlet is on AND if it is sunset. If both cases are true, turn on the smart bulb. Is this possible with custom rules and which app (Rule Machine, Basic Rules, etc) should I add this?

What app are you using to automate the bulb, now? You could probably add a restriction to only turn on if after sunset.

I do have that restriction, but I don't think it would turn the smart bulb on at sunset if the outlet was already on before sunset?

1 Like

It wouldn't, for that you'd need to use Rule Machine.


Hubitat can easily do things at sunrise and sunset. Since there is usually some ambient lighting for 15-20 minutes before sunrise and for 15-20 minutes after sunset, you can even use an offset if you wish.

Thus, you can easily make a rule that says the smart light should be turned from 15 minutes after sunset to 15 minutes before sunrise, but only when the dog camera outlet is powered on.

What triggers the dog camera outlet turning off or on? That might dictate how the rules have to be set up. If the dog camera outlet might get turned on and off several times during the night and you want the light turned off whenever the camera is off, that would make things more complicated, but still doable. You could accomplish that using a virtual switch to indicate where it is nighttime or now. The virtual switch would turn on at 15 minutes after sunset and turn off 15 minutes before sunrise. The light would come on any time the camera turns on as long as the virtual switch is on, but turn off and stay off if the virtual switch is off (during daylight hours).

1 Like

i would create a group of the outlets you want to check, and have it turn on when any of the lights are on. then have a rule that triggers at sunset. in the actions, have an if statement. if the group is on, turn on the dog light

This RM rule turns on 'bulb' at sunset if 'Outlet' is on. Just plug in your devices instead. The Required Expression uses capability Switch for Outlet.

1 Like