Time based switching

With a VMB2PBN module on which two push buttons are connected, I try to switch ON/OFF 2 different outputs (lighting) with one push button depending on the time of the day. The other button is used for switching of another light.
In particular I want during daylight time to switch the regular lights on / off and after sunset switch the night lights on / off with the same button.
Some tips on how this can be done?


Have you looked at any other posts on the forum on this subject?

I tried to help someone with a similar request.


If that doesn’t point you in the direction you want, I’ll happily help you find a solution that meets your needs.

Good luck,


Hi Stuart,

Thanks for your feedback, but it’s not what I have in mind.

The item you refer to, blocks a button during a time period.

I want to use one button to switch 2 different outputs, based on the time of the day. I’m also working with the VMB2PBN push button module, not the VMBGPx.

I tried to use 2 virtual channels of the VMB2PBN and used program steps to press and release the virtual buttons during the time frames in which I would like to switch one or the other output.
If there is a way to use an AND function, then I can use the following logic :
Daytime : Pushbutton AND Daytime (virtual channel) = Day light output
Night time : Pushbutton AND Nighttime (virtual channel) = Night light output

Hi Bert

Okay, Let’s look at something else then :slight_smile:

You’re on the right lines with the ‘AND’ option, it just needs turning on its head a little.

How about this for a suggestion…

Take 1 button of your VMB2PB and set 2 actions.

Action 1 - Toggle day time lights {or Start/Stop timer for a duration}

Action 2 - Toggle night time lights {or Start/Stop timer for a duration}

With nothing more, both of your lamps will toggle happily, so now it just needs a time element adding.

Please find a virtual button and give it 2 actions.

Action 1 - Force off when Closed >> Day time lights

Action 2 - Force off when Open >> Night time lights

This virtual button now needs 2 timers to operate it.

Timer 1 - “Press” at a time of your choice, Alarm Bed or Sunset.

Timer 2 - “Release” at a time of your choice, Alarm Wake or Sunrise.

{Press, Release & Long_Press are at the bottom of the button duration drop down}

If you need an override button somewhere, just use a “Toggle Force On” action.

I hope this helps.

Good luck,


Hi Stuart,

Your solution works… to good.
Now i’m not able to switch the “night” lights with any switch during day time.
I would only like to have the functionality with 2 switches. All others should be able to switch any light any time of the day.
Any idea how to do this ?

Many thanks.

Hi Bert,

Okay, that’s not a major issue.

As I suggested, you can use the “Toggle Force On” actions from other buttons.

Alternatively, you could off load the logic to a pair of spare virtual relay channels and have a momentary action linking the virtual relays to the actual relay channels.

Slightly more complex to setup and manage, but it would work.

My tip would be if you off-load the logic is to use long timers instead of simple on and off actions.

That way if the button events get out of sync, the timers will eventually time out and everything will revert to a good state.