updateWeatherSensors (yet another buienradar script)

Freemann
Posts: 95
Joined: Thursday 24 November 2016 15:55
Target OS: Raspberry Pi
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann » Tuesday 04 December 2018 0:07

I'm also getting the updateWeatherSensors:1195 error.
How to prevent of fix it?

Code: Select all

2018-12-04 08:38:00.258 Status: dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua:, trigger: every minute
2018-12-04 08:38:00.304 Status: dzVents: Info: WUS: ------ Finished updateWeatherSensors.lua
2018-12-04 08:38:01.307 Status: dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua: HTTPResponse: "WUS_addressResponse"
2018-12-04 08:38:01.346 Status: dzVents: Error (2.4.8): WUS: An error occured when calling event handler updateWeatherSensors
2018-12-04 08:38:01.346 Status: dzVents: Error (2.4.8): WUS: ...omoticz/scripts/dzVents/scripts/updateWeatherSensors.lua:1195: attempt to index field '?' (a nil value)
2018-12-04 08:38:01.346 Status: dzVents: Info: WUS: ------ Finished updateWeatherSensors.lua
Domotica/graphs "freak" :)
Rpi3
Amazon Alexa (2 Echo Dots)
Aeotec Z-Stick S2(Gen5)
HarmonyElite
ETHRelayBoard
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl

User avatar
waaren
Posts: 1352
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Tuesday 04 December 2018 11:04

Freemann wrote:
Tuesday 04 December 2018 0:07
I'm also getting the updateWeatherSensors:1195 error.
How to prevent of fix it?
Look here to see what is the cause of this error and for a howto get a google API key (effectively free)

I posted a new version (0.20181204) This version will check if you entered a google API key and use that to get your address, based on your set latitude / longitude, from google maps.
If you don't have this API key it will skip this part and assume "Nederland" as your address
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Freemann
Posts: 95
Joined: Thursday 24 November 2016 15:55
Target OS: Raspberry Pi
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann » Wednesday 05 December 2018 9:17

I'm familiare with the GMap api, but I couldn't find a way to add the api to the previous version of the script.

Couldn't find it that fast in this topic/forum, but which values are based on the KNMI weatherstations and which are based on Buienradar API/calculations? For instance expected rain is, as far as I known, not available on the weatherstations so its must come from the Buienradar API.
So if its from the API, then its location is based on my Lat/Lng? So rain calculations are based on my domoticz location and not on the KNMI weatherstation location?

Or I'm i Wrong?

Thanks for the update and it working like a charm!
Domotica/graphs "freak" :)
Rpi3
Amazon Alexa (2 Echo Dots)
Aeotec Z-Stick S2(Gen5)
HarmonyElite
ETHRelayBoard
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl

User avatar
waaren
Posts: 1352
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Wednesday 05 December 2018 11:29

Freemann wrote:
Wednesday 05 December 2018 9:17
I'm familiare with the GMap api, but I couldn't find a way to add the api to the previous version of the script.

Couldn't find it that fast in this topic/forum, but which values are based on the KNMI weatherstations and which are based on Buienradar API/calculations? For instance expected rain is, as far as I known, not available on the weatherstations so its must come from the Buienradar API.
So if its from the API, then its location is based on my Lat/Lng? So rain calculations are based on my domoticz location and not on the KNMI weatherstation location?

Or I'm i Wrong?

Thanks for the update and it working like a charm!
You are right. Thanks for pointing that out !
Rain forecast devices (text, alert and two custom sensors) are always based on the result of the call to https://gadgets.buienradar.nl with the lat/lon from domoticz settings.This is a fault in the logic. I have corrected it now but still testing. Will post an update later today.

If useDomoticzLocation is set to true, all other devices are based on the weatherstation information ( buienradar )
from the station nearest to this lat/lon or (optional) if the required part of the data is not available at that station it will travel the list of weatherstations from nearby to further away to find a station that does have this part of the data.
If useDomoticzLocation is set to false, the information will be extracted from the named weatherstation.

The call to Google Maps (which now must use the GMap api ) is only used to translate the lat/lon to a more detailed than "Nederland" human readable address.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Freemann
Posts: 95
Joined: Thursday 24 November 2016 15:55
Target OS: Raspberry Pi
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann » Thursday 06 December 2018 20:46

Thanks for the explanation and great to read that rain information is really local!

Would it be possible to use the script without the Gmaps call? So the use post/add the looked up data to the script itself?
Domotica/graphs "freak" :)
Rpi3
Amazon Alexa (2 Echo Dots)
Aeotec Z-Stick S2(Gen5)
HarmonyElite
ETHRelayBoard
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl

User avatar
waaren
Posts: 1352
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Thursday 06 December 2018 22:48

Freemann wrote:
Thursday 06 December 2018 20:46
Thanks for the explanation and great to read that rain information is really local!

Would it be possible to use the script without the Gmaps call? So the use post/add the looked up data to the script itself?
Not sure what you mean with "post/add the looked up data to the script itself?" Please elaborate.
In the latest update it is possible to skip the Gmaps call by setting googleAPIkey = false in the setting file.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Freemann
Posts: 95
Joined: Thursday 24 November 2016 15:55
Target OS: Raspberry Pi
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann » Friday 07 December 2018 14:24

You wrote;
"The call to Google Maps (which now must use the GMap api ) is only used to translate the lat/lon to a more detailed than "Nederland" human readable address."

So the API call is used to get an Human Readable Address.
For what is that address used and why get it through a API call and not let the user set it through a variable in the settings script?
Domotica/graphs "freak" :)
Rpi3
Amazon Alexa (2 Echo Dots)
Aeotec Z-Stick S2(Gen5)
HarmonyElite
ETHRelayBoard
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl

User avatar
waaren
Posts: 1352
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Friday 07 December 2018 17:21

Freemann wrote:
Friday 07 December 2018 14:24
For what is that address used ?
for Display only
and why get it through a API call and not let the user set it through a variable in the settings script?
Same reason as why I get the lat / lon from domoticz settings and not from the settings script. Because it is possible. Easy to add that as an option. Just ask.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

ronaldbro
Posts: 6
Joined: Thursday 15 November 2018 22:38
Target OS: Raspberry Pi
Domoticz version: beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by ronaldbro » Monday 10 December 2018 23:50

waaren wrote:
Tuesday 27 November 2018 21:03
ronaldbro wrote:
Sunday 18 November 2018 15:20
Hi waaren,

first of all thanks for this script. This is very cool and helpful :)

Do you have an update of the previous post? I'm having the same error.

Code: Select all

2018-11-18 14:17:00.308 Status: dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua:, trigger: every minute 
2018-11-18 14:17:00.450 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua 
2018-11-18 14:17:00.679 Status: dzVents: Info: Handling httpResponse-events for: "WUS_addressResponse 
2018-11-18 14:17:00.679 Status: dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua: HTTPResponse: "WUS_addressResponse" 
2018-11-18 14:17:00.717 Status: dzVents: Error (2.4.8): WUS: An error occured when calling event handler updateWeatherSensors 
2018-11-18 14:17:00.717 Status: dzVents: Error (2.4.8): WUS: ...omoticz/scripts/dzVents/scripts/updateWeatherSensors.lua:1195: attempt to index field '?' (a nil value) 
Unfortunatly I'm still in the beginning of the learning curve to lua and dzVents, so I'm not a big help yet ;)

Thanks for your help.

regards, Ronald
Sorry missed this one until now.
The only way to solve this is by getting a google API key. If you have one I will explain how to use it.
Thanks a lot Waaren. I upgraded to the latest version, got the google API key and it all works fine now.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest