[Nut-upsuser] Publish UPS status to MQTT broker in 60 lines of Rust
Hank Barta
hbarta at gmail.com
Mon Jun 3 21:45:20 BST 2024
But... I cheated. I looked at some projects on Github that do this and
they usually link to the NUT and MQTT libraries. While I've done that
in the past, more recently I delegated the actual publishing to the
Mosquitto client `mosquitto_pub` thinking much more thought has gone
into that than anything I would code. And for this task, I find the
output of `upsc` to be easily parsable and again, more thought has
gone into it than anything I would code using the API library. And
writing a filter that uses nothing but text processing allows me to
write in any language suitable for text processing. (Long live Perl!)
But I went with Rust this time since it's more interesting.
Anyone curious anout this can look at it at
https://github.com/HankB/nut_upsc_parse and I can take questions on
this list or via issues on Github.
As this is my first post to the list, my apologies if it is off topic.
Perhaps if it is, my early posts will be moderated and if in
violation, no one need even see this (and I will endeavor to not make
the same mistake.)
best,
--
Beautiful Sunny Winfield
More information about the Nut-upsuser
mailing list