Python Plugin: PWS (Personal Weather Station)

Python and python framework

Moderator: leecollings

Xorfor

Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

I have written a Python plugin, to capture data directly from my weather station. So no need to upload the data first to WeatherUnderground, Ecowitt, WeatherCloud, WOW, etc.
The README describes the use of WS View to connect your weather station to your router and upload data to Domoticz.

https://github.com/Xorfor/Domoticz-PWS-Plugin

In general, if the station is supplied with 'EasyWeather' software, it is likely that the station will work with this Domoticz plugin!

Please tell me your experience, which weather station you are using, which tool (WS Tool, WS View) you used, etc.
Last edited by Xorfor on Monday 16 September 2019 23:39, edited 4 times in total.
Xorfor

Re: Python Plugin: Personal Weather Station (PWS)

Post by Xorfor »

Final version is available, with some extra devices.
Xorfor

Re: Python Plugin: Personal Weather Station (PWS)

Post by Xorfor »

Added some improvements for the Rain sensor.
Xorfor

Re: Python Plugin: Personal Weather Station (PWS)

Post by Xorfor »

Added extra device for wind direction.
Extra documentation to link your PWS to Domoticz.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

Some code cleanup (Black formatting) and more documentation https://github.com/Xorfor/Domoticz-PWS- ... /README.md
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

I removed the extra checks on WeatherUnground and Ecowitt protocols. And added extra documentation about EasyWeatherV1.4.5 which is available now for weatherstations.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

New version available and also tested on the latest EasyWeather version.

Fixed: Sometimes the total precipitation from a day was added to the next day, because of different times settings on the PWS and Domoticz server.
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

I'm using a Alecto WS-5500 weather station and WSView software to setup the device and its work very well, today i updated to the latest release because i encountered the rain gauge issue. A few minutes ago at 00:00h the rain value of the previous day is still copied to the next day :?: I will see tomorrow if the problem still exists.
Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

I have seen the same problem. Also with my latest fix. It is difficult to debug this. Now I am not sure if it is a bug in my plugin or in Domoticz.
brommetje
Posts: 67
Joined: Sunday 16 February 2014 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by brommetje »

Using Alecto WS-5500 software version 1.4.4 working great, selected for now Ecowitt protocol.
Thanks Xorfor all the work.
Do you know what the difference is between Ecowitt and Weather Underground protocol only the "Dew point"?
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

Do you know what the difference is between Ecowitt and Weather Underground protocol only the "Dew point"?
Also WindChill is not reported in the Ecowitt protocol
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

andreo wrote:I'm using a Alecto WS-5500 weather station and WSView software to setup the device and its work very well, today i updated to the latest release because i encountered the rain gauge issue. A few minutes ago at 00:00h the rain value of the previous day is still copied to the next day :?: I will see tomorrow if the problem still exists.
The issue still exists. 1 minute after midnight the total rainfall of the previous day is visibleImage

Verstuurd vanaf mijn MHA-L29 met Tapatalk

Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

I didn't have this problem this time. In my log I saw that the correct data was send and the sensor showed this data.

I am running an other test, and it seems that updating the Rain sensor does not work as expected! At this moment I have a plugin with a rain sensor and I send 1.5 as total precipitation, but the sensor still displays 0.0!!! I will do some more investigation...
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

Maybe this can help you, on 23:59 hour the last update is written to the graph, on 00:00 hour the value of the day total resets to 0mm. After 1 minute the total previous day total becomes negative and will be displayed as a positive value in the day graph. (Donderdag) see database.
grafiekrain.png
grafiekrain.png (101.65 KiB) Viewed 6648 times
database.PNG
database.PNG (29.72 KiB) Viewed 6648 times
Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

Xorfor wrote: Tuesday 22 October 2019 21:29 I didn't have this problem this time. In my log I saw that the correct data was send and the sensor showed this data.

I am running an other test, and it seems that updating the Rain sensor does not work as expected! At this moment I have a plugin with a rain sensor and I send 1.5 as total precipitation, but the sensor still displays 0.0!!! I will do some more investigation...
After viewing the log there is 1 hour difference in time visible, is this possibly causing the double count?

2019-11-04 22:38:00.598 (WS5500) utcdate: 2019-11-04 21:37:58
2019-11-04 22:38:00.599 (WS5500) datetime.strptime(utcdate, '%Y-%m-%d %H:%M:%S'): 2019-11-04 21:37:58
2019-11-04 22:38:00.600 (WS5500) Protocol: Wunderground
Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

andreo wrote: Monday 04 November 2019 22:45 After viewing the log there is 1 hour difference in time visible, is this possibly causing the double count?

2019-11-04 22:38:00.598 (WS5500) utcdate: 2019-11-04 21:37:58
2019-11-04 22:38:00.599 (WS5500) datetime.strptime(utcdate, '%Y-%m-%d %H:%M:%S'): 2019-11-04 21:37:58
2019-11-04 22:38:00.600 (WS5500) Protocol: Wunderground
No that is not the problem, just a debug line added by me. Later on in the code, this utc time is converted to the local (time on the Domoticz) time, to be sure that the PWS is sending data for the correct date.

Meanwhile, I have found 2 problems in Domoticz with this rain counter. These problems are NOT related to python plugins, but can also be seen in other hardware like Buienradar!!!

1. You will see that almost every day, the first hour has no data (also no 0 mm). As you can see in your table of data, that Domoticz (so not the plugin) stores the data every 5 minutes (sometimes 1 second later). At the beginning of a new day Domoticz resets its own internal counter to 0. If the PWS sends in the first hour its total precipitation, this value is stored at dd-mm-yyyy 01:00:00, not at dd-mm-yyyy 00:59:59. The graph should not show 00:00, or store the total rain fall at hh:59:59.
2. Sometimes the 00:00 shows the value 0, but then you will see a negative value at 01:00. For the day total this is used as positive value for the new day. See image as an example.
Aantekening 2019-11-06 201145.jpg
Aantekening 2019-11-06 201145.jpg (60.92 KiB) Viewed 6583 times
I can not fix this. Hopefully the Domoticz programmers can do some more investigation.
Xorfor

Re: Python Plugin: PWS (Personal Weather Station)

Post by Xorfor »

I think I found a workaround for the problem in the Domoticz Rain device. I also addded a new Rain rate device.
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

tested the latest version for two days and now displays the correct amount of rain.

Verstuurd vanaf mijn MHA-L29 met Tapatalk

Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
mister006
Posts: 2
Joined: Monday 09 December 2019 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by mister006 »

The script worked for the evening, but the next day this error appeared:
2019-12-09 16:00:33.739 Error: (Weathi) 'onMessage' failed 'TypeError':'attribute of type 'NoneType' is not callable'.
2019-12-09 16:00:33.739 Error: (Weathi) ----> Line 380 in '/home/pi/domoticz/plugins/Domoticz-PWS-Plugin/plugin.py', function onMessage
2019-12-09 16:00:33.739 Error: (Weathi) ----> Line 161 in '/home/pi/domoticz/plugins/Domoticz-PWS-Plugin/plugin.py', function onMessage

What is going wrong here? Thanks
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Python Plugin: PWS (Personal Weather Station)

Post by andreo »

try once to completely reset domoticz, i have had this if you only restart the service.

Verstuurd vanaf mijn MHA-L29 met Tapatalk

Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
Post Reply

Who is online

Users browsing this forum: Droll and 1 guest