Page 4 of 20

Re: Buienradar Weather Lookup Plugin

Posted: Wednesday 15 February 2017 22:44
by ffes
I did play a bit on how to separate the devices. It is a bit of work, but certainly doable.

I need to find a reliable way to determine if a device is "temperature" or "temp+hum+baro". I think I have to examine the sValue for that because the TypeName is only used when creating a device and can not read from like "Devices[1].TypeName".

But for now, it becoming too late. Tomorrow will be another busy day at the office.

Re: Buienradar Weather Lookup Plugin

Posted: Wednesday 15 February 2017 22:54
by Brutus
ffes wrote:I did play a bit on how to separate the devices. It is a bit of work, but certainly doable.

I need to find a reliable way to determine if a device is "temperature" or "temp+hum+baro". I think I have to examine the sValue for that because the TypeName is only used when creating a device and can not read from like "Devices[1].TypeName".

But for now, it becoming too late. Tomorrow will be another busy day at the office.
Sounds nice! Thnx for the time and work you put in this plugin!

Re: Buienradar Weather Lookup Plugin

Posted: Wednesday 15 February 2017 23:53
by Snowtiger
ffes wrote:I did play a bit on how to separate the devices. It is a bit of work, but certainly doable.

I need to find a reliable way to determine if a device is "temperature" or "temp+hum+baro". I think I have to examine the sValue for that because the TypeName is only used when creating a device and can not read from like "Devices[1].TypeName".

But for now, it becoming too late. Tomorrow will be another busy day at the office.
I think maybe some info is present in this Python sub forum thread - viewtopic.php?t=15535
This plugin is working out well, great work :)

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 4:01
by Dnpwwo
@ffes,

Maybe you could allow users to choose whether they want separate or combined devices via a drop down in the Hardware page?

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 8:32
by Brutus
Dnpwwo wrote:@ffes,

Maybe you could allow users to choose whether they want separate or combined devices via a drop down in the Hardware page?
If that's possible you serve everyone I think ;)

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 10:15
by ffes
Dnpwwo wrote:Maybe you could allow users to choose whether they want separate or combined devices via a drop down in the Hardware page?
Yep, that is the plan.

But it is impossible to get the TypeName, to determine if I need to (re)create devices when the user updates his/her choice on the hardware page. I took a look at the code and assume it is only one extra line to CDevice_members[] (PluginManager.cpp L860). For me getting a magic number is fine at the moment. Not that much of a Python guy to know if and how consts in Python work (let alone how to add consts in the plugin manager).

The forum thread @snowtiger is mentioning is only about setting the type as a "TypeName" instead of a magic number field "Type" during creating.

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 12:05
by EldigoR
ffes wrote:I would make my life more difficult because the combined temp+hum+baro wants other values for BAR_FOR then the plain Barometer device: https://www.domoticz.com/wiki/Domoticz_ ... #Barometer
Did some searching regarding the Barometer forecast but to really forecast the weather, you will need pressure history. So I wouldn’t bother with that, keep things simple as you do now and use the "temp+hum+baro" device ;)

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 14:22
by Dnpwwo
@ffes,

There are a couple of ways to handle the device types.

For some of the plugins I've done I took an approach of simply creating all possible devices on startup if (len(Devices) == 0). As long as your code then checks a Device exists before updating it (which yours does because use are using the UpdateDevice helper function) then people can delete the ones they don't want. As long as they don't delete them all the extra ones won't be recreated.

Alternatively just give the devices different Unit numbers. Say, Unit 1 for combined and units 2,3 & 4 for the separate ones. That way you can check at startup that the units exist that match the parameter and take the corrective answer if not.

Out of the 2 I personally prefer the first.

Re: Buienradar Weather Lookup Plugin

Posted: Thursday 16 February 2017 19:54
by Snowtiger
If you are using MQTT - do not update to latest beta available Version: V3.6722 yet - Domoticz will fail - see Bugs topic in forum

Re: Buienradar Weather Lookup Plugin

Posted: Friday 17 February 2017 9:42
by ffes
This is what I am going to do:

I will add two settings to the hardware page:
  • Combined temperature and humidity [Yes/no]
  • Add Wind chill to wind device [Yes/No]
And I will add a separate barometer device. Combining the barometer only has disadvantages. It is shown separately in the interface anyway, but when you combine the three and mark the temp/hum as favorite, the barometer will show in you dashboard as well.

When you do not combine the temperature and humidity, you will get two separate device. Know that temperature and humidity have a direct link. A colleague explained the psychics behind this a bit.

When you do not add the wind chill you will not see this information at all. There is no "apparent temperature" device in domoticz.

Know that the apparent temperature is not the same as Wind Chill. Wind Chill is only calculated for temps < 10C. For higher temperatures you need to take the humidity into account. It is called the "heat index", but that is only calculated for temps > 27C, so not too common in NL ;)
https://en.wikipedia.org/wiki/Apparent_temperature
https://en.wikipedia.org/wiki/Heat_index

