25.03.2025, 13:32
I want to download the data of the solar production of the site from elia and based on the estimated PV production load the battery during the night. In order to minimise or electricty consumption during peak hours. For that, elia provides an api. But, my script in the LM used to work, but since a couples of month it isnot working anymore.
The script is as follows:
The result I get is:
What am I doing wrong. When I paste the string directly in to a brower, I get the data. So, the error is not caused by the string.
The script is as follows:
Code:
--
--------------------------------------------------------------------
-- BEGIN SCRIPT --
--------------------------------------------------------------------
--
require('socket.http')
require('ltn12')
require('json')
vraag = 'https://opendata.elia.be/api/explore/v2.1/catalog/datasets/ods087/records?where=datetime%20%3E%3D%20%222025-3-25%22&group_by=date_format(datetime%2C%20%27dd%2FMM%2FYYYY%27)%20AS%20Datum%2C%20date_format(datetime%2C%20%27HH%3Amm%27)%20AS%20Tijdstip%2C%20monitoredcapacity%20As%20Totaalvermogen%2C%20mostrecentforecast%20As%20Voorspelling&limit=96&refine=region%3A%22East-Flanders%22&refine=datetime%3A%222025%22&refine=resolutioncode%3A%22PT15M%22'
log(vraag)
res, code = socket.http.request({
url = vraag,
method = "GET",
})
log(res,code)
Code:
Elia verbeterd copy 25.03.2025 14:23:33
* string: https://opendata.elia.be/api/explore/v2.1/catalog/datasets/ods087/records?where=datetime%20%3E%3D%20%222025-3-25%22&group_by=date_format(datetime%2C%20%27dd%2FMM%2FYYYY%27)%20AS%20Datum%2C%20date_format(datetime%2C%20%27HH%3Amm%27)%20AS%20Tijdstip%2C%20monitoredcapacity%20As%20Totaalvermogen%2C%20mostrecentforecast%20As%20Voorspelling&limit=96&refine=region%3A%22East-Flanders%22&refine=datetime%3A%222025%22&refine=resolutioncode%3A%22PT15M%22
Elia verbeterd copy 25.03.2025 14:23:38
* arg: 1
* nil
* arg: 2
* string: Try again
What am I doing wrong. When I paste the string directly in to a brower, I get the data. So, the error is not caused by the string.