Buienradar Weather Lookup Plugin

Python and python framework

Moderator: leecollings

User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by Brutus »

I downloaded the latest files from github (Download ZIP). Overwrited the existing files and restarted Domoticz. See here the results:

Code: Select all

2017-02-14 14:06:29.854 (Buienradar) Initialized version 1.0, author 'ffes' 
2017-02-14 14:06:29.854 (Buienradar) Retrieve weather data from http://xml.buienradar.nl/ 
2017-02-14 14:06:29.948 (Buienradar) Found Meetstation Maastricht at 13.0 km from your home location 
2017-02-14 14:06:29.948 (Buienradar) Temperature: 10.7 
2017-02-14 14:06:29.948 (Buienradar) Wind Speed: 2.61 
2017-02-14 14:06:29.948 (Buienradar) Wind Bearing: 73.0 
2017-02-14 14:06:29.948 (Buienradar) Wind Direction: ENE 
2017-02-14 14:06:29.949 (Buienradar) Wind Speed Gusts: 3.8 
2017-02-14 14:06:29.949 Error: (Buienradar) 'onStart' failed 'NameError':'name 'temperature' is not defined'. 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 50 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\plugin.py, function onStart 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 114 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\plugin.py, function fillDevices 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 335 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\buienradar.py, function getWeather 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 177 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\buienradar.py, function getWindChill
The station now is only 13km from my location but now you see some errors in the log.

My sensor isn't working I think related to that error (from the devices list):
318 Buienradar 0010 1 Buienradar - Temperature Temp LaCrosse TX3 0.0 C
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
ffes
Posts: 51
Joined: Thursday 26 January 2017 23:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Buienradar Weather Lookup Plugin

Post by ffes »

@Brutus: My installation at home is broken in beta v3.6707 (see other post in this subforum). So I can not reproduce it at the moment. Will look into that as soon as I have a working server again.

@sander815: Create a directory named "plugins" and clone when you are in that directory. It will create a subdir for you. If you use the github-zip-download, create a directory yourself and put all the .py files in that subdir. I will update the readme a bit to explain how to install.
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by Brutus »

ffes wrote:@Brutus: My installation at home is broken in beta v3.6707 (see other post in this subforum). So I can not reproduce it at the moment. Will look into that as soon as I have a working server again.

@sander815: Create a directory named "plugins" and clone when you are in that directory. It will create a subdir for you. If you use the github-zip-download, create a directory yourself and put all the .py files in that subdir. I will update the readme a bit to explain how to install.
After installing version V3.6708 the plugin doesn't give any errors ;) :

Code: Select all

2017-02-14 17:57:24.208 (Buienradar) Initialized version 1.0, author 'ffes'
2017-02-14 17:57:24.209 (Buienradar) Retrieve weather data from http://xml.buienradar.nl/
2017-02-14 17:57:24.338 (Buienradar) Found Meetstation Maastricht at 13.0 km from your home location
2017-02-14 17:57:24.339 (Buienradar) Temperature: 8.5
2017-02-14 17:57:24.339 (Buienradar) Wind Speed: 3.36
2017-02-14 17:57:24.339 (Buienradar) Wind Bearing: 64.0
2017-02-14 17:57:24.339 (Buienradar) Wind Direction: ENE
2017-02-14 17:57:24.339 (Buienradar) Wind Speed Gusts: 3.9
2017-02-14 17:57:24.339 (Buienradar) Wind Chill: 6.5
2017-02-14 17:57:24.339 (Buienradar) Barometer: 1029.74
2017-02-14 17:57:24.340 (Buienradar) Barometer Forecast: 0
2017-02-14 17:57:24.340 (Buienradar) Humidity: 64
2017-02-14 17:57:24.340 (Buienradar) Humidity status: 1 
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Buienradar Weather Lookup Plugin

Post by schulpr »

I don't know why but I'm still not able to add the hardware after following the process. I upgraded Domoticz to v 3.6708.

Any suggestions?

Regards, Rob

Edit: problem solved after installing python3-dev.
Snowtiger
Posts: 120
Joined: Tuesday 18 October 2016 13:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10915
Contact:

Re: Buienradar Weather Lookup Plugin

Post by Snowtiger »

Wow - was looking for a Weather Underground replacement in Domoticz because of many false values and missing data - zoomed in on Buienradar XML info and stumbled into this plug-in - great work :!:
Let's see if I can get it to work ;)

Working, but for others some info - after setting up the plugin directory and restarting Domoticz I had no new Hardware - I was on Domoticz stable release

1. Set Domoticz in settings to the Bèta channel
2. Check for updates and let Domoticz update
3. Restart Domoticz - this has to be done after the update!
4. Now check Hardware - the new plugin is visible

