matthewwall / weewx-mqtt

upload data to mqtt broker
58 stars 31 forks source link

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

Open tvandyck opened 3 years ago

tvandyck commented 3 years ago

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?

dersgniw commented 1 year ago

Have you happened to figure out a way around this?

tvandyck commented 5 months ago

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