here are a few things to try or to think about: - do not read historical data from the station. for the fine offset usb stations, reading historical records requires more usb comm that reading current data. it is the same for te923 stations. if your usb is flaky, then minimizing usb comms can help avoid lockups. so if you set record_generation=software, weewx will read only current conditions. weewx will still read historical data when it starts up (you can disable that too, if you want).
- do not restart weewx when you power cycle the usb. if you power up the weather station, start weewx, then power cycle the weather station, weewx *should* recover. it should re-establish the connection to the station and continue reading data. so as long as your power cycling happens in less than one archve interval, you won't notice anything. be sure to use a reasonable archive interval (5 minutes works well). - if you cannot ensure that the weather station is powered on when weewx starts up, then use the loop_on_init option to force weewx to keep trying. (normally weewx will stop if it cannot detect the hardware you requested) a long time ago i tried putting usbcntl logic into the fousb driver. the intent was to detect the usb lockups in the driver, and make the driver force a power cycling of the usb. although that worked, it was difficult to maintain - there is too much variability in how power control is done in usb, so putting that logic in the driver made the driver too brittle. i think a better approach is to do the power cycling somewhere else, then be sure that weewx will re-connect to the station reliably. as for when to power cycle, you can do that using cron, but another approach is to only do it when you lose the connection. so write a weewx service that watches for data continuity - have it watch the timestamp on each loop packet. when it sees that a loop packet is missed (or maybe 5 loop packets), then do the power cycle. the driver should simply recover and continue capturing data. m On Monday, January 13, 2020 at 4:01:00 PM UTC-5, Andreas wrote: > > Hi all, > > I am using a TFA Nexus weather station which is know for losing its > sensors if connected to USB. The usage of a long USB cable with ferrites on > either end made it better, but a real improvement was the deactivation of > USB power after every import which is easy to handle on a raspberry pi with > uhubctl. > > Until now the following line is implemented in crontab and executed every > 15 minutes: > > sudo uhubctl - a on -p 2 && sudo service weewx start && sleep 10 && sudo > wee_reports /etc/weewx/weewx.conf && sleep 5 && sudo service weewx stop && > sudo uhubctl -a off -p 2 > > Because USB power is just switched on for several seconds, connection to > the sensors is not lost any more (exceptions possible), but I see > disadvantages because of the multiple terminations of weewx. The graphs > show missing data entries, the regular archive interval is interrupted and > - the worst thing in my eyes - after every start of weewx all report files > are recreated, e.g. every jpg file, favicon.ico etc. These files usually > only are created once after start, and on further archive periods only the > files are recreated which are stated in the skin.conf. > > I know I could improve my graphs by using 'line_gap_fraction > <http://weewx.com/docs/customizing.htm#line_gap_fraction>' or to change > the skin.conf to avoid the multiple creation of report files. But instead I > would like to start weewx only once and to switch on USB power just for the > short period of the data import. Following things would be possible: > > - in crontab just switch on/off USB every 15 minutes and in weewx set up > archive interval also to 15 minutes, hoping that both events correspond > long-lasting. > Disadvantage: I do not know how to harmonize both events so that USB is > certainly active if the archive interval starts. Moreover, it could be > dangerous if the USB connection was terminated within a data import. > > - let weewx execute the switch of USB with uhubctl > Every time before data is imported by weewx from the weather station, > weewx should switch on USB, when import is complete it should turn off USB > using 'sudo uhubctl - a on/off p 2'. Would this be possible? > > Great, but I do not have a clue about implementing this feature in weewx. > Any ideas? Could this be solved easily just by inserting a command in a > skin or report? The ftp report for example also causes console commands, > doesn't it? > > Thanks for your help and ideas, > Andreas > -- 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/798db0bd-cb8d-4474-84b4-df917f06a0da%40googlegroups.com.
