If we want to use the information such as sunrise and sunset in the system, we can use an external service for this purpose, e.g.: https://sunrise-sunset.org/.
According to the example on https://sunrise-sunset.org,
the API query looks as following:
API call: https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400.
Below is presented how you can easily obtain this information:
- Create the HttpRequest periphery object:
HttpRequest - used to send HTTP requests (GET, POST type) to the specified host. Standard content-types are supported, including JSON, XML
- The following parameters should be set in the HttpRequest object:
- The next step is to create user features of the string type:
- Then prepare the script:
- Assign the script to the OnResponse event in the Http_Request periphery object:
- After calling the method, the StatusCode feature should receive the value 200.
User features values should receive appropriate values:The obtained data can be displayed in the mobile application and Smart Panel or use to create logic in the system.