weewx-mqtt icon indicating copy to clipboard operation
weewx-mqtt copied to clipboard

publish archive and loop records to different topics when both are bound

Open tvandyck opened this issue 3 years ago • 2 comments

I tried binding to both loop and archive. But I dont know why they are both send to the weather/loop topic, which makes it (in my case) not very useful. The reason I wanted to do this is to have frequent updates on one topic for websocket to website connection. And less frequent updates on another topic that is monitored to be written to a database. I'm not sure what you think?

tvandyck avatar Apr 16 '21 10:04 tvandyck

Have you happened to figure out a way around this?

dersgniw avatar Jul 19 '23 02:07 dersgniw

The workaround I found is to learn python, then write a small python script that runs every 5 minutes (using crontab) and does the following:

  1. sleep for 10 seconds to make sure the archive record is written to the DB
  2. get the last archive record from the weewx DB and convert it to a json object
  3. publish the archive json object to MQTT on a weather/archive topic

tvandyck avatar Apr 11 '24 07:04 tvandyck