Page 1 of 1
Open Weather map
Posted: Tuesday 05 July 2016 8:32
by Derik
See something new[ for me than ] Open Weather map:

- ScreenShot078.jpg (94.38 KiB) Viewed 7014 times
Only is there some one that can explane this thing to me.
I now that i need a account.
Only i do not understand how i get this script to work..
It is not a time or a device .lua.
Do i need a Crontab?
And do i need for all device a new IDX or can i get all the data in 1 sensor? [ what type? ]

- ScreenShot079.jpg (29.71 KiB) Viewed 7014 times
Or do some one have a example script with all the [ max ] options.
Thanks
Re: Open Weather map
Posted: Tuesday 05 July 2016 8:46
by gizmocuz
Hi Derik,
We now have
- AccuWeather (new)
- Weather Underground
- Forcast.IO
this is not sufficient ? or is there data on the openweathermap that is not available in the above 3 ?
As you can see in your last screenshot, it update a temp+hum+baro device, but not correct, as the forecast is always set to 0
You would like to have the forecast as well
This can be created with the 'weather number' value i see in your first screenshot
Re: Open Weather map
Posted: Tuesday 05 July 2016 9:21
by Toulon7559
Re: Open Weather map
Posted: Tuesday 05 July 2016 9:24
by Toulon7559
@Gizmocuz
Somewhere for the new Accuweather-entry an instruction/hint how to fill-in the fields for Dashboard/Hardware?
API-key is clear, but what for Name and for Location?
Re: Open Weather map
Posted: Tuesday 05 July 2016 9:43
by Toulon7559

'Borrowing an example' is easier than 're-invention'.
The OWM-elements in this python script work for extraction of information, and could be used for copy-paste towards another python-script.
[Take care that the attachment is a txt-file, not a python-file!]
Re: Open Weather map
Posted: Tuesday 05 July 2016 22:58
by Derik
@ Rob,
Almost vacation so sorry for my late response, but when I have vacation ... [busy]
I make up for it.
The reason I want to get OWM working ....
The buienradar is not actual. [ you have seen it...

]
AccuWeather is paid
Weather Underground is not always up to date..
My rain sensor is not accurate enough
Forecast.io is also not always correct.
So my sunshade has been once filled with water ..
And finally because it can ...
And I was hoping for the UV OWM but paid unfortunately ..
Re: Open Weather map
Posted: Tuesday 05 July 2016 23:03
by Derik
Toulon7559 wrote:@Gizmocuz
Somewhere for the new Accuweather-entry an instruction/hint how to fill-in the fields for Dashboard/Hardware?
API-key is clear, but what for Name and for Location?

- ScreenShot087.jpg (25.71 KiB) Viewed 6925 times
Or:
http://openweathermap.org/api
Re: Open Weather map
Posted: Wednesday 06 July 2016 8:44
by Egregius
I don't think OWM gives rain prediction.
Code: Select all
{"coord":{"lon":5.85,"lat":51.84},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"base":"stations","main":{"temp":15.24,"pressure":1020,"humidity":93,"temp_min":12.8,"temp_max":20.6},"visibility":10000,"wind":{"speed":3.6,"deg":300},"clouds":{"all":40},"dt":1467787298,"sys":{"type":1,"id":5219,"message":0.0451,"country":"NL","sunrise":1467775584,"sunset":1467834962},"id":2750053,"name":"Nijmegen","cod":200}
I grab outside temperature from OWM, wind speed from OWM and forecast.io, rain predection from buienradar and forecast.io.
The biggest value of both API's is stored in a virtual sensor.
Re: Open Weather map
Posted: Wednesday 06 July 2016 12:16
by Toulon7559
Forecast is available in OWM, even with 2 predictionperiods at choice:
http://openweathermap.org/forecast5 and
http://openweathermap.org/forecast16
Re: Open Weather map
Posted: Wednesday 06 July 2016 14:10
by gizmocuz
I dont think we said that it did not do this ?
But the rest of the information is very limited, and as we support 3 other big weather sites, i do not see a reason for the 4th
Re: Open Weather map
Posted: Wednesday 06 July 2016 14:19
by Egregius
It was I that stated that there's no precipitation prediction at OWM but it appears to be that it's only available in the forecast, not in the actual weather call.
Anyway, stuff like this is easy to handle with a small script and a dummy sensor. Even better, it works as you expect, at the refresh time you want, with only the data you find interesting. Therefore I also don't see the need to implemented this in the core of Domoticz.
Re: Open Weather map
Posted: Wednesday 06 July 2016 14:29
by Toulon7559
In my opinion Wunderground and Forecast.io was already more than sufficient for the basic needs for upload and download of weather information.
The limitation to 6 months of use for the Accuweather-API does not speak in favour for that organisation.

