Page 1 of 3

Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Monday 09 September 2019 13:13
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.

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Friday 27 September 2019 15:24
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.

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Monday 10 February 2020 19:25
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 :?:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Sunday 07 June 2020 14:51
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?

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Sunday 02 May 2021 11:01
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?

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 15:56
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 ?

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 15:58
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

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 16:15
by EdwinK
Is @Martijn684 still around ?
Last active 2019, so I doubt it

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 16:21
by eddieb
EdwinK wrote: Tuesday 01 June 2021 16:15
Is @Martijn684 still around ?
Last active 2019, so I doubt it
Too bad ...

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 19:24
by eddieb
looks like he is responding on github 8-)

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 19:52
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 ;-)

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 20:09
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

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 20:48
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.

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Tuesday 01 June 2021 21:50
by eddieb
see my github response ...

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Sunday 06 June 2021 12:27
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.

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Sunday 06 June 2021 12:38
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

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Sunday 06 June 2021 13:10
by eddieb
Just upgraded to 0.2.1 on my test env, looks fine for now.
Keep up the great work

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Monday 07 June 2021 21:51
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:

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Saturday 17 July 2021 15:27
by rolandtwilt
Does anyone have any advice on which weather station I should buy?

Re: Python Plugin: WuDirect interface for Personal Weather Stations

Posted: Monday 19 July 2021 15:35
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