Simple Python UDP Script?

Morning - At the moment i am using Weather Display to publish clientraw and then sending it vi MQTT to be picked up by various scripts. I keep getting crashes when my python script clashes with the clienttaw upload file.

As such, and to simplify/increase uptime - is there a simple python script to listen to the UDP - i can then publish on using my existing MQTT system.

I know there is the Python/UDP/Weewx script on github but its more than i need and i cant work out how to hack it to just get a UDP listen / print (mainly using rapid wind).

I’ve a feeling its quite simple just cant find an example so any help would be great,


You can take a look at this: for an example. The function udp_data() in isn’t too complicated. You’d probably just need to replace all the setDriver() calls with whatever you need to do with the data. You can strip out all the extra data calculations (windchill, heat index, rain accumulations, etc.) and that will reduce the size quite a bit.

If you have any questions about it, I’ll be glad to help.


Fab thanks - i will take a look and take up your offer for help if thats ok :slight_smile:

There are a lot of scripts on github, you’ll have to be a bit more specific.

If you’re talking about the weewx driver extension, that’s probably overkill for what you are trying to do, but you ‘could’ run weewx and then use ‘that’ and its mqtt extension to publish whatever observations you’re looking for

But regardless, you might ask the author for a little nudge.

That said, if you’re talking about ‘my’ script (GitHub - vinceskahan/weatherflow-udp-listener: listen for WF broadcasts and tear the messages apart) then it already supports limiting which status/observation(s) to process or alternately to ignore.

nohup python /usr/local/bin/ --mqtt  --limit "rapid_wind" >/dev/null 2>&1 &

There are lots of commandline switches, basically all optional. I ‘tried’ to make the readme self-explanatory, but if I lost you in there then feel free to ask away !

1 Like

Another vote for Vince’s code at as it’s already got MQTT built-in.

If you just want simple Python code to decode UDP stuff, you can pull that out of my Redis database code at

And I really like Pete Davis’ WeatherFlow P{iy}Console at WeatherFlow PiConsole as a turn-key solution for display purposes. If I had an infinite amount of time I’d probably try to figure out how to integrate my UDP code into it and do some datalogging on that Pi so it would continue working when the internet was down…

This one’s not event driven so no MQTT. You just import, start, and poll.