Fetching info from json URL weather underground

Post Reply
elmortero
Posts: 102
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 2.3852
Location: Spain
Contact:

Fetching info from json URL weather underground

Post by elmortero » Wednesday 28 December 2016 17:34

Hi all,

Since I cannot use the buienradar script http://www.domoticz.com/forum/viewtopic ... +in#p38236 for my location because the Latitude cannot be lower than 44 I am trying to get my precipitation info from Weather Underground.
In plain Lua I managed to read 1 field (of two I want) based on this: http://www.domoticz.com/wiki/Real-time_ ... structions

As I have all my other script in dzVents (I am a fan, what can I say ;) ) I want this to work too.
The API url is http://api.wunderground.com/api/YOURAPI ... cante.json and the output is like this:
Spoiler: show
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"conditions": 1
}
}
, "current_observation": {
"image": {
"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
"title":"Weather Underground",
"link":"http://www.wunderground.com"
},
"display_location": {
"full":"Alicante, Spain",
"city":"Alicante",
"state":"A",
"state_name":"Spain",
"country":"SP",
"country_iso3166":"ES",
"zip":"00000",
"magic":"1",
"wmo":"08359",
"latitude":"38.xxxx",
"longitude":"-0.xxxx",
"elevation":"82.0"
},
"observation_location": {
"full":"Rabassa, Alacant, L\u0027ALACANTí",
"city":"Rabassa, Alacant",
"state":"L\u0027ALACANTí",
"country":"ES",
"country_iso3166":"ES",
"latitude":"38.372799",
"longitude":"-0.499062",
"elevation":"269 ft"
},
"estimated": {
},
"station_id":"ILALACAN3",
"observation_time":"Last Updated on December 28, 12:25 PM CET",
"observation_time_rfc822":"Wed, 28 Dec 2016 12:25:59 +0100",
"observation_epoch":"1482924359",
"local_time_rfc822":"Wed, 28 Dec 2016 12:26:21 +0100",
"local_epoch":"1482924381",
"local_tz_short":"CET",
"local_tz_long":"Europe/Madrid",
"local_tz_offset":"+0100",
"weather":"Mostly Cloudy",
"temperature_string":"60.1 F (15.6 C)",
"temp_f":60.1,
"temp_c":15.6,
"relative_humidity":"72%",
"wind_string":"Calm",
"wind_dir":"NNE",
"wind_degrees":15,
"wind_mph":0.0,
"wind_gust_mph":"3.0",
"wind_kph":0,
"wind_gust_kph":"4.8",
"pressure_mb":"1035",
"pressure_in":"30.57",
"pressure_trend":"0",
"dewpoint_string":"51 F (11 C)",
"dewpoint_f":51,
"dewpoint_c":11,
"heat_index_string":"NA",
"heat_index_f":"NA",
"heat_index_c":"NA",
"windchill_string":"NA",
"windchill_f":"NA",
"windchill_c":"NA",
"feelslike_string":"60.1 F (15.6 C)",
"feelslike_f":"60.1",
"feelslike_c":"15.6",
"visibility_mi":"6.2",
"visibility_km":"10.0",
"solarradiation":"--",
"UV":"1","precip_1hr_string":"0.00 in ( 0 mm)",
"precip_1hr_in":"0.00",
"precip_1hr_metric":" 0",
"precip_today_string":"0.00 in (0 mm)",
"precip_today_in":"0.00",
"precip_today_metric":"0",
"icon":"mostlycloudy",
"icon_url":"http://icons.wxug.com/i/c/k/mostlycloudy.gif",
"forecast_url":"http://www.wunderground.com/global/stations/08359.html",
"history_url":"http://www.wunderground.com/weatherstat ... =ILALACAN3",
"ob_url":"http://www.wunderground.com/cgi-bin/fin ... ,-0.499062",
"nowcast":""
}
}
and I want to read the data from the fields "precip_today_metric" and "precip_1hr_metric" to use to update 2 virtual rain devices.
I thought I was going the right way but not getting there :(

Code: Select all

return {
	active = true,  
	on = {
			['timer'] = 'every 5 minutes',
			},

execute = function(domoticz)
----
       local localhost = '127.0.0.1:8080'
       local city = "Alicante"	--city
       local countryCode = "ES"  --country
	   local rth = domoticz.devices['nexthourRain'] --my virtual rainsensor for hourly
	   local rtd = domoticz.devices['todayRain']  --my virtual rainsensor for hourly
	   local wuAPIkey = "XXXXXXX" -- WUnderground API Key
       local latitude = 38.xxxx
       local longitude = -0.4xxx
       local altitude = 81 
-[[ this is wereh the info is fetched from URL http://api.wunderground.com/api/'..wuAPIkey..'/conditions/q/'..countryCode..'/'..city..'.json'


 	   local rainin1hour = this should contain the value of the field "precip_1hr_metric" from URL
		domoticz.log('Expected rain in the next hour is ' .. rainin1hour, domoticz.LOG_INFO)
		rth.updateRain(0, .. rainin1hour) --only updating the counter, not the rate
	   local raintoday = this should contain the value of the field "precip_today_metric" from URL
		domoticz.log('Expected rain for today is ' .. raintoday, domoticz.LOG_INFO)
		rtd.updateRain(0, .. raintoday) --only updating the counter, not the rate
--]]
		----
	end		
}
Could someone help me?
Dannybloe, I think I am looking at you ..

Egregius
Posts: 2315
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: Fetching info from json URL weather underground

Post by Egregius » Wednesday 28 December 2016 17:52

Isn't the precipitation at wunderground 'after' the rain has fallen? While buienradar does a prediction of rain?

elmortero
Posts: 102
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 2.3852
Location: Spain
Contact:

Re: Fetching info from json URL weather underground

Post by elmortero » Wednesday 28 December 2016 18:13

Auch!
That is right. I should have known that one.
Still want to find out how to do this.
But now I have an additional question: is there a service like buienradar that covers the south of Europe? I really would like to have this for my irrigation script. Don't want to water the plants if It is going to rain an hour later.

Toulon7559
Posts: 385
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: Fetching info from json URL weather underground

Post by Toulon7559 » Wednesday 28 December 2016 18:16

If WUnderground 'refuses' to provide an forecast-output for altitude < 44 degrees, perhaps OpenWeatherMap is a more appropriate approach:
for Alicante they have web-pictures, and under the tab 'API' you can find all kind of scripts for actual weather and for forecasts.

Furthermore, under Domoticz/Dashboard/Hardware you can make your direct Domoticz-link to OWM.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

elmortero
Posts: 102
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 2.3852
Location: Spain
Contact:

Re: Fetching info from json URL weather underground

Post by elmortero » Wednesday 28 December 2016 18:44

It is not WUnderground that does not show that data but Buienradar.
Openweathermap also shows the past rainfall only.
Thanks for the effort, but it is not what I am looking for.

Toulon7559
Posts: 385
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: Fetching info from json URL weather underground

Post by Toulon7559 » Thursday 29 December 2016 19:10

Dit you look here for a 5day-forecast by OWM?
Also 10 day forecast is available at OWM.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

Toulon7559
Posts: 385
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: Fetching info from json URL weather underground

Post by Toulon7559 » Thursday 29 December 2016 19:14

Did you look here for a 5day-forecast by OWM?
Also 16day forecast is available at OWM.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

elmortero
Posts: 102
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 2.3852
Location: Spain
Contact:

Re: Fetching info from json URL weather underground

Post by elmortero » Saturday 31 December 2016 11:56

You are totally right. I am travelling and thus only readingnon the mobile (as in: my excuse for overlooking that, haha).
Can someone help me on how to fetch the info from the first "rain" field? That would get me rain in the Next 3 hours which would be very useful.

elmortero
Posts: 102
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 2.3852
Location: Spain
Contact:

Re: Fetching info from json URL weather underground

Post by elmortero » Tuesday 03 January 2017 15:52

output example of openweathermap:
Spoiler: show
{"city":{"id":2521978,"name":"Alicante","coord":{"lon":-0.48149,"lat":38.345169},"country":"ES","population":0,"sys":{"population":0}},"cod":"200","message":0.0056,"cnt":35,"list":[{"dt":1483455600,"main":{"temp":291.09,"temp_min":289.977,"temp_max":291.09,"pressure":997.93,"sea_level":1036.15,"grnd_level":997.93,"humidity":58,"temp_kf":1.11},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":12},"wind":{"speed":5,"deg":304.002},"sys":{"pod":"d"},"dt_txt":"2017-01-03 15:00:00"},{"dt":1483466400,"main":{"temp":287.24,"temp_min":286.404,"temp_max":287.24,"pressure":999.1,"sea_level":1037.27,"grnd_level":999.1,"humidity":73,"temp_kf":0.83},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":5.03,"deg":308.001},"sys":{"pod":"n"},"dt_txt":"2017-01-03 18:00:00"},{"dt":1483477200,"main":{"temp":284.57,"temp_min":284.017,"temp_max":284.57,"pressure":999.41,"sea_level":1037.92,"grnd_level":999.41,"humidity":88,"temp_kf":0.56},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":4.59,"deg":309.001},"sys":{"pod":"n"},"dt_txt":"2017-01-03 21:00:00"},{"dt":1483488000,"main":{"temp":282.89,"temp_min":282.611,"temp_max":282.89,"pressure":999.26,"sea_level":1037.93,"grnd_level":999.26,"humidity":95,"temp_kf":0.28},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":4.49,"deg":309.004},"sys":{"pod":"n"},"dt_txt":"2017-01-04 00:00:00"},{"dt":1483498800,"main":{"temp":282.448,"temp_min":282.448,"temp_max":282.448,"pressure":998.94,"sea_level":1037.65,"grnd_level":998.94,"humidity":98,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":4.56,"deg":318.501},"sys":{"pod":"n"},"dt_txt":"2017-01-04 03:00:00"},{"dt":1483509600,"main":{"temp":281.542,"temp_min":281.542,"temp_max":281.542,"pressure":998.6,"sea_level":1037.52,"grnd_level":998.6,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.94,"deg":318.503},"sys":{"pod":"n"},"dt_txt":"2017-01-04 06:00:00"},{"dt":1483520400,"main":{"temp":283.514,"temp_min":283.514,"temp_max":283.514,"pressure":999.17,"sea_level":1037.97,"grnd_level":999.17,"humidity":93,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3.85,"deg":323.003},"sys":{"pod":"d"},"dt_txt":"2017-01-04 09:00:00"},{"dt":1483531200,"main":{"temp":289.21,"temp_min":289.21,"temp_max":289.21,"pressure":998.51,"sea_level":1036.87,"grnd_level":998.51,"humidity":68,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":4.31,"deg":323.003},"sys":{"pod":"d"},"dt_txt":"2017-01-04 12:00:00"},{"dt":1483542000,"main":{"temp":290.258,"temp_min":290.258,"temp_max":290.258,"pressure":996.93,"sea_level":1035.13,"grnd_level":996.93,"humidity":62,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3.81,"deg":317},"sys":{"pod":"d"},"dt_txt":"2017-01-04 15:00:00"},{"dt":1483552800,"main":{"temp":286.166,"temp_min":286.166,"temp_max":286.166,"pressure":997.36,"sea_level":1035.71,"grnd_level":997.36,"humidity":77,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.28,"deg":317.504},"sys":{"pod":"n"},"dt_txt":"2017-01-04 18:00:00"},{"dt":1483563600,"main":{"temp":282.63,"temp_min":282.63,"temp_max":282.63,"pressure":997.51,"sea_level":1036.12,"grnd_level":997.51,"humidity":95,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.46,"deg":313.001},"sys":{"pod":"n"},"dt_txt":"2017-01-04 21:00:00"},{"dt":1483574400,"main":{"temp":280.341,"temp_min":280.341,"temp_max":280.341,"pressure":997.2,"sea_level":1035.82,"grnd_level":997.2,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.7,"deg":318.503},"sys":{"pod":"n"},"dt_txt":"2017-01-05 00:00:00"},{"dt":1483585200,"main":{"temp":279.109,"temp_min":279.109,"temp_max":279.109,"pressure":996.2,"sea_level":1035.09,"grnd_level":996.2,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":4.02,"deg":317.502},"sys":{"pod":"n"},"dt_txt":"2017-01-05 03:00:00"},{"dt":1483596000,"main":{"temp":277.797,"temp_min":277.797,"temp_max":277.797,"pressure":995.67,"sea_level":1034.66,"grnd_level":995.67,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":3.31,"deg":326},"sys":{"pod":"n"},"dt_txt":"2017-01-05 06:00:00"},{"dt":1483606800,"main":{"temp":280.406,"temp_min":280.406,"temp_max":280.406,"pressure":996.97,"sea_level":1035.93,"grnd_level":996.97,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":3.35,"deg":329.002},"sys":{"pod":"d"},"dt_txt":"2017-01-05 09:00:00"},{"dt":1483617600,"main":{"temp":287.921,"temp_min":287.921,"temp_max":287.921,"pressure":997.32,"sea_level":1035.77,"grnd_level":997.32,"humidity":69,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":1.26,"deg":339.501},"sys":{"pod":"d"},"dt_txt":"2017-01-05 12:00:00"},{"dt":1483628400,"main":{"temp":288.632,"temp_min":288.632,"temp_max":288.632,"pressure":996.6,"sea_level":1035.01,"grnd_level":996.6,"humidity":67,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":1.6,"deg":152.505},"sys":{"pod":"d"},"dt_txt":"2017-01-05 15:00:00"},{"dt":1483639200,"main":{"temp":282.333,"temp_min":282.333,"temp_max":282.333,"pressure":998.01,"sea_level":1036.61,"grnd_level":998.01,"humidity":100,"temp_kf":0},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":1.96,"deg":123.5},"sys":{"pod":"n"},"dt_txt":"2017-01-05 18:00:00"},{"dt":1483650000,"main":{"temp":278.294,"temp_min":278.294,"temp_max":278.294,"pressure":999.61,"sea_level":1038.36,"grnd_level":999.61,"humidity":100,"temp_kf":0},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"clouds":{"all":20},"wind":{"speed":1.66,"deg":102.5},"sys":{"pod":"n"},"dt_txt":"2017-01-05 21:00:00"},{"dt":1483660800,"main":{"temp":278.804,"temp_min":278.804,"temp_max":278.804,"pressure":1000.71,"sea_level":1039.37,"grnd_level":1000.71,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":56},"wind":{"speed":0.8,"deg":90.5037},"rain":{"3h":0.01},"sys":{"pod":"n"},"dt_txt":"2017-01-06 00:00:00"},{"dt":1483671600,"main":{"temp":279.486,"temp_min":279.486,"temp_max":279.486,"pressure":1001.27,"sea_level":1040.01,"grnd_level":1001.27,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":76},"wind":{"speed":0.9,"deg":1.01019},"rain":{"3h":0.02},"sys":{"pod":"n"},"dt_txt":"2017-01-06 03:00:00"},{"dt":1483682400,"main":{"temp":280.758,"temp_min":280.758,"temp_max":280.758,"pressure":1001.99,"sea_level":1040.83,"grnd_level":1001.99,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":64},"wind":{"speed":1.12,"deg":359},"rain":{"3h":0.02},"sys":{"pod":"n"},"dt_txt":"2017-01-06 06:00:00"},{"dt":1483693200,"main":{"temp":282.237,"temp_min":282.237,"temp_max":282.237,"pressure":1003.42,"sea_level":1042.32,"grnd_level":1003.42,"humidity":100,"temp_kf":0},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":20},"wind":{"speed":1.51,"deg":347.501},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-01-06 09:00:00"},{"dt":1483704000,"main":{"temp":286.735,"temp_min":286.735,"temp_max":286.735,"pressure":1003.33,"sea_level":1042.11,"grnd_level":1003.33,"humidity":79,"temp_kf":0},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":20},"wind":{"speed":1.6,"deg":163.001},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-01-06 12:00:00"},{"dt":1483714800,"main":{"temp":286.593,"temp_min":286.593,"temp_max":286.593,"pressure":1002.6,"sea_level":1041.18,"grnd_level":1002.6,"humidity":80,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":64},"wind":{"speed":2.22,"deg":175.504},"rain":{"3h":0.02},"sys":{"pod":"d"},"dt_txt":"2017-01-06 15:00:00"},{"dt":1483725600,"main":{"temp":283.443,"temp_min":283.443,"temp_max":283.443,"pressure":1003.05,"sea_level":1041.73,"grnd_level":1003.05,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":80},"wind":{"speed":1.35,"deg":161.503},"rain":{"3h":0.06},"sys":{"pod":"n"},"dt_txt":"2017-01-06 18:00:00"},{"dt":1483736400,"main":{"temp":282.247,"temp_min":282.247,"temp_max":282.247,"pressure":1003.78,"sea_level":1042.56,"grnd_level":1003.78,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":76},"wind":{"speed":1.04,"deg":166.002},"rain":{"3h":0.07},"sys":{"pod":"n"},"dt_txt":"2017-01-06 21:00:00"},{"dt":1483747200,"main":{"temp":281.134,"temp_min":281.134,"temp_max":281.134,"pressure":1003.88,"sea_level":1042.71,"grnd_level":1003.88,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":80},"wind":{"speed":0.83,"deg":271},"rain":{"3h":0.03},"sys":{"pod":"n"},"dt_txt":"2017-01-07 00:00:00"},{"dt":1483758000,"main":{"temp":280.953,"temp_min":280.953,"temp_max":280.953,"pressure":1003.53,"sea_level":1042.43,"grnd_level":1003.53,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":88},"wind":{"speed":1.32,"deg":319.502},"rain":{"3h":0.03},"sys":{"pod":"n"},"dt_txt":"2017-01-07 03:00:00"},{"dt":1483768800,"main":{"temp":279.426,"temp_min":279.426,"temp_max":279.426,"pressure":1003.41,"sea_level":1042.52,"grnd_level":1003.41,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":48},"wind":{"speed":1.77,"deg":323.501},"rain":{"3h":0.03},"sys":{"pod":"n"},"dt_txt":"2017-01-07 06:00:00"},{"dt":1483779600,"main":{"temp":280.776,"temp_min":280.776,"temp_max":280.776,"pressure":1004.59,"sea_level":1043.78,"grnd_level":1004.59,"humidity":100,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":48},"wind":{"speed":1.81,"deg":327},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-01-07 09:00:00"},{"dt":1483790400,"main":{"temp":285.551,"temp_min":285.551,"temp_max":285.551,"pressure":1004.54,"sea_level":1043.5,"grnd_level":1004.54,"humidity":79,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":36},"wind":{"speed":1.06,"deg":310.506},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-01-07 12:00:00"},{"dt":1483801200,"main":{"temp":286.072,"temp_min":286.072,"temp_max":286.072,"pressure":1003.52,"sea_level":1042.4,"grnd_level":1003.52,"humidity":77,"temp_kf":0},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":24},"wind":{"speed":1.71,"deg":159.003},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-01-07 15:00:00"},{"dt":1483812000,"main":{"temp":282.236,"temp_min":282.236,"temp_max":282.236,"pressure":1004.09,"sea_level":1042.99,"grnd_level":1004.09,"humidity":100,"temp_kf":0},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":48},"wind":{"speed":1.58,"deg":144.502},"rain":{},"sys":{"pod":"n"},"dt_txt":"2017-01-07 18:00:00"},{"dt":1483822800,"main":{"temp":279.932,"temp_min":279.932,"temp_max":279.932,"pressure":1004.85,"sea_level":1043.76,"grnd_level":1004.85,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":1.22,"deg":160.003},"rain":{"3h":0.01},"sys":{"pod":"n"},"dt_txt":"2017-01-07 21:00:00"}]}
Does anyone know how to read the (first) "rain" field that contains the precipitation (the one starting with "3h":) in LUA?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest