The DarkSky API works only with https requests. Thus I only get the reply "Bad Request" instead of the JSON reply if I use the following code to access the DarkSky forecast.
Code: Select all
io = require('io')
http = require('socket.http')
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
reply = http.request("https://api.darksky.net/forecast/[APIcode]/[lat],[lon]?units=si")
print(reply)
How can I make a https request in lua (I am still using Domoticz V3.5877 for other compatibility reasons)?