Thousands of Happy Smart Home Customers

But don’t just take our word for it...

We offer great products & great knowledge all backed up with great service - and our customers agree!

We’re very proud of our independent Excellent Trustpilot rating, backed up by the many repeat customers we’ve been supporting for years.


Read More


World-Class, Industry-Leading Technical Support - Forever Free

You’ll always have FREE access to our technical knowledgebase, application guides, YouTube tutorials & Customer Services, as well as all other online resources, help, white papers and articles.

If none of these answer your query you can also raise a ticket and get direct access to our team of smart home specialists for for assistance.


Access to technical specialists
100’s of in-depth help resources
Video guides via YouTube channel
Blog articles with product reviews & test results


The Vesternet Promise

As Founder & CEO of Vesternet, I personally guarantee your 100% satisfaction on any purchase.

I’d never want you to be unhappy with something you buy from us, so here’s my promise - you can return any unused products within 365 days. If you have problems with a new purchase, our support team will work with you to resolve. And if you still can’t get it working then you can return it within 14 days for replacement or refund. For full information take a look at our full returns policy.

In addition, here’s my personal email should you ever have any problems or feedback:

We’re not just a shop, we’re with you all the way on building your smart home.


Extending Fibaro Home Center 2 Sunrise/Sunset capabilities

The Fibaro Home Center 2 has a few limitations on the Sunset and Sunrise times you can use in your scenes. For instance you can select 15, 30, 45 and 60 minutes before sunrise and 15, 30, 45 and 60 minutes after sunset. But you can't select 60 minutes before sunset or any other values.

It is actually very easy to change a single line of LUA code to extend the Sunset/Sunrise times to any time you like.

As an example we will use the Sunset scene we used in Application Note 28 -

Sunset On Scene


This scene turns on a light exactly at Sunset. This works well for outside lights, but if you used the same scene for an indoor light you would probably want it to be activated before sunset as it gets darker inside a building.

So lets change this so the scene is activated 1 hour before Sunset.

View the LUA Code

To do this we need to change one line of the LUA code that actually runs this scene.

  • In the Scene's Advanced tab go to the Switch scene edit mode to LUA base
  • Click 'Change'
  • The LUA code is displayed in a HC2 window (shown below)

HC2 LUA Scene Code


  • The line of code we're interested in is on Line 14.

( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == fibaro:getValue(1, "sunsetHour")) )


  • To change this so that the scene is activated 60 minutes before sunset, we change line 14 to:

( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and"%H:%M", os.time()+60*60) == fibaro:getValue(1, "sunsetHour")) )


  • The code that controls the time before or after sunset is marked in bold - os.time()+60*60)
    • If this is positive '+' the scene will activate before Sunset, if negative '-' it will activate afterwards
    • The time before/after is determined by the numbers, '+60*60' in this example activates 60 minutes before sunset, 90 minutes would be '+90*60'
  • Note: To test this code I set the original scene to 1 hour after Sunset. The LUA code for that scene was identical to new code we have used above except for the time being os.time()-60*60). So by simply changing the section of code to os.time()+60*60) we now have a scene that runs 1 hour before sunset.

Change the LUA Code

To change the LUA code to use our new line of code (line 14) we need to turn on the LUA Editing mode.

Important - I would suggest you do this after you have the rest of the scene working correctly - you cannot go from the LUA based editor back to the Graphic Block editor.

When you are ready - change the editor to LUA based.

  • If you're not already in the LUA section of the 'Advanced' tab go to the Switch scene edit mode to LUA base, click 'Change'
  • Click 'Turn On'

HC2 LUA Editor


  • Click 'OK' in the warning dialog
  • Change line 14 to the new code
  • Click the 'Save' button on the right-hand menu

HC2 final LUA Code


The scene will now run 60 minutes before sunset.

Using this simple code change we can have our scenes running before or after Sunset/Sunrise and at what ever time we like.

Related Information


Copyright Vesternet 2014

Updated: 11/02/14

Please wait...

Item(s) Added Continue shopping or View cart & checkout
Continue shopping or View cart & checkout