Great job - well done ;)

One problem, I tried the localtest.py and got some errors :

Code: Select all

pi@raspberrypi:~/domoticz/plugins/domoticz-buienradar $ python3 localtest.py
Found Meetstation Voorschoten at 8.2 km from your home location
Temperature: 11.4
Wind Speed: 2.8
Wind Bearing: 144.0
Wind Direction: SE
Wind Speed Gusts: 4.1
Traceback (most recent call last):
  File "localtest.py", line 30, in <module>
    x.getWeather()
  File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 335, in getWeather
    Domoticz.Log("Wind Chill: " + str(self.getWindChill()))
  File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 177, in getWindChill
    return temperature
NameError: name 'temperature' is not defined
This is also visible in the Domoticz log
EldigoR
Posts: 41
Joined: Monday 12 October 2015 19:57
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by EldigoR »

Brutus wrote:I downloaded the latest files from github (Download ZIP). Overwrited the existing files and restarted Domoticz. See here the results:

Code: Select all

2017-02-14 14:06:29.854 (Buienradar) Initialized version 1.0, author 'ffes' 
2017-02-14 14:06:29.854 (Buienradar) Retrieve weather data from http://xml.buienradar.nl/ 
2017-02-14 14:06:29.948 (Buienradar) Found Meetstation Maastricht at 13.0 km from your home location 
2017-02-14 14:06:29.948 (Buienradar) Temperature: 10.7 
2017-02-14 14:06:29.948 (Buienradar) Wind Speed: 2.61 
2017-02-14 14:06:29.948 (Buienradar) Wind Bearing: 73.0 
2017-02-14 14:06:29.948 (Buienradar) Wind Direction: ENE 
2017-02-14 14:06:29.949 (Buienradar) Wind Speed Gusts: 3.8 
2017-02-14 14:06:29.949 Error: (Buienradar) 'onStart' failed 'NameError':'name 'temperature' is not defined'. 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 50 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\plugin.py, function onStart 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 114 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\plugin.py, function fillDevices 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 335 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\buienradar.py, function getWeather 
2017-02-14 14:06:29.949 Error: (Buienradar) ----> Line 177 in C:\Program Files (x86)\Domoticz\plugins\domoticz-buienradar\buienradar.py, function getWindChill
The station now is only 13km from my location but now you see some errors in the log.

My sensor isn't working I think related to that error (from the devices list):
318 Buienradar 0010 1 Buienradar - Temperature Temp LaCrosse TX3 0.0 C
Small error in plugins\domoticz-buienradar\buienradar.py line 177

Code: Select all

return temperature
should be

Code: Select all

return self.temperature
Snowtiger
Posts: 120
Joined: Tuesday 18 October 2016 13:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10915
Contact:

Buienradar Weather Lookup Plugin

Post by Snowtiger »

Thx @EldigoR - changed it and now works as a charm ;)
Buienradar Temperature is now correctly filled...
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

Please help. I did the following:

-Installed Python
-Created a plugins directory.
-Downloaded the plugin :

pi@raspberrypi:~/domoticz/plugins/domoticz-buienradar$ ls -al
total 124
drwxr-xr-x 4 pi pi 4096 Feb 15 14:22 .
drwxr-xr-x 3 pi pi 4096 Feb 15 13:51 ..
-rw-r--r-- 1 pi pi 10407 Feb 15 13:51 buienradar.py
-rw-r--r-- 1 pi pi 65741 Feb 15 13:58 buienradar.xml
-rw-r--r-- 1 pi pi 196 Feb 15 13:51 .editorconfig
-rw-r--r-- 1 pi pi 368 Feb 15 13:51 fakeDomoticz.py
-rw-r--r-- 1 pi pi 475 Feb 15 14:22 fakeDomoticz.pyc
drwxr-xr-x 8 pi pi 4096 Feb 15 13:51 .git
-rw-r--r-- 1 pi pi 29 Feb 15 13:51 .gitignore
-rw-r--r-- 1 pi pi 810 Feb 15 13:51 localtest.py
-rw-r--r-- 1 pi pi 3955 Feb 15 13:51 plugin.py
drwxr-xr-x 2 pi pi 4096 Feb 15 14:08 __pycache__
-rw-r--r-- 1 pi pi 2726 Feb 15 13:51 ReadMe.md

-Restarted Domoticz and even de complete Pi

But no Buienradar in the hardware list

A python3 localtest.py gives:

