Python Plugin: WuDirect interface for Personal Weather Stations

Python and python framework

Moderator: leecollings

Martijn684
Posts: 10
Joined: Friday 02 March 2018 12:26
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Netherlands
Contact:

Python Plugin: WuDirect interface for Personal Weather Stations

Post by Martijn684 »

I made a Domoticz Python plugin for direct reception and parsing of Wunderground-formatted Weatherstation data.
It has been developed for the following (identical) Personal Weather Stations:
  • Fine Offset WH2900
  • Alecto WS-5500 (used for development and testing)
  • Ambient Weather WS-2902A

These PWS's are configured with an app "WS View" which allows sending Wunderground-formatted data to
a custom IP address. This IP address should be directed to the IP address of the Domoticz server,
and a configurable port number (default 8008).

Devices

The plugin provides *separate* devices for each received data item, which are meant to be used for events.
If you set the PWS to output weather data every 60 seconds, Domoticz can respond to e.g. wind gusts 10 times quicker
than the polling rate of the Weather Underground website allows. Note that the Domoticz *logging* system has a smallest
time interval of 5 minutes, so logged trends for these devices will not have a 60 seconds resolution. Still, the event
system can handle it.

Subsequently, there are 5 composite devices which yield nicer plots in the Domoticz dashboard but are less
convenient when you want to trigger events.

Installation and setup

Code: Select all

