What I'm doing is writing a service/extension to broadcast the LOOP and Archive data in a particular JSON format to be compliant with the WeatherFlow UDP API (link) <https://weatherflow.github.io/Tempest/api/udp/v171/> that I'm well familiar with. The goal is to permit any weewx user, not just a WeatherFlow station type user, to use the very cool wfpiconsole app and dashboard (link) <https://community.tempest.earth/t/weatherflow-piconsole/20083> that already exists.
Short description is the console is pretty slick, so I'm trying to make it available to all weewx users including me of course :-) The WeatherFlow gear emits its UDP messages in metric units, so I need to convert weewx data to metric only if needed. If the weewx LOOP and archive data is in the correct units already, then I don't want to needlessly mess up an already good value. If it's not in metric, I need to convert it to metric and match the WF UDP API expectations. METRICWX is probably pretty close to the units I need. I'll give it a try. Thanks. On Sunday, September 8, 2024 at 6:31:45 PM UTC-7 Tom Keffer wrote: > I'm not exactly sure what you want to do, but take a look through the > convenience functions at the bottom of weewx/units.py. It may be as simple > as: > > record_metric = weewx.units.to_METRICWX(record) > > > But, if your goal is to emit JSON formatted output, be sure to look > through the wiki article *Tags for series > <https://github.com/weewx/weewx/wiki/Tags-for-series>*. WeeWX may be able > to do what you want already! > > On Sun, Sep 8, 2024 at 5:52 PM Vince Skahan <[email protected]> wrote: > >> I'm working on an app that reads the archive and loop data as it comes in >> and emits JSON-formatted output. I want to make sure to always convert >> that data to metric values. >> >> Is there a weewx-ish standard way to take a speed and always generate mps >> ? Or a temperature and always emit degC, and so on ? >> >> I didn't see any mph=>mps conversion routines but that's easy of course. >> What I wasn't certain on was how to decide from the packet/record if that >> conversion needed to be done, given how configurable weewx is for setting >> unit systems on a field by field basis ? >> >> Any suggestions or examples I might look at ? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "weewx-development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-development/47b87add-2c44-40cc-9979-6c2e18a36d35n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-development/47b87add-2c44-40cc-9979-6c2e18a36d35n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/36c97fdd-7a54-4ea3-ade0-69595c85425dn%40googlegroups.com.
