About This Project
This is my 2nd project with Cayenne. First published in December 2016. I revised it a bit and also corrected a stupid error in the DST-calculation which only became evident when DST started in 2017. The project itself is based on a static sketch running for several months now where a handful of lights follow sunset to go on; major objective here is that there is no need to adjust time over the months (the farther you are away from the equator, the more you will require this). In December 2016 I converted this to Cayenne because I was missing manual controls (or have to use three different remotes), the sketch does not need to be updated when switches are added because they can be programmed from inside the dashboard and on/off actions can be scheduled and/or triggered!
The switches in this project are self-learning. How to recognise a self-learning switch? Self-learning switches do not have any dipswitches but when plugged in power you get some time to program them with either the supplied remote or now with Cayenne. In the Netherlands the switches are sold with names like Flamingo F500, some “klik aan klik” uit variants, Elro 8-serie and the cheapest from Action 3 for 10 euro. The Action switches are also easy because they give you more time for programming the switch. To be honest I am not sure if all self-learning switches are using the same protocol but it looks like it so far. The library is created by others who invested their time to understand what kind of 433 sequences the remote controls were sending to activate a switch. These codes are converted again by someone into the flamingo library. My contribution is limited with some simplification to make this library more Cayenne friendly; It used to have a remote-unit key, I converted it to (virtual) single code key so it can respond on the Cayenne’s’ virtual channel V0 to V7. More codes might be available.
The project exits off:
• Arduino UNO
• W5100 LAN module
• RTC-module (DS3231)
• Self-learning power switches (*)
Why use the time library? In the old project the device was instable this is solved with the timer function which only communicates with the Cayenne server in a 10 seconds interval. In this section the present time (V20) is calculated, DST, sunrise (V21), sunset V22) and “night time” (V25).
- Daylight Saving Time (DST) for CET.
- Sunset/Sunrise calculation and display; The Sunset/Sunrise is calculated with “TimeLord tardis” in combination with the GPS location. It also uses the variable “DST_check” to add hours for the DST-offset in summer.
The RTC-module (DS3231) is added for two reasons.
• Unaware if the time can be retrieved from Cheyenne
• Use the alarm function for DST (second only)
Some lines are set to comment, you can use this section to reset your RTC-module and/or to set a new time. Please note that the present time will be about 20 seconds of (differences caused due time lapse between the compile time and actual reset of RTC-time in sketch, you might want to program the RTC-time in a simple sketch.
Display of the values
How to display the sunset and sunrise time as best as possible? In the absence of the colon make a point (Amerika likely sees a comma).
The attachment consist of the library folder with three files; the sketch, the routines and the flamingo library (in a zip file renamed as txt).
sketch_433_Cayenne_timed.zip.txt (5.1 KB)
Triggers & Alerts
The standard alert when device goes offline
The trigger based upon “night time” to schedule light to go on/off on sunset/sunrise
When a switch needs to turn on or mostly off on a defined time e.g. midnight.
The self-learning switches:
Trigger using Sunset:
video of project
f.y.i. Using my android phone only for display here. With my desktop I select the widget, this will result that the status of the widget and the light on the switch will change.