OWM itself and the internet offer so many examples that a Domoticz-user should easily find from OWM something applicable for his/her use, to be adapted and implemented by own work.
And for the diehards, plenty more is available for own initiatives .........
Would only be nice, that if somebody makes a nice, working script, that as example it is made available in this forum and/or as part of the Wiki.
Re: Open Weather map
Posted: Wednesday 06 July 2016 14:52
by Egregius
This is my code:
grabs outside temperature from OWM.
And rain prediction from buienradar and forecast.io and stores highest value
Same for wind, from OWM and forecast.io store highest value.
Executed every minute (that's why forecast.io is only pulled from 7:30 till 23:59).
Code: Select all
$owwind=0;$forecastwind=0;$forecastbuien=0;$buienradar=0;
$openweathermap=json_decode(curl('http://api.openweathermap.org/data/2.5/weather?id=2740729&APPID=ac3485c0bf1a02c81d2525dc6515021d&units=metric'),true);
if(isset($openweathermap['main']['temp'])) {
$owtemp=number_format((($s['buiten_temp']*3)+$openweathermap['main']['temp'])/4,1,".",".");
if($s['buiten_temp']!=$owtemp && $owtemp!=0) {
print stamp." --- UPDATE BUITEN_TEMP --- Current = ".$s['buiten_temp']." | openweather = ".number_format($openweathermap['main']['temp'],1,".",".")." | new = $owtemp
";
ud($i['buiten_temp'],0,$owtemp,'buiten_temp');
}
}
if(isset($openweathermap['wind']['speed'])) $owwind=number_format($openweathermap['wind']['speed'],2,".",".");
if(time>=strtotime('7:30') && time<=strtotime('23:59')) {
$forecast=json_decode(curl('https://api.forecast.io/forecast/2ee3cxed64ff39afc86fx29285x03310/50.7925552,3.0140885'),true);
if(isset($forecast['currently'])){
$forecastbuien = number_format($forecast['currently']['precipProbability']*20,0,".",".");
$forecastwind = number_format($forecast['currently']['windSpeed'],0,".",".");
}
}
$rains=curl('http://gps.buienradar.nl/getrr.php?lat=50.7925552&lon=3.0140885');
$rains=str_split($rains,11);$totalrain=0;$aantal=0;
foreach($rains as $rain){$aantal=$aantal+1;$totalrain=$totalrain+substr($rain,0,3);$buienradar=number_format($totalrain/$aantal,0,".",".");if($aantal==7)break;}
$newbuienradar = number_format((($s['buienradar'] * 4) + max($forecastbuien, $buienradar)) /5,0,".",".");
$wind = number_format((($s['wind'] * 4) + max($forecastwind, $owwind)) /5,0,".",".");
if(number_format($s['buienradar'],0) != $newbuienradar) {
$msg = stamp." --- UPDATE BUIENRADAR --- Current = ".number_format($s['buienradar'],0,".",".");
if($buienradar) $msg .= " | buienradar = $buienradar";else $msg .= " ";
if($forecast['currently']['precipProbability']) $msg .= " | forecastbuien = ".number_format($forecastbuien,0,".",".");else $msg .= " ";
if($newbuienradar) $msg .= " | new = $newbuienradar";
$msg .= "
";
ud($i['buienradar'],0,$newbuienradar,'buienradar');
print $msg;
}
if($s['wind'] != $wind) {
$msg = stamp." --- UPDATE WIND --- Current = ".number_format($s['wind'],0);
if($owwind) $msg .= " | owwind = $owwind ";else $msg .= " ";
if($forecastwind) $msg .= " | forecastwind = $forecastwind";else $msg .= " ";
$msg .= " | new = $wind
";
ud($i['wind'],0,$wind,'wind');
print $msg;
}
Re: Open Weather map
Posted: Sunday 10 July 2016 9:49
by Toulon7559
This discussion triggered me to look in Domoticz to the values/loggings for info coming from forecast.io.
Resemblance with the actual, local measuments is 'doubtful'.
Especially looking at SolarRadiation, I am puzzled, because even at midnight the value is >300W/m^2, and in the logging I see 'hicks' every 4 hours.
Can somebody give a simple explanation for the values and diagrams based on info from forecast.io?
Re: Open Weather map
Posted: Sunday 10 July 2016 10:02
by Egregius
There are even hicks in the temperature. One minute it's 16.2 degrees, a minute later 17.2, and another minute later again 16.2.
It are just sites that provide data, it's up to us to handle upon it.
Like for termperature I recently changed my script so that I don't take changes bigger than 0,1 degree. Since the script runs every minute that's enough.
Re: Open Weather map
Posted: Sunday 10 July 2016 17:02
by Toulon7559
@Egregius
A forecast with a temperature-jump of 1 degree is something you can filter, but in Domoticz a SolarRadiation-value of >300W/m^2 at midnight is just 'strange'.
Looking further, also a max. value in the actual 7day-logging for 8th of July, 19:00hours of 345W/m^2 is far from reality, because peak-radiation should be at each mid-day, and probably a (much) higher value.
Therefore the question: what is forecast.io predicting for SolarRadiation?
Any hint where to find descriptions for parameters and for prediction-context?
Re: Open Weather map
Posted: Sunday 10 July 2016 18:31
by Egregius
I have no clue where they get their data. I use my own solar panels as giant lightmeter.
Re: Open Weather map
Posted: Sunday 10 July 2016 19:07
by Toulon7559

Chicken & Egg
Would like to see from forecast how many W/m^2 to be expected, and then compare with actual solar production.
Re: Open Weather map
Posted: Tuesday 26 July 2016 13:59
by fantom
I implemented OpenWeatherMap a few days ago (as normal hardware).
But there is a bug (reported from forum). I will found and fix it (maybe today).
Fantom