Re: Buienradar Weather Lookup Plugin

Posted: Friday 17 February 2017 17:50
by schulpr
Hi ffes,

I changed line 58 in plugin.py from 15 to 10, restarted Domoticz, but the refresh rate is still 15 minutes. Do I need to change or do something else to change it?

Kind regards, Rob

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 12:03
by Snowtiger
sander815 wrote:i deleted the plugin in hardware, redownloaded it from git, but now i cannot add it anymore. I can select it, but the add button does nothing?
did you restart Domoticz? This will help some times ;)

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 12:46
by Henk50
Today I installed Buienradar on the latest beta V3.6749.
Buienradar is in the hardware, but after configuring in de log will come the error:
2017-02-19 12:37:53.738 Error: (Buienradar) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-buienradar/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-02-19 12:37:53.738 Error: (Buienradar-VDaal) Module Import failed, exception: 'SyntaxError'
2017-02-19 12:37:53.738 Error: (Buienradar-VDaal) Import detail: File: /home/pi/domoticz/plugins/domoticz-buienradar/buienradar.py, Line: 1908899872, offset: 293
2017-02-19 12:37:53.738 Error: (Buienradar-VDaal) Error Line ' if self.humidity >= 35 and self.humidity =< 65:
'
Looks to be a syntax error? How can I fix this?

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 14:17
by Arduinomn
Edit the file, change
self.humidity =< 65:
Into
self.humidity <= 65:

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 14:56
by ffes
This bug has been fix the repository earlier today.
https://github.com/ffes/domoticz-buienr ... bb470d6d0e

At the moment I am working on "selecting the combined devices or not". Still some minor hiccups in the code, but I getting there.

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 15:41
by Henk50
Install the plugin again and it's working now. Thnx!
Maybe you can add in the documentation that you also have to install python3-dev? Thanx for this in previous post.

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 17:47
by ffes
I just updated the repository. At the moment the plugin is quite complete. Temperature, humidity and barometer devices are supported.

To update an existing installation know that you need to restart Domoticz and remove all the devices and restart again, so the new devices can be added matching your preferences. Unfortunately you will loose the history of those devices.

I think I will need to contribute to the python plugin manager to get some of the features that I would love to have for this plugin to work ever more easily, like getting the location (lat,lon) from Domoticz instead of asking the user for duplicate information.

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 18:01
by schulpr
Hi ffes,

Works great! Thank you very much for all the work you put into this.

Kind regards, Rob

Edit: A bit to quick in my response:

2017-02-19 17:58:29.018 Error: (Buienradar) 'onStart' failed 'TypeError':'type NoneType doesn't define __round__ method'.
2017-02-19 17:58:29.018 Error: (Buienradar) ----> Line 79 in /home/pi/domoticz/plugins/domoticz-buienradar/plugin.py, function onStart
2017-02-19 17:58:29.018 Error: (Buienradar) ----> Line 186 in /home/pi/domoticz/plugins/domoticz-buienradar/plugin.py, function fillDevices

Little bug?

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 18:18
by ffes
Works for me. That line is setting the barometer.

What is the weather station that is selected for your location?
Is there a barometer value in the logs from that station?

Only now see that not all the stations have a value for <luchtdruk> :-?

Re: Buienradar Weather Lookup Plugin

Posted: Sunday 19 February 2017 19:22
by Henk50
hi ffes,
Delete hardware in domoticz-hardware, delete buienradar directory in plugins and install again. Restart domoticz and add hardware.
Works perfect:
2017-02-19 19:09:01.646 (Buienr-VDaal) Initialized version 1.0, author 'ffes'
2017-02-19 19:09:01.699 (Buienr-VDaal) Retrieve weather data from http://xml.buienradar.nl/
2017-02-19 19:09:01.823 (Buienr-VDaal) Found Meetstation Arnhem at 23.0 km from your home location
2017-02-19 19:09:01.824 (Buienr-VDaal) Temperature: 5.0
2017-02-19 19:09:01.824 (Buienr-VDaal) Wind Speed: 2.72
2017-02-19 19:09:01.824 (Buienr-VDaal) Wind Bearing: 231.0
2017-02-19 19:09:01.824 (Buienr-VDaal) Wind Direction: SW
2017-02-19 19:09:01.824 (Buienr-VDaal) Wind Speed Gusts: 3.7
2017-02-19 19:09:01.824 (Buienr-VDaal) Wind Chill: 2.7
2017-02-19 19:09:01.825 (Buienr-VDaal) Barometer: 1020.44
2017-02-19 19:09:01.825 (Buienr-VDaal) Barometer Forecast: 0
2017-02-19 19:09:01.825 (Buienr-VDaal) Humidity: 98
2017-02-19 19:09:01.825 (Buienr-VDaal) Humidity status: 3
Many thanks!