You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
This article preview will expire in 30 minutes, after which it will no longer be accessible.
Home > ZZB97 Z-Box Hub > Z-Box Software > Scenes and Automation > How To Simulate Sunrise With Your Smart Lights on Z-Box
How To Simulate Sunrise With Your Smart Lights on Z-Box
print icon

If you'd like your Z-Wave dimmer or connected smart bulb turn on gradually, slowly increasing brightness over a given amount of time, you can create a custom scene in your Z-Box using the lua scene editor. We explain the steps below.  Remember that this type of advanced programming is for expert users only, apply at your own risk.

 

To create a lua scene, simply go to Settings in the Z-Box Hub Web UI, click on Scenes, click on Add Scene (located in the top right corner), select Lua Scene and proceed according to the prompts until you reach the code editor.

 

Here is what you need to put in the code editor:

Under DECLARATIONS (Conditions/Triggers) paste the following (this will set the trigger to Mon-Sat at 6:00 AM, feel free to modify as needed):

{
  conditions = { {
      isTrigger = false,
      operator = "match",
      property = "cron",
      type = "date",
      value = { "*", "*", "*", "*", "1,2,3,4,5,6", "*" }
    }, {
      isTrigger = true,
      operator = "match",
      property = "cron",
      type = "date",
      value = { "00", "06", "*", "*", "*", "*" }
    } },
  operator = "all"
}


Then under ACTIONS paste the following (IMPORTANT: see the note below to adjust the code):

hub.call(X, 'setValue', 5)

local currentLevel = hub.call(X, 'getValue', 'value')
for i = 5, 100 do
  hub.call(X, 'setValue', i)
  hub.sleep(12000
end
hub.call(X, 'setValue', currentLevel)

 

 

NOTE: replace X with device ID of your dimmer or bulb (you can also replace 5 to be lower or higher depending on the brightness level you want to start with, we find that most LED bulbs need at least 5),12000 value is the equivalent of a 20-minute cycle, feel free to adjust it per your needs.

 

Save the scene and test it to make sure the lights behave the way you intended with the current settings. Questions? Just ask!

Feedback
2 out of 2 found this helpful

scroll to top icon