Using While Variable for Time of Day

  • I am trying to figure the best way to handle time, sunset, sunrise, 30 minutes before etc... I want my occupancy lights to turn to a certain brightness based on time. I did this before, but it was by simply using an event timer to set a variable and then use conditionals. I am thinking there is a better way.

    I think it best to use a While variable. While it is "after Sunset and before Sunrise" AND "It is Dark Outside" turn lights to 50%, While it is " after 10PM and before Sunrise " AND "It is Dark Outside" turn lights to 30%, "While it is after Sunrise and before Sunset" AND "It is Not Dark Outside" turn the lights to 75%. I am not exactly sure how to execute this. Should be easy. Will need to use the Event Loop to set Sunset, Sunrise, Is it Dark Outside. Then React to grab those and based the commands on them.

    Currently I have this:


    Here is the Event Loop:


    But I am not using "While" and I am not using string variables. I don't fully understand how to put it together.

    Nick Picklo, CGB
    Certified Graduate Builder
    m. 713.562.0009


  • 4
    Log in to reply

  • Nick,
    I would just use some Weather Tools Astro and Scheduled Events to handle this. Just create the events for when you want them to happen, sunset or maybe 30 minutes before, 10pm, sunrise. And then if you want the lights to change if it becomes dark during the daytime, create an event that occurs when cloud cover exceeds a certain percent.

    Justin Spiniolas

  • I don't agree, I would do this via While commands no question. You would do it via the Event Loop. Run the event loop and have it monitor the time of day (Time Tools) then based upon that you can loop in universal macros that conduct your night monitors, etc - those can monitor the house, close and lock doors if left opened, send notifications based on variables and/or what's going on, and of course set your lights as you wish.

    You could also combine this with something like Weather or Lutron's Sunrise/Sunset features (Weather Tools is prob better) to ramp up the lights leading up to sunset, etc which wouldn't be hard and would be pretty cool!

    Read the event loop command guide

    Braden R. Napier

  • That is a very cool idea. Please explain this further so that people can see how to implement it...

    Justin Spiniolas

Log in to reply

Internal error.

Oops! Looks like something went wrong!