Found Meetstation Voorschoten at 8.2 km from your home location
Temperature: 12.1
Wind Speed: 4.35
Wind Bearing: 154.0
Wind Direction: SE
Wind Speed Gusts: 5.3
Traceback (most recent call last):
File "localtest.py", line 30, in <module>
x.getWeather()
File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 335, in getWeather
Domoticz.Log("Wind Chill: " + str(self.getWindChill()))
File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 177, in getWindChill
return temperature
NameError: name 'temperature' is not defined

Can somebody tell me what to do?
Snowtiger
Posts: 120
Joined: Tuesday 18 October 2016 13:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10915
Contact:

Re: Buienradar Weather Lookup Plugin

Post by Snowtiger »

fkok wrote:Please help. I did the following:

-Installed Python
-Created a plugins directory.
-Downloaded the plugin :

pi@raspberrypi:~/domoticz/plugins/domoticz-buienradar$ ls -al
total 124
drwxr-xr-x 4 pi pi 4096 Feb 15 14:22 .
drwxr-xr-x 3 pi pi 4096 Feb 15 13:51 ..
-rw-r--r-- 1 pi pi 10407 Feb 15 13:51 buienradar.py
-rw-r--r-- 1 pi pi 65741 Feb 15 13:58 buienradar.xml
-rw-r--r-- 1 pi pi 196 Feb 15 13:51 .editorconfig
-rw-r--r-- 1 pi pi 368 Feb 15 13:51 fakeDomoticz.py
-rw-r--r-- 1 pi pi 475 Feb 15 14:22 fakeDomoticz.pyc
drwxr-xr-x 8 pi pi 4096 Feb 15 13:51 .git
-rw-r--r-- 1 pi pi 29 Feb 15 13:51 .gitignore
-rw-r--r-- 1 pi pi 810 Feb 15 13:51 localtest.py
-rw-r--r-- 1 pi pi 3955 Feb 15 13:51 plugin.py
drwxr-xr-x 2 pi pi 4096 Feb 15 14:08 __pycache__
-rw-r--r-- 1 pi pi 2726 Feb 15 13:51 ReadMe.md

-Restarted Domoticz and even de complete Pi

But no Buienradar in the hardware list

A python3 localtest.py gives:

Found Meetstation Voorschoten at 8.2 km from your home location
Temperature: 12.1
Wind Speed: 4.35
Wind Bearing: 154.0
Wind Direction: SE
Wind Speed Gusts: 5.3
Traceback (most recent call last):
File "localtest.py", line 30, in <module>
x.getWeather()
File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 335, in getWeather
Domoticz.Log("Wind Chill: " + str(self.getWindChill()))
File "/home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py", line 177, in getWindChill
return temperature
NameError: name 'temperature' is not defined

Can somebody tell me what to do?
For the error in the localtest.py - see 2 posts above
For the no hardware - did you read my post about Bèta release and restarts?
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

Yes i did snow tiger. Did exactly what is described in the posts. But no buienradar in the hardware list.

I created the plugins dir myself. Is that a problem?
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Buienradar Weather Lookup Plugin

Post by schulpr »

fkok wrote:Yes i did snow tiger. Did exactly what is described in the posts. But no buienradar in the hardware list.

I created the plugins dir myself. Is that a problem?
Did you also installed python3-dev? That did the trick for me.

I installed the folder plugins myself. No problem.
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

schulpr wrote:
fkok wrote:Yes i did snow tiger. Did exactly what is described in the posts. But no buienradar in the hardware list.

I created the plugins dir myself. Is that a problem?
Did you also installed python3-dev? That did the trick for me.

I installed the folder plugins myself. No problem.
How do i install the dev version? and is this possible when python 3.4 is already installed?
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

fkok wrote:
schulpr wrote:
fkok wrote:Yes i did snow tiger. Did exactly what is described in the posts. But no buienradar in the hardware list.

I created the plugins dir myself. Is that a problem?
Did you also installed python3-dev? That did the trick for me.

I installed the folder plugins myself. No problem.
How do i install the dev version? and is this possible when python 3.4 is already installed?
pi@raspberrypi:~/domoticz$ sudo apt install libpython-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpython-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Buienradar Weather Lookup Plugin

Post by schulpr »

fkok wrote:
schulpr wrote:
fkok wrote:Yes i did snow tiger. Did exactly what is described in the posts. But no buienradar in the hardware list.

I created the plugins dir myself. Is that a problem?
Did you also installed python3-dev? That did the trick for me.

I installed the folder plugins myself. No problem.
How do i install the dev version? and is this possible when python 3.4 is already installed?
sudo apt-get install python3-dev.

Yes, that's possible.
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

schulpr wrote:
fkok wrote:
schulpr wrote: Did you also installed python3-dev? That did the trick for me.

