> > make genLoopPacket return every time data is emitted from the arduino. > instead of polling the hardware, open the serial port once in the driver > __init__. then do a non-blocking read instead (a read with timeout) > instead of read-then-close.
Thanks hugely for this tip. The driver code I was starting with had clearly been repurposed a few times and was a bit of a mess. Once I took your advice and restructured it everything started working perfectly. On Tue, Apr 4, 2017 at 6:04 PM, Alec Bennett <[email protected]> wrote: > you should put it in user/aws.py > > > When I put it in /home/weewx/bin/user/aws.py, engine.py can't find it: > > Traceback (most recent call last): >> File "/home/weewx/bin/weewxd", line 64, in <module> >> weewx.engine.main(options, args) >> File "/home/weewx/bin/weewx/engine.py", line 916, in main >> engine = engine_class(config_dict) >> File "/home/weewx/bin/weewx/engine.py", line 72, in __init__ >> self.setupStation(config_dict) >> File "/home/weewx/bin/weewx/engine.py", line 96, in setupStation >> __import__(driver) >> ImportError: No module named aws > > > Do I have to do something other than simply place aws.py in that directory? > > > > > > On Tue, Apr 4, 2017 at 4:48 PM, mwall <[email protected]> wrote: > >> On Tuesday, April 4, 2017 at 8:10:20 PM UTC-4, Alec Bennett wrote: >>> >>> I adapted the Arduino code for easy reading from weeWX and made a weeWX >>> driver, posted here along with the Arduino code: >>> >>> https://github.com/wrybread/ArduinoWeatherStation >>> >> >> very nicely done! >> >> >> >>> Some questions and issues: >>> >>> - the driver currently gets the wind speed about every 17 seconds even >>> though the Arduino is reporting it much more often that that. When using a >>> Vantage I get the wind about every 2 seconds. Any thoughts on how to make >>> the updates more frequent? >>> >> >> make genLoopPacket return every time data is emitted from the arduino. >> >> instead of polling the hardware, open the serial port once in the driver >> __init__. then do a non-blocking read instead (a read with timeout) >> instead of read-then-close. >> >> >> >>> - I named the driver "aws", as in "Arduino Weather Station". I'm a bit >>> worried that might get confusing and hard to search for because of Amazon >>> Web Services. Agreed? Idea for other name? >>> >> >> i usually prefix any exension with 'weewx-' for packaging. for example, >> the 'aws' driver would be in a package called 'weewx-aws-x.y.z.tgz' that >> expands to a directory weewx-aws, that contains the actual driver >> weewx-aws/bin/user/aws.py >> >> but weewx does not care - you can call it whatever you want. >> >> >> >>> - where to place the driver file? Currently in >>> /home/weewx/bin/weewx/drivers/aws.py. >>> >> >> you should put it in user/aws.py >> >> if you install in weewx/drivers/aws.py then it will be removed when you >> upgrade weewx. things in the user directory do not get moved/touched >> during an upgrade. >> >> >> >>> - should I make any changes to how it's packaged? Would this be >>> something useful for the main fork of weewx? >>> >> >> if you package it using the instructions in the weewx customization guide: >> >> http://weewx.com/docs/customizing.htm#How_to_package_an_extension >> >> then it will be a bit easier for people to install/update. the >> wee_extension utility will be able to install it, and wee_config will >> recognize it when someone tries to (re)configure their installation. see >> the other drivers on the weewx wiki for examples, such as weewx-twi or >> weewx-sdr or weewx-wh23xx: >> >> https://github.com/weewx/weewx/wiki >> >> and please add your driver to the weewx wiki! >> >> m >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "weewx-user" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/weewx-user/R7j98YGv1ME/unsubscribe. >> To unsubscribe from this group and all its topics, 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.
