Use the sample program to collect data from a weather server and transmit the data to a dashboard server.
In this example, we will use the POU "Weather_Power_Values_EMONCMS_GET_Method". This POU contains all settings required to establish a connection with a weather server. (Depending on the HTTP server you choose, you can also use the POU "Weather_Power_Values_EMONCMS_POST_Method". Emoncms.org supports both methods.)
Prepare and compile the PLC program:
- Make sure that the POU "Weather_Power_Values_EMONCMS_GET_Method" is the only POU assigned to the program task.
- Replace the value for the parameter appid in the variable sFileOr_URL with your API key of the weather data server (registration on api.openweathermap.org
required).
- Replace the value of the variable sEmoncmsAPIKey of this POU with your API key of the dashboard server (registration on emoncms.org
required).The project is now ready to be compiled and transmitted to the PLC.
- Select , then Compile all... and Download program code and PLC configuration to PLC to transmit the program to the PLC.
Start communication with the weather server and the dashboard server: