Take a look at Filepile <https://github.com/tkeffer/filepile>. It may do what you want, or help you write your own.
-tk On Mon, Apr 22, 2019 at 7:43 PM <[email protected]> wrote: > Hi all > > I have devised a method to export my Air Quality Data (AQI) from my > Arduino based weather station to Weewx (it can't be sent via the usb port > with the rest of the data). It involves sending the data via a UDP > broadcast packet from the station, this is then captured by a small Python > script on my Weewx Pi and written to a txt file. > > The txt file data looks like this > AQI25=5.50,AQI100=4.10,AQIIndex=22,AQICO2=967 > > From the Weewx wiki I have crafted the beginning of a service to import > the data to my Wewwx database (extended with the 4 new data fields) but I'm > not sure how to complete that task. So far I have this, which I think will > grab the first value - how do I parse the other 3? Is it as simple as just > adding more lines such as event.record['AQI100'] = float(value) etc? > > *import* syslog > > *import* weewx > > *from* weewx.wxengine *import* StdService > > > *class* WDAQIService(StdService): > > *def** __init__*(self, engine, config_dict): > > super(WDAQIService, self).__init__(engine, config_dict) > > d = config_dict.get(*'WDAQIService'*, {}) > > self.filename = d.get(*'filename'*, *'/home/pi/AQIData.txt'*) > > syslog.syslog(syslog.LOG_INFO, *"WDAQIImport: using %s"* % > self.filename) > > self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file) > > > *def** read_file*(self, event): > > *try*: > > *with* open(self.filename) *as* f: > > value = f.read() > > syslog.syslog(syslog.LOG_DEBUG, *"WDAQIImport: found value of > %s"* % value) > > event.record[*'AQI25'*] = float(value) > > *except* Exception *as* e: > > syslog.syslog(syslog.LOG_ERR, *"WDAQIImport: cannot read > value: %s"* % e) > > Thanks > Colin > > -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- 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]. For more options, visit https://groups.google.com/d/optout.