I installed the folder plugins myself. No problem.
How do i install the dev version? and is this possible when python 3.4 is already installed?
sudo apt-get install python3-dev.

Yes, that's possible.
That did the trick!!! Thanks!!!
fkok
Posts: 29
Joined: Thursday 19 January 2017 9:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Buienradar Weather Lookup Plugin

Post by fkok »

Is it true that this installation creates only one temperature sensor/Device?

The plugin retrieves more value's then the temperature....

2017-02-15 16:05:47.175 (Buienradar) Devices created.
2017-02-15 16:05:47.175 (Buienradar) Retrieve weather data from http://xml.buienradar.nl/
2017-02-15 16:05:47.319 (Buienradar) Temperature: 13.2
2017-02-15 16:05:47.319 (Buienradar) Wind Speed: 3.38
2017-02-15 16:05:47.319 (Buienradar) Wind Bearing: 146.0
2017-02-15 16:05:47.319 (Buienradar) Wind Direction: SE
2017-02-15 16:05:47.319 (Buienradar) Wind Speed Gusts: 5.5
2017-02-15 16:05:47.319 (Buienradar) Wind Chill: 13.2
2017-02-15 16:05:47.319 (Buienradar) Barometer: 1030.83
2017-02-15 16:05:47.319 (Buienradar) Barometer Forecast: 0
2017-02-15 16:05:47.319 (Buienradar) Humidity: 55
2017-02-15 16:05:47.319 (Buienradar) Humidity status: 1

Sorry for the newbie questions.... ;)
Snowtiger
Posts: 120
Joined: Tuesday 18 October 2016 13:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10915
Contact:

Buienradar Weather Lookup Plugin

Post by Snowtiger »

fkok wrote:Is it true that this installation creates only one temperature sensor/Device?

The plugin retrieves more value's then the temperature....

2017-02-15 16:05:47.175 (Buienradar) Devices created.
2017-02-15 16:05:47.175 (Buienradar) Retrieve weather data from http://xml.buienradar.nl/
2017-02-15 16:05:47.319 (Buienradar) Temperature: 13.2
2017-02-15 16:05:47.319 (Buienradar) Wind Speed: 3.38
2017-02-15 16:05:47.319 (Buienradar) Wind Bearing: 146.0
2017-02-15 16:05:47.319 (Buienradar) Wind Direction: SE
2017-02-15 16:05:47.319 (Buienradar) Wind Speed Gusts: 5.5
2017-02-15 16:05:47.319 (Buienradar) Wind Chill: 13.2
2017-02-15 16:05:47.319 (Buienradar) Barometer: 1030.83
2017-02-15 16:05:47.319 (Buienradar) Barometer Forecast: 0
2017-02-15 16:05:47.319 (Buienradar) Humidity: 55
2017-02-15 16:05:47.319 (Buienradar) Humidity status: 1

Sorry for the newbie questions.... ;)
These values are all retrieved but up until now only Temperature is saved in a Sensor called Buienradar Temperature ;) - see the first post in this thread :)
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Buienradar Weather Lookup Plugin

Post by schulpr »

I hope that the available data will soon be available in a dummy sensor. Then I can stop with all the other API based plugins. Unfortunately I don't have the knowledge to do this myself :evil:.

Is there a way to adjust the time interval? Buienradar is updated every 10 minutes. It would be nice that the plugin can handle the same refresh rate.

Regards, Rob
ffes
Posts: 51
Joined: Thursday 26 January 2017 23:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Buienradar Weather Lookup Plugin

Post by ffes »

Thanks you all for spotting the bug in getWindChill(). You are right, it should be self.temperature. When I coded it, it was too cold to find this error :?

I've committed this fix to the repo. Do "git pull" or download the lastest zip from github to update.

I also added the code to add the wind device. To get the wind device you need to delete the temperature device bound to this hardware, or remove the plugin from the hardware page and reinstall. That is because as long as there is at least one device no other (in this case: new) device are added. Know that removing the device (directly or indirectly by deleting the hardware) will lose your temperature history.

I'm not sure whether go combine temperature, humidity and barometer into one or two devices or make three separate devices for that. Not sure what is best practice/most common/most desired.
ffes
Posts: 51
Joined: Thursday 26 January 2017 23:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Buienradar Weather Lookup Plugin

Post by ffes »

Is there a way to adjust the time interval? Buienradar is updated every 10 minutes. It would be nice that the plugin can handle the same refresh rate.
At the moment 15 minutes is hard coded at line 58 in plugin.py. You can adjust the value. I think I will change the interval to an option you can set on the hardware page.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest