The|fileparse|driver is perhaps the simplest example of a WeeWX driver. It reads name-value pairs from a file and uses the values as sensor 'readings'. The code is actually packaged as an extension, located in|examples/fileparse|, making it a good example of not only writing a device driver, but also of how to package an extension. The actual driver itself is in|examples/fileparse/bin/user/fileparse.py|.

This is what was in the WeeWx 5 drivers discussion.

I was going to take the more rigid approach and have the driver not do all the pair matching, but brute force it to say that at position [1} is the date-time, position [2] is barometer, etc.


I think that I was overwhelmed not knowing Python and seeing the very general and flexible code which searches the file for a matching descriptor and then reads the corresponding value.  I'm just going to say position 1 is where datetime is in the string, position 2 is where the barometer is, 3 is humidity, etc.

It means a very rigid expectation for the file structure but hey, I'm just trying to get it to work and elegant it isn't, and the TWI driver sort of works that way, and so would my RM Young 28600 translator, and so is John Craig's Campbell Scientific CR300 code he has working.


That's my plan, but I hope you have better coding skills than I do (but this  motivates me to learn and try to understand) so this is a bonus to get to know Python and feel I really have accomplished something.

I hope this gets your creative programming going and will have a driver to share very soon with the rest of the users hoping to adapt something like this.

Dale

--
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/9f77d868-d480-4738-8564-a1ed6085f97c%40gmail.com.

Reply via email to