updateWeatherSensors (yet another buienradar script)  [SOLVED]

Moderator: leecollings

Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann »

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" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Freemann wrote: Monday 03 December 2018 23: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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann »

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" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Freemann wrote: Wednesday 05 December 2018 8: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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann »

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" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Freemann wrote: Thursday 06 December 2018 19: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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Freemann »

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" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Freemann wrote: Friday 07 December 2018 13: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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
ronaldbro
Posts: 327
Joined: Thursday 15 November 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by ronaldbro »

waaren wrote: Tuesday 27 November 2018 20:03
ronaldbro wrote: Sunday 18 November 2018 14: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.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

Hi All,

The script special part LUX is not working. Or seems not to work. The values are change so fast from around 2000 lux to 0
So in past Lux values go low from 1000 >900 >700 > 600 etc... till 0. For me when lux is below 696 then turn on lights.

Also the high values are to high I think?
Screen Shot 2019-06-05 at 10.51.17.png
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

poudenes wrote: Wednesday 05 June 2019 10:56 The script special part LUX is not working. Or seems not to work. The values are change so fast from around 2000 lux to 0
So in past Lux values go low from 1000 >900 >700 > 600 etc... till 0. For me when lux is below 696 then turn on lights.
Also the high values are to high I think?
The LUX function used in the script is based on the solar radiation data from buienradar and I explained in the comments (line 24-30) that this was experimental and especial in the higher ranges not very accurate. I certainly would not want to control my lights in the house based on these values. In fact I use the production of my solarpanels to determine the amount of light.
If you now encounter a different behavior then a couple of months ago the only explanation I have, is that you receive different values from your nearby weather-station for solar radiation. I see more or less comparable values this year then I see over last year.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Steef »

I hope you guys can help me.

After a fresh install of Domoticz, I am trying to get the updateWeatherSensors script up and running again, but because a (for me :lol:) mysterious reason, the data is not coming into Domoticz.

The Domoticz log isn't showing any errors.

I already modified the permission for the weather scripts and _data_updateWeatherSensors.lua, so I think that shouldn't be a limitation too.

Does anyone have any idea why the data isn't loaded into Domoticz?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Steef wrote: Sunday 28 July 2019 14:16 After a fresh install of Domoticz, I am trying to get the updateWeatherSensors script up and running again
The Domoticz log isn't showing any errors.
First question that comes into my mind: is the event system and dzVents enabled in your newly setup domoticz ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Steef »

waaren wrote: Sunday 28 July 2019 22:32
Steef wrote: Sunday 28 July 2019 14:16 After a fresh install of Domoticz, I am trying to get the updateWeatherSensors script up and running again
The Domoticz log isn't showing any errors.
First question that comes into my mind: is the event system and dzVents enabled in your newly setup domoticz ?
Yes, both the Event System and dzVents are active.

In the log, it gives the following line:
2019-07-29 08:55:00.344 Status: dzVents: Info: WUS: ------ Finished updateWeatherSensors.lua
So I guess it can find the scripts as well.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Steef wrote: Monday 29 July 2019 9:01 Yes, both the Event System and dzVents are active.
OK.
Can you change line

Code: Select all

        logLevel                  = dzW.LOG_ERROR;              -- DEBUG,INFO, ERROR
to

Code: Select all

        logLevel                  = dzW.LOG_DEBUG;              -- DEBUG,INFO, ERROR
In the file <domoticz dir>/scripts/dzVents/scripts/modules/wusSettings.lua ?

When the script executes it will show a lot more information in your domoticz logfile
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Steef »

Thanks for your quick reply! It is showing more information indeed:

2019-07-29 10:06:00.543 Status: dzVents: Debug: WUS: getFunctions loaded
2019-07-29 10:06:00.545 Status: dzVents: Debug: WUS: Debug modus geactiveerd maar (C)URL(e) meldingen werden niet geladen
2019-07-29 10:06:00.545 Status: dzVents: Debug: WUS:
2019-07-29 10:06:00.545
2019-07-29 10:06:00.545 Zou ik http://127.0.0.1:8080/json.htm?type=settings moeten uitvoeren ?
2019-07-29 10:06:00.545 Zou ik https://maps.googleapis.com/maps/api/ge ... key=apiKey moeten uitvoeren ?
2019-07-29 10:06:00.545 var.useDomoticzLocation: true
2019-07-29 10:06:00.545 dz.data.domoticzLatitude: xx.xxxxxx
2019-07-29 10:06:00.545 dz.data.domoticzLongitude: x.xxxxxx
2019-07-29 10:06:00.545 now.hour: 10
2019-07-29 10:06:00.545 now.minutes: 6
2019-07-29 10:06:00.545
2019-07-29 10:06:00.545
2019-07-29 10:06:00.545 Status: dzVents: Debug: WUS: Nog geen apiKey. Lees hoe op https://cloud.google.com/maps-platform/ ... t-changes/
2019-07-29 10:06:00.545 Status: dzVents: Debug: WUS: dz.data.minutesPastExecution: 7 minuten na laatste uitvoering. Wordt nu niet uitgevoerd.

In the log, the system is asking for the Google API key, but I thought it was not necessary?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Steef wrote: Monday 29 July 2019 10:11 asking for the Google API key, but I thought it was not necessary?
Cannot remember. But will have a look later today.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

Steef wrote: Monday 29 July 2019 10:11 asking for the Google API key, but I thought it was not necessary?
I checked and indeed Google API key is nice to have but latest version of the script (20181205) should also work without one. Only thing missing will be detailed address information.
Please share your settings file if you don't see anything else in the log (blank out any private stuff and feel free to PM).
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr »

Hi,

I started with a fresh installation but getting this error now:
2019-08-07 08:24:01.075 Error: dzVents: Error: (2.4.26) WUS: An error occurred when calling event handler updateWeatherSensors
2019-08-07 08:24:01.075 Error: dzVents: Error: (2.4.26) WUS: ...omoticz/scripts/dzVents/scripts/updateWeatherSensors.lua:516: attempt to index field '?' (a nil value)
I tried changing the station names "Lelystad", "Meetstation Lelystad" (called like this in the JSON info) and "true" so the location info from Domoticz is used. No solution so far.

Any ideas, tips?

Kind regards, Rob
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren »

schulpr wrote: Wednesday 07 August 2019 8:29 I tried changing the station names "Lelystad", "Meetstation Lelystad" (called like this in the JSON info) and "true" so the location info from Domoticz is used. No solution so far.

Any ideas, tips?
myWeatherStation "Lelystad" (with the quotes) or useDomoticzLocation true (without quotes and when location is set in domoticz setiings) should work .

Can you change line

Code: Select all

        logLevel                  = dzW.LOG_ERROR;              -- DEBUG,INFO, ERROR
to

Code: Select all

        logLevel                  = dzW.LOG_DEBUG;              -- DEBUG,INFO, ERROR
In the file <domoticz dir>/scripts/dzVents/scripts/modules/wusSettings.lua ?

When the script executes it will show a lot more information in your domoticz logfile
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests