I did something similar. Here's my solution: https://hackaday.io/project/101680-solar-powered-wifi-temperature-sensor-for-weewx/details
On Thu, Sep 19, 2019 at 4:56 PM Greg Troxel <[email protected]> wrote: > Mikael Fredriksson <[email protected]> writes: > > > I've added a tempsensor to another Raspberry that I will place in my > "underground storehouse" to keep track of the temperature there. > > I got a script to work and add timestamp and tempvalue to a sqlite db. > > Now I want to import these values to weewx and post to my weather web > page. > > The Raspberry in the storehouse is on the same local network. > > Is there some way to make this work? > > There are many; it depends on how much code you want to write and how > you want to approach it. > > I would say the easy way is to set up an MQTT broker. I'd suggest on > the weewx machine. Then on the "underground storehouse" RPI, use the > mosquitto publish program, or write a few lines of python with the paho > library. On weewx, use: > https://github.com/bellrichm/WeeWX-MQTTSubscribe > > Note that I have been sending weewx data via MQTT to home assistant, but > not the other way around. However, many have written about > MQTTSubscribe on the list, and it seems clear that it works. > > With this approach, you could use an esp8266 instead of an RPI. I'm > using this for temp/humidity ina few places, but I'm not currently > ingesting the data into weewx. > > > The problem with the above approach is that it fails to record data when > the network is broken. That might be ok with you, and it might not. > You are currently storing data on the RPI, which means you have data > when the RPI has power. So, you could do something which runs on the > weewx machine, connects to both the weewx and the remote database (wave > hands), and then populate the weewx database with the remote records. > Perhaps first extend the schema or declare e.g. extraTemp3 to be what > matters, and then set that column from the remote database when it's > NULL. This way you'll get the records in arrears after a network > outage, sort of like how the Davis driver grabs archive records not yet > in the database. > > I don't know of any existing code for this kind of syncing. It's > obviously possible to write, and obviously not trivial to debug. > Probably enough to convince you that just getting live data over MQTT is > good enough :-) > > > The first thing I'd suggest is to synchronize the data gathering with > the archive period on your weewx setup. I'm using Davis and 5 minutes, > which has a 15 second post-sample guard time and I'd sample right on > time, so the record is in sync and will be in the archive record. I'd > recommend this for either MQTT or filling in archive records. > > Greg > > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" 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-user/rmiy2yjalib.fsf%40s1.lexort.com > . > -- Peter Quinn (415)794-2264 -- You received this message because you are subscribed to the Google Groups "weewx-user" 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-user/CAA1SM21q%2BTNSa-QE5JR%3DQjn4qHgiJ6jROdLcwWJ%2BgfU_FSyGCw%40mail.gmail.com.
