08.05.2020, 12:50
(30.08.2019, 06:16)admin Wrote: This is probably due to older FW, as a work-around you can use HTTP request instead:
Code:require('json')
http = require('socket.http')
escape = require('socket.url').escape
key = 'my_api_key'
location = 'my location name'
url = 'http://api.apixu.com/v1/forecast.json?key=%s&q=%s&days=2'
url = string.format(url, key, escape(location))
res = http.request(url)
data = json.pdecode(res)
...
Weather service is working, but from different url
url = 'http://api.weatherstack.com/current?access_key=%s&query=%s'
will return table data.current like this
* table:
["cloudcover"]
* number: 59
["visibility"]
* number: 10
["observation_time"]
* string: 12:24 PM
["uv_index"]
* number: 5
["wind_dir"]
* string: NNW
["humidity"]
* number: 60
["weather_descriptions"]
* table:
[1]
* string: Cloudy
["wind_speed"]
* number: 21
["weather_code"]
* number: 119
["is_day"]
* string: yes
["pressure"]
* number: 1017
["precip"]
* number: 0.1
["weather_icons"]
* table:
[1]
* string: https://assets.weatherstack.com/images/w..._cloud.png
["feelslike"]
* number: 10
["temperature"]
* number: 12
["wind_degree"]
* number: 327
Best regards
Alex