This documents lists and gives examples for each route the backend should implement.
Complexity: medium
Used by wind turbine sensors to push data to the server. The request payload is a JSON string with the following structure:
{
"windturbine": 1, // turbine ID in database
"timestamp": 1741334062, // date of the measure
"data": {
"speed": 123.4, // speed of the turbine blade in rpm
"power": 123.4 // generated power by the turbine in W
}
}Route should process the json, save its data.
Note that you also should compute the new total_energy_produced value based on the power reported (you can assume the interval between two datapoints to always be 60 seconds).
If there is no wind turbine with the id provided route must respond with a 404 error. If there is an error in the json payload route must respond with a 500 error.
If everything is correct, route must respond with the following JSON:
{
"status": "success"
}Complexity: medium
Used by solar panel sensors to push data to the server.
The payload is a : separated string with the following structure: id:temperature:power:timestamp.
For instance, 2:25.4:523.6:1741334062 is parsed in:
- solar panel ID: 2
- temperature: 25.4°C
- power: 523.6W
- timestamp: 1741334062
Similarly to the wind turbine, you should also create a new datapoint for total_energy_produced.
Sensors do not expect any response.
Complexity: hard
Returns the total production / consumption of the grid.
Exemple of /grid/1/production:
4439476.1618367Example of /grid/1/consumption:
1605381.1528419708Returns 404 if no grid with the id is found, Returns the value otherwise.