Thanks Gary, that is an idea I have not thought about .. to take the fileparse driver and as you say, just drop my code into it. I will look at this.
Craig On Wednesday, September 20, 2023 at 4:44:43 PM UTC+12 gjr80 wrote: > If you have the ability to provide a delimited text file with your obs and > timestamp then fileparse will certainly work for you and it will be a > straightforward and quick setup. However, if you already have some code to > read observations from your station/datalogger you pretty much have all you > need for your own driver. In a nutshell, all a driver does is run an > infinite loop obtaining data from the station, converting units as > required, packaging the data in a python dictionary and passing the > dictionary on to WeeWX. The fileparse driver is a good example of a basic > driver, you could just remove the code that reads data from a fie and > substitute your code or a call to a method that reads data from your > station/datalogger. At the very least the data will need to be massaged > into a python dictionary (ie a loop packet), but that is easy to do. There > will be a few things to watch for, for example: handling units, dealing > with missing data and making sure the driver does not block the main WeeWX > loop (typically an issue when reading from high latency devices or via a > network). You already have code running to read data from the > datalogger/station and post to WU, you could potentially have WeeWX reading > data direct from your datalogger/station and let WeeWX handle uploading to > WU (and other services as well) - that way you are reading data from your > datalogger/station once only. > > Have a look at the Porting to new hardware section > <http://weewx.com/docs/4.10/customizing.htm#porting> in the Customization > Guide <http://weewx.com/docs/4.10/customizing.htm>. It's quite a simple > process and quite satisfying once complete. > > Also, just post back here if have any questions. > > Gary > > On Wednesday, 20 September 2023 at 11:14:54 UTC+10 [email protected] > wrote: > >> Maybe it would be better to use the driver: fileparse.py. >> >> >> On Wednesday, September 20, 2023 at 12:18:25 PM UTC+12 Craig Young wrote: >> >>> Maybe I should try a new tact. I have a datalogger which is outputting >>> weather data every 15 seconds and is received on the Raspberry Pi through >>> the USB0 serial port. Using CuteCom here is a sample data record: >>> >>> <"2023-09-20 >>> 12:11:30",13.65,24.91,737,0,0,0,0,1.5,167,1.96,18.1,1.52,101.15,0.745,21.3,0.8,-1.1,-14.1105,0.5613659,323.5677>␍␊ >>> I have written the program on the datalogger to do this so I can change >>> the data format if needed. >>> >>> What I need to do now is import this into weewx. I assume I need a >>> driver (or extension?) to do this but that is where the problems begin. >>> This is not for the feint of heart. I have written tons of software in >>> other languages for other applications, but all on windows. I have a >>> Raspberry Pi now running and have written a small python program to use the >>> Serial instruction to read the data stream and even post this after >>> formatting to wunderground. So I am not stupid, just a very long learning >>> curve to do a simple thing. >>> I found the TWI.py driver and it looks simple enough to modify for this >>> application, but given my inexperience with linux and weewx I see lots of >>> problems ahead. >>> >>> Is there someone on here who could spend a couple of hours or so on >>> Discord or Skype to help me either modify TWI.py or write a new driver for >>> weewx? >>> >>> Craig >>> On Wednesday, September 20, 2023 at 10:44:51 AM UTC+12 Craig Young wrote: >>> >>>> I have installed and configured a new driver in my weewx installation, >>>> TWI.py. But before I launch weewx I need to make a couple of changes to >>>> the driver. What is the correct method for doing that? Do I: >>>> 0: Stop weewx >>>> 1. Open driver (located in usr folder) with Thonny >>>> 2. Make the changes and save >>>> 3. Start weewx >>>> or do I need to reconfigure it first? >>>> >>>> -- 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/1650d57d-d608-4e17-a228-0f75ed00c08an%40googlegroups.com.
