My Razberry acts as a secondary controller to my alarm system (as it supports z-wave communication). My alarm company provides me with some basic methods to setting up rules on their website. Which is fine for most people but for me I'd like to have the flexibility to add to things as I see fit. So I was basically limited to what I could do with my alarm company. What they did have is the ability to turn lights on and off based on sunrise and sunset times. Sure, one can setup a logical module to turn lights on and off close to sunrise and sunset but it would have to be adjusted periodically throughout the year and since this is supposed to be an automated system why would one have to do that. I looked at how I could get the sunrise and sunset information and the method on how to do that. Well there is the OpenWeather module. This provides me the means to get the information from the web. And by good fortune, the site where we get the weather from also provides the sunrise and sunset times in Epoch format. This couldn't be more perfect that what I had hoped for. After trial and error and digging through some other modules I was finally able to get the lights to turn on and off at set times of the day based on sunrise and sunset.
If you are running version 1.7.1 or earlier, you will need to extract the contents of the zip package to your /opt/z-way-server/automation/modules directory in a folder named SunriseSunet. The full path should be '/opt/z-way-server/automation/modules/SunriseSunset'. If you are running version 1.7.2, the SunriseSunset folder should be placed in the userModules directory. After placing it in the appropriate directory you will need to restart z-way-server. One of the methods to do that is by executing this command `sudo service z-way-server restart`.
In the Automation menu, you should now see the new module 'Sunrise / Sunset'. Fill in your City and Country and add the switches you'd like to control during these times of the day. I have two switches and a dimmer that are activated. I also provided two drop down selections that contain 10, 20, 30, 45 and 60 minute intervals. The first drop down will turn off your selected devices X number of minutes past sunrise and the second will turn your devices on X number of minutes prior to sunset.
The module can also be used more than once, I'm sure the creative people may enjoy it. I was think on the lines of possibly using this with a plug-in wall device to turn Christmas lights on and off during the Holiday season.
Enjoy!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
********** Updated module Sept 8th, 2014 ***********
Version 2.0.5 - Added the ability to disable the turning off/on of the device
for either the sunset or sunrise time. As per request from ozgreg.
Removed console.log references used for debugging.
No known bugs or issues with it.