Supporting multiple sky or air in apps we write

My udp listener currently only supports one air+sky device on the local network from a MQTT perspective, writing observations out to MQTT topics ala /wf/obs/sky or /wf/status/hub or /wf/rapid_wind etc.

I’d like to be able to support multiple sensors (two sky, two air, etc.) and need to modify my output to be able to distinguish between sky-A and sky-B, for example.

Technically it’s not a problem, I have the serial number in the messages of course. I’m wondering from a namespace perspective what makes the most sense.

One thing that came to mind was the appending the serial_number in the topic name ala:


/wf/rapid_wind/SK-000123456

/wf/obs_sky/SK-000123456
/wf/status_sky/SK-000123456

/wf/obs_air/AR-000987654
/wf/status_air/AR-00098654

/wf/status_hub/HB-00024680

That would mean a MQTT subscription to /wf/obs_sky would get the sky observations for all the sky units (plural) that are broadcasting. For my primary use case of having my listener feed MQTT and then seeding influxdb (via telegraf subscribing to MQTT) this would work great. I’d just need to tweak my grafana dashboard slightly to get to the right topic for the observation on sky-A vs. sky-B.

A different way would be to put the serial_number before the observation type ala:


/wf/SK-000123456/rapid_wind

/wf/SK-000123456/obs_sky
/wf/SK-000123456/status_sky

/wf/AR-000987654/obs_air
/wf/AR-00098654/status_air

/wf/HB-00024680/status_hub

Personally I like the first variant notionally. Anybody have any thoughts either way or alternate ways of cooking up MQTT topics for multiple devices doing the same observations that I might think about ?