UDP Listener to populate Redis database

So I’ve just got this code working to listen for UDP broadcasts and populate a Redis in-memory database with every value broadcast:


Next project is to fire up another program every minute, read the interesting values from Redis, and write them to a mysql database for further use (graphing, notifications, etc).

This is kind of a work in progress, as I’ll want to add Redis expiration on the keys (and handle that in mysql, etc) so I can tell when things are going offline, but it seems to work, so I thought I’d throw it out there if anyone has any interest in using or modifying it.

It works well on the Raspberry Pi that Peter Davis’ Python Console:

is running on, and on my Mac (though I don’t have Redis installed on the Mac, so that’s more for testing to make sure it’s parsing broadcasts properly).

it generates Redis keys like:
WF.UDP.obs_air.obs.AirTemperature_C “24.11”

Not every key is useful, but ‘keys *’ in Redis-cli will show all of them, and you can figure out which ones are of interest to you.