Use of sunrise and sunset time to set rules in the Calendar object
Modified on: Wed, 23 Sep, 2020 at 2:35 PM
The purpose of this article is to present the possibility of using sunrise and sunset times to set rules in the Calendar periphery object. This functionality will allow, for example, to raise roller shutters at sunrise and lower them at sunset.
Receiving sunrise and sunset information on UnixTime from OpenWeatherMap is presented in a following article:
Converting UnixTime sunrise and sunset (downloaded from OpenWeatherMap) to date and time is presented in a following article:
These instructions will allow you to display sunrise and sunset information in the showed format:
Having these data, it is possible to create a configuration that allows to set rules in the Calendar periphery object.
- Create user features of the number type on CLU
- In the next step, create two Calendar periphery objects - one responsible for triggering the action at sunrise, the other at sunset:
- In the next step on CLU, create a script:
- Then, the configuration should be sent to the CLU.
Warning! If sending the configuration to the CLU will involve sending a new configuration to the Gate HTTP module, then after sending it, read the information about sunrise and sunset times from the OpenWeatherMap website and convert the received Unix time to date and time.
- After the configuration has been successfully sent, call the previous created script. After calling the script, user features on CLU should receive the values as following:
and rules on Calendar object should look as presented:
Setting rules in Calendar objects can be performed every day at the same time (before sunrise) after earlier reading of sunrise and sunset values from the OpenWeatherMap service and after converting UnixTime to local time and date.
Did you find it helpful?
Sorry we couldn't be helpful. Help us improve this article with your feedback.