Weather Station interceptor

Hi, i’ve started a new project for intercept the updates sent from any weather station to Weather Underground and publish the data trough mqtt on Home Assistant, so the device become “local” and near real-time (updates every 30 sec, depend from the device).

Here the link, feel free to help as i’m really newby on coding.

https://github.com/Condorello/HASS_wu_interceptor

1 Like

Have you seen this? http://weewx.com/

How is your project different?

Hi, Yes i know that software. Mine Is Just a script in python of few line of code for a very specific porpuse (serve home assistant), so less stuffs to run over home assistant!

Awesome - thanks! Will check it out.

added a very basic addon for run on hass.

@TheCondor Will this work if my Home assistant is on a different VLAN to my Weather station?

You have to route the packet coming from the station (HTTP) to the other vlan and it should work.

I have put my weatherstation on my main network yet the interceptor is still not showing data.

Ive put in my MQTT User and password. is there anything else i need to do?


Screenshot 2023-05-29 140438

You have successuffully redirect http traffic coming from the station to the hass ip? Check in the log of the plugin if you see the packet coming, let me know.

192.168.0.99 - - [29/May/2023 14:00:32] “GET /weatherstation/updateweatherstation.php?ID=ISOUTH1124&PASSWORD=****************f=66.7&humidity=50&dewptf=47.5&windchillf=66.7&winddir=312&windspeedmph=1.34&windgustmph=2.46&rainin=0.00&dailyrainin=0.00&weeklyrainin=0.00&monthlyrainin=1.32&yearlyrainin=11.73&solarradiation=510.81&UV=6&indoortempf=77.0&indoorhumidity=36&baromin=29.92&dateutc=now&softwaretype=WH2600%20V2.2.8&action=updateraw&realtime=1&rtfreq=5 HTTP/1.0” 200 -

Exception occurred during processing of request from (‘192.168.0.99’, 32676)
Traceback (most recent call last):
File “/usr/lib/python3.11/socketserver.py”, line 317, in handle_request_noblock
self.process_request(request, client_address)
File “/usr/lib/python3.11/socketserver.py”, line 348, in process_request
self.finish_request(request, client_address)
File “/usr/lib/python3.11/socketserver.py”, line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File “/usr/lib/python3.11/http/server.py”, line 667, in init
super().init(*args, **kwargs)
File “/usr/lib/python3.11/socketserver.py”, line 755, in init
self.handle()
File “/usr/lib/python3.11/http/server.py”, line 432, in handle
self.handle_one_request()
File “/usr/lib/python3.11/http/server.py”, line 420, in handle_one_request
method()
File “/pws_server.py”, line 143, in do_GET
publish(client, MQTT_TOPIC + “/low_battery”, (MyHttpRequestHandler.parse_wu_data(query_components)['Low_battery
[]’]) )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: ‘Low_battery_[]’

It now works, thanks.

But does this now mean it does not update weather to wunderground?

Also I wish to use UV instead of UV Index, os the raw UV output from my weather station, how would i add this?

Thanks

Found the problem, the script expect also the filed “lowbatt” while it’s not present in your string, it should be after “baromin”.
You have two option:
1- manually enter the addon folder and change the pws_server.py and remove the reference to lowbatt publishing, line 142
2- fork my project and do the same

Hope you can fix in this way.

Wow, I really like this addon solution. Used it for a Bresser WSX3001. Had to make some small changes in pws_server.py (disable rain_weekly, rain_monthly, rain_yearly, temperature_in, humidity_in, low_battery). But further It works great.

In the AP mode of the Bresser you could add the URL and port of your addon.
Maybe it could be improved to have MQTT discovery and the MQTT credentials via the addon configuration.

Thank for your message, I added the config for ip,port,user,pwd for now…
for update you have to stop the addon, save your personal config for bakup and uninstall.
Then proceed with a new installation with the new folder on github.

I’m not a coder, so someone else can do a better job for sure forking the project :wink:

Thanks. I’m not a pro coder as well.
I would advise to change this line

mqtt_password: str

in config.yaml into

mqtt_password: password

Further it seems that you could also use the service API to get the MQTT data, I will try that in a fork.