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:
CLU->sunrise_hour = tonumber(string.sub(tostring(GATE_HTTP->sunrise_local),12,13))
CLU->sunrise_minute = tonumber(string.sub(tostring(GATE_HTTP->sunrise_local),15,16))

CLU->cron_sunrise = CLU->sunrise_minute .. " " .. CLU->sunrise_hour .. " * * *"



CLU->sunset_hour = tonumber(string.sub(tostring(GATE_HTTP->sunset_local),12,13))
CLU->sunset_minute = tonumber(string.sub(tostring(GATE_HTTP->sunset_local),15,16))

CLU->cron_sunset = CLU->sunset_minute .. " " .. CLU->sunset_hour .. " * * *"



  • 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.