cd domoticz/plugins
or, in case you use [Jadahl's Domoticz for Synology](https://www.jadahl.com):

Code: Select all

cd /volume1/@appstore/domoticz/var/plugins  
Then:

Code: Select all

git clone https://github.com/vaneeten/domoticz-wudirect.git
Or (if you need elevated rights):

Code: Select all

sudo git clone https://github.com/vaneeten/domoticz-wudirect.git
Finally:

Restart your Domoticz service.

Now go to Setup, Hardware in your Domoticz interface. There you add
Wunderground Direct Receiver.

Please ensure that the port number matches the port number configured in WS View before starting the plugin.
lekob
Posts: 2
Joined: Friday 27 September 2019 15:21
Target OS: OS X
Domoticz version:
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by lekob »

Martijn684 wrote: Monday 09 September 2019 13:13 I made a Domoticz Python plugin for direct reception and parsing of Wunderground-formatted Weatherstation data.
It has been developed for the following (identical) Personal Weather Stations:
  • Fine Offset WH2900
  • Alecto WS-5500 (used for development and testing)
  • Ambient Weather WS-2902A

These PWS's are configured with an app "WS View" which allows sending Wunderground-formatted data to
a custom IP address. This IP address should be directed to the IP address of the Domoticz server,
and a configurable port number (default 8008).

Devices

The plugin provides *separate* devices for each received data item, which are meant to be used for events.
If you set the PWS to output weather data every 60 seconds, Domoticz can respond to e.g. wind gusts 10 times quicker
than the polling rate of the Weather Underground website allows. Note that the Domoticz *logging* system has a smallest
time interval of 5 minutes, so logged trends for these devices will not have a 60 seconds resolution. Still, the event
system can handle it.

Subsequently, there are 5 composite devices which yield nicer plots in the Domoticz dashboard but are less
convenient when you want to trigger events.

Installation and setup

Code: Select all

cd domoticz/plugins
or, in case you use [Jadahl's Domoticz for Synology](https://www.jadahl.com):

Code: Select all

cd /volume1/@appstore/domoticz/var/plugins  
Then:

Code: Select all

git clone https://github.com/vaneeten/domoticz-wudirect.git
Or (if you need elevated rights):

Code: Select all

sudo git clone https://github.com/vaneeten/domoticz-wudirect.git
Finally:

Restart your Domoticz service.

Now go to Setup, Hardware in your Domoticz interface. There you add
Wunderground Direct Receiver.

Please ensure that the port number matches the port number configured in WS View before starting the plugin.
Hi buddy, thanks for sharing the detailed guide that too in brief.
User avatar
dyter
Posts: 40
Joined: Thursday 08 February 2018 15:48
Target OS: NAS (Synology & others)
Domoticz version: 8841
Location: Lyon
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by dyter »

Hi

thank for your plugin, it's work but what is the difference with this https://www.domoticz.com/forum/viewtopi ... 65&t=29165 :?:
Domoticz v2024.1 on Synology Docker host, RFLink, ESPEasy wemos D1, Ecodevices, relays x8, dahua doorbell, reolink cameras ....
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by Quax1507 »

I have just sucessfully installed the plugin.

All devices were created but the humidity sensors indoor and outdoor (devices 1and 10) are not updated.
Debug log shows no problems:

2020-06-07 14:43:29.390 (Wetterstation) URL CALLED: /weatherstation/updateweatherstation.php?ID=ID&PASSWORD=KEY&indoortempf=78.4&tempf=68.5&dewptf=43.9&windchillf=68.5&indoorhumidity=33&humidity=41&windspeedmph=5.4&windgustmph=6.9&winddir=205&absbaromin=29.478&baromin=29.944&rainin=0.000&dailyrainin=0.012&weeklyrainin=0.012&monthlyrainin=0.012&solarradiation=737.81&UV=7&dateutc=2020-06-07%2012:43:27&softwaretype=EasyWeatherV1.5.0&action=updateraw&realtime=1&rtfreq=5
2020-06-07 14:43:29.394 (Wetterstation) Sensor NOT handled in code: ID
2020-06-07 14:43:29.394 (Wetterstation) Sensor NOT found: PASSWORD
2020-06-07 14:43:29.394 (Wetterstation) Updating sensor: 15 (Scale 0.556, offset -17.778
2020-06-07 14:43:29.394 (Wetterstation - Temperature Indoor) Updating device from 0:'' to have values 0:'25.8'.
2020-06-07 14:43:29.417 (Wetterstation) Updating sensor: 7 (Scale 0.556, offset -17.778
2020-06-07 14:43:29.417 (Wetterstation - Temperature Outdoor) Updating device from 0:'' to have values 0:'20.3'.
2020-06-07 14:43:29.428 (Wetterstation) Updating sensor: 5 (Scale 0.556, offset -17.778
2020-06-07 14:43:29.428 (Wetterstation - Dewpoint) Updating device from 0:'' to have values 0:'6.6'.
2020-06-07 14:43:29.438 (Wetterstation) Updating sensor: 9 (Scale 0.556, offset -17.778
2020-06-07 14:43:29.439 (Wetterstation - Wind Chill) Updating device from 0:'' to have values 0:'20.3'.
2020-06-07 14:43:29.449 (Wetterstation) Updating sensor: 10 (Scale 1.000, offset 0.000
2020-06-07 14:43:29.449 (Wetterstation - Humidity Indoor) Updating device from 0:'' to have values 0:'33.0'.
2020-06-07 14:43:29.470 (Wetterstation) Updating sensor: 1 (Scale 1.000, offset 0.000
2020-06-07 14:43:29.471 (Wetterstation - Humidity Outdoor) Updating device from 0:'' to have values 0:'41.0'.
2020-06-07 14:43:29.483 (Wetterstation) Updating sensor: 8 (Scale 1.609, offset 0.000
2020-06-07 14:43:29.484 (Wetterstation - Wind Speed) Updating device from 0:'' to have values 0:'8.7'.
2020-06-07 14:43:29.506 (Wetterstation) Updating sensor: 18 (Scale 1.609, offset 0.000
2020-06-07 14:43:29.507 (Wetterstation - Wind Gust) Updating device from 0:'' to have values 0:'11.1'.
2020-06-07 14:43:29.517 (Wetterstation) Updating sensor: 16 (Scale 1.000, offset 0.000
2020-06-07 14:43:29.518 (Wetterstation - Wind Direction) Updating device from 0:'' to have values 0:'205.0'.
2020-06-07 14:43:29.528 (Wetterstation) Sensor NOT handled in code: absbaromin
2020-06-07 14:43:29.529 (Wetterstation) Updating sensor: 6 (Scale 33.860, offset 0.000
2020-06-07 14:43:29.529 (Wetterstation - Pressure) Updating device from 0:'' to have values 0:'1013.9'.
2020-06-07 14:43:29.539 (Wetterstation) Updating sensor: 11 (Scale 25.400, offset 0.000
2020-06-07 14:43:29.540 (Wetterstation - Rain Rate) Updating device from 0:'' to have values 0:'0.0'.
2020-06-07 14:43:29.550 (Wetterstation) Updating sensor: 19 (Scale 25.400, offset 0.000
2020-06-07 14:43:29.550 (Wetterstation - Rain Daily) Updating device from 0:'' to have values 0:'0.3'.
2020-06-07 14:43:29.560 (Wetterstation) Sensor NOT found: weeklyrainin
2020-06-07 14:43:29.560 (Wetterstation) Sensor NOT handled in code: monthlyrainin
2020-06-07 14:43:29.561 (Wetterstation) Updating sensor: 3 (Scale 1.000, offset 0.000
2020-06-07 14:43:29.561 (Wetterstation - Solar) Updating device from 0:'' to have values 0:'737.8'.
2020-06-07 14:43:29.571 (Wetterstation) Updating sensor: 14 (Scale 1.000, offset 0.000
2020-06-07 14:43:29.571 (Wetterstation - $UV) Updating device from 0:'' to have values 0:'7.0'.
2020-06-07 14:43:29.582 (Wetterstation) Sensor NOT handled in code: dateutc
2020-06-07 14:43:29.582 (Wetterstation) Sensor NOT found: softwaretype
2020-06-07 14:43:29.582 (Wetterstation) Sensor NOT found: action
2020-06-07 14:43:29.582 (Wetterstation) Sensor NOT found: realtime
2020-06-07 14:43:29.582 (Wetterstation) Sensor NOT handled in code: rtfreq
2020-06-07 14:43:29.583 (Wetterstation - THB) Updating device from 0:'0.0;50;1;1010;1' to have values 0:'20.3;41.0;0;1013.9;0'.
2020-06-07 14:43:29.595 (Wetterstation - WTC) Updating device from 0:'0;N;0;0;0;0' to have values 0:'205.0;SSW;24.1;30.8;20.3;20.3'.
2020-06-07 14:43:29.607 (Wetterstation - Barometer) Updating device from 0:'1021.34;0' to have values 0:'1013.9;0'.
2020-06-07 14:43:29.619 (Wetterstation - Rain) Updating device from 0:'0;0' to have values 0:'0.0;0.3'.
2020-06-07 14:43:29.631 (Wetterstation - UV) Updating device from 0:'0;0' to have values 0:'7.0;20.3'.

Any idea?
markjgabb
Posts: 142
Joined: Tuesday 24 January 2017 23:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Australia
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by markjgabb »

any advcice on what the setting to put into WS View are? im trying to flip from PWS by Xorfor as its no longer supported, but ive setup the IP and port but am not receiving anyting on domoticz's end?
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

Martijn684 wrote: Monday 09 September 2019 13:13 I made a Domoticz Python plugin for direct reception and parsing of Wunderground-formatted Weatherstation data.
I am playing with this plugin too, it works but I have problems with the humidity sensors ...
Is @Martijn684 still around ?
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

markjgabb wrote: Sunday 02 May 2021 11:01 any advcice on what the setting to put into WS View are? im trying to flip from PWS by Xorfor as its no longer supported, but ive setup the IP and port but am not receiving anyting on domoticz's end?
Hi Mark,
I did not change my PWS destination, instead I created a nat rule on my router to send the output to the IP of my domoticz ...
If you send it to <ip>:<port> it should work
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by EdwinK »

Is @Martijn684 still around ?
Last active 2019, so I doubt it
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

EdwinK wrote: Tuesday 01 June 2021 16:15
Is @Martijn684 still around ?
Last active 2019, so I doubt it
Too bad ...
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

looks like he is responding on github 8-)
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
Martijn684
Posts: 10
Joined: Friday 02 March 2018 12:26
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by Martijn684 »

Sorry for the long silence - I should have subscribed to my own topic I guess. And all this time I thought nobody else was using it…

Please give my some time to figure out what could be the problem with the humidity for you - it works on my pc as they say ;-)
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

Hi Martijn,
nice to see you here too !

I am running a RENKFORCE WH2600 upgraded to ambient 4.5.7 .
As I registred to WU long ago, I am still delivering to WU ...

I found https://obrienlabs.net/redirecting-weat ... bserverip/ a while a go and thought I give it a try

The NAT and MASQ is done on my Mikrotik router and the publish is done as described in this link.

Code: Select all

/ip firewall nat
add action=masquerade chain=srcnat dst-address=IP-OF-DOMOTICZ dst-port=80 protocol=tcp src-address=192.168.10.0/24
add action=dst-nat chain=dstnat dst-port=80 protocol=tcp src-address=IP-OF-PWS to-addresses=IP-OF-DOMOTICZ to-ports=80
as my domoticz machine is allready running apache webserver needed by domoticz, I only needed to create

Code: Select all

/var/www/html/weatherstation/updateweatherstation.php
I modified the updateweatherstation.php file to clone the publishing of data to your plugin

Code: Select all

<?php
/* 
 * this script catches the original post from the PWS and relays it to WU
 * it also sends it to the local domoticz plugin WuDirect
 */ 
# send to WuDirect
$wulocal8008 = file_get_contents("http://127.0.0.1:8008/weatherstation/updateweatherstation.php?" . $_SERVER['QUERY_STRING']);
# relay to WU
$wunderground = file_get_contents("http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?" . $_SERVER['QUERY_STRING']);
echo $wunderground;
?>
I have WuDirect running on my RPI3B+ and latest domoticz beta
Last edited by eddieb on Friday 19 November 2021 9:18, edited 6 times in total.
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
Martijn684
Posts: 10
Joined: Friday 02 March 2018 12:26
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by Martijn684 »

Well... this is a strange one. Your logs show no difference in protocol, so it should just work.
So I'm going to give you some suggestions which hopefully shed some light on the problem.

There is one thing that I think of right now: the plugin only updates values if they change.
There is another sensor which contains the (outdoor) Humidity: WuDirect - THB, in your case Wetterstation - THB.
Because it combines several measurements, it's more likely to change than single-value sensors.
You should find it in the Temperature section of Domoticz. Doesn't that sensor show the current Humidity either?

Looking at your logs, it seems that none of the sensors are actually being updated.
Instead of something like Updating device from 0:'9.2' to have values 0:'9.1',
your logs show Updating device from 0:'' for all non-composite devices - so an empty string for the 'old' value.
For the Humidity sensor, updates will naturally be more sparse as they are only received as integer values - unlike e.g. temperatures.
Are you sure that the other non-composite sensors do update - except for humidity?

To get a fresh start, you could remove the "Wetterstation" hardware along with all its devices, so that it can recreate them.

Please let me know if this helps or not. It's also helpful to know which Domoticz version that you're using.
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

see my github response ...
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
Martijn684
Posts: 10
Joined: Friday 02 March 2018 12:26
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by Martijn684 »

Please upgrade to plugin version 0.2.1.

The problem with the Humidity sensors has been fixed by making them Custom sensors.
That was the reason it was working on my own instance where the humidity devices were actually of the Custom type.
Making them of the Humidity type (and handling the nvalue/svalue thing) does not have any added value in the current state.

If you update the plugin, remove the 2 humidity devices, disable WuDirect and finally re-enable WuDirect.
The plugin recreates the missing 2 devices as Custom sensors.

The plugin now also discards values that are out of range. This should prevent spikes that some users have been experiencing.
Martijn684
Posts: 10
Joined: Friday 02 March 2018 12:26
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by Martijn684 »

markjgabb wrote: Sunday 02 May 2021 11:01 any advcice on what the setting to put into WS View are? im trying to flip from PWS by Xorfor as its no longer supported, but ive setup the IP and port but am not receiving anyting on domoticz's end?
Your WS View app should allow you to configure a "Customized" output.
You should set the settings as follows:
  • Enable
  • Protocol Type Same As: Wunderground
  • Server IP / Hostname: <the IP address of your Domoticz
  • Path: /weatherstation/updateweatherstation.php?
  • Station ID (not used): ID
  • Station key (not used): NoKeyNeeded
  • Port (default is 8008): 8008
  • Upload interval: 60
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

Just upgraded to 0.2.1 on my test env, looks fine for now.
Keep up the great work
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by eddieb »

again thumbs up for this one !
@martijn684 did you consider registring this plugin with https://github.com/stas-demydiuk/domoti ... ree/master ?
would be nice promotion to :mrgreen:
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by rolandtwilt »

Does anyone have any advice on which weather station I should buy?
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Post by brommetje »

Hi @rolandtwilt

Alecto WS-5500 is working fine for more than a year and using plugin https://github.com/Xorfor/Domoticz-PWS-Plugin
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests