weewx StdReport exits if USB disconnected

335 views
Skip to first unread message

Rich K

unread,
Aug 20, 2018, 4:37:13 AM8/20/18
to weewx-user
Hi everyone,

I have a FineOffsetUSB WH1080 weather station connected via USB cable to a Raspberry Pi running weewx 3.8.2 and all is well.

However, if I disconnect the USB cable, the following occurs:

Aug 17 17:15:33 raspberrypi kernel: [ 3493.146569] usb 1-1.5: USB disconnect, device number 4
Aug 17 17:16:08 raspberrypi weewx[436]: fousb: get_observations failed: [Errno 19] No such device (it may have been disconnected)
Aug 17 17:16:38 raspberrypi weewx[436]: fousb: avoid 1.36598801613
Aug 17 17:16:40 raspberrypi weewx[436]: fousb: get_observations failed: [Errno 19] No such device (it may have been disconnected)
Aug 17 17:17:01 raspberrypi CRON[1014]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Aug 17 17:17:10 raspberrypi weewx[436]: fousb: get_observations failed: [Errno 19] No such device (it may have been disconnected)
Aug 17 17:17:40 raspberrypi weewx[436]: fousb: get_observations failed: [Errno 19] No such device (it may have been disconnected)
Aug 17 17:17:40 raspberrypi weewx[436]: engine: Main loop exiting. Shutting engine down.
Aug 17 17:17:40 raspberrypi weewx[436]: engine: Shutting down StdReport thread
Aug 17 17:17:40 raspberrypi weewx[436]: engine: StdReport thread has been terminated
Aug 17 17:17:40 raspberrypi weewx[436]: restx: Shut down Wunderground-PWS thread.
Aug 17 17:17:40 raspberrypi weewx[436]: engine: Caught WeeWxIOError: Max retries exceeded while fetching observations
Aug 17 17:17:40 raspberrypi weewx[436]:     ****  Waiting 60 seconds then retrying...
Aug 17 17:18:40 raspberrypi weewx[436]: engine: retrying...
Aug 17 17:18:40 raspberrypi weewx[436]: engine: Using configuration file /home/weewx/weewx.conf
Aug 17 17:18:40 raspberrypi weewx[436]: engine: Debug is 1
Aug 17 17:18:40 raspberrypi weewx[436]: engine: Initializing engine
Aug 17 17:18:40 raspberrypi weewx[436]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Aug 17 17:18:40 raspberrypi weewx[436]: fousb: driver version is 1.9
Aug 17 17:18:40 raspberrypi weewx[436]: fousb: polling mode is PERIODIC
Aug 17 17:18:40 raspberrypi weewx[436]: fousb: polling interval is 60
Aug 17 17:18:40 raspberrypi weewx[436]: fousb: Cannot find USB device with Vendor=0x1941 ProdID=0x8021 Device=None
Aug 17 17:18:40 raspberrypi weewx[436]: import of driver failed: Unable to find USB device (<class 'weewx.WeeWxIOError'>)
Aug 17 17:18:40 raspberrypi weewx[436]: engine: Unable to load driver: Unable to find USB device
Aug 17 17:18:40 raspberrypi weewx[436]:     ****  Exiting...

Then when I reconnect the cable:

Aug 17 17:50:09 raspberrypi kernel: [ 5569.605720] usb 1-1.5: new low-speed USB device number 5 using dwc_otg
Aug 17 17:50:09 raspberrypi kernel: [ 5569.781581] usb 1-1.5: New USB device found, idVendor=1941, idProduct=8021
Aug 17 17:50:09 raspberrypi kernel: [ 5569.781594] usb 1-1.5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Aug 17 17:50:09 raspberrypi mtp-probe: checking bus 1, device 5: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5"
Aug 17 17:50:09 raspberrypi mtp-probe: bus: 1, device: 5 was not an MTP device
Aug 17 17:50:09 raspberrypi kernel: [ 5569.815823] hid-generic 0003:1941:8021.0002: hiddev96,hidraw0: USB HID v1.00 Device [HID 1941:8021] on usb-3f980000.usb-1.5/input0

This is probably expected behaviour.

However, weewx never "resumes" or never starts sending data to my remote MySQL database or to Wunderground.

I'm guessing because of this:

Aug 17 17:17:40 raspberrypi weewx[436]: engine: Shutting down StdReport thread
Aug 17 17:17:40 raspberrypi weewx[436]: engine: StdReport thread has been terminated

The only way to get things moving again is to restart the weewx service (or the entire Raspberry Pi).

Is there a setting I can change to have weewx  keep retrying every 60 seconds?  Rather than it giving up after the first failed retry attempt?

Thanks!


gjr80

unread,
Aug 20, 2018, 5:14:41 AM8/20/18
to weewx-user
Hi,

You are right, what you see is expected behaviour though StdReport has nothing to do with it - it's just a victim of the fault. You can have WeeWX continually retry loading the driver if the driver fails to load through use of the loop_on_init config option in weewx.conf. I think loop_on_init was more intended for use when WeeWX is first starting and the driver cannot be loaded, but I think it should work in your case. You can read about loop_on_init in the User's Guide (http://weewx.com/docs/usersguide.htm#General).

Gary

Rich K

unread,
Aug 20, 2018, 5:32:51 AM8/20/18
to weewx-user
Morning Gary, thanks for the quick reply, and for the link!

There is no 'loop_on_init' in my current weewx.conf, I take it I can simply add it in, like so:

# WEEWX CONFIGURATION FILE
#
# Copyright (c) 2009-2015 Tom Keffer <tke...@gmail.com>
# See the file LICENSE.txt for your rights.

##############################################################################

# This section is for general configuration information.

# Set to 1 for extra debug info, otherwise comment it out or set to zero
debug = 1

# Root directory of the weewx data file hierarchy for this station
WEEWX_ROOT = /home/weewx

# How long to wait before timing out a socket (FTP, HTTP) connection
socket_timeout = 20

# Keeping retrying!

loop_on_init = 1


# Do not modify this. It is used when installing and updating weewx.
version = 3.8.2

##############################################################################

#   This section is for information about the station.

[Station]

Then save those changes and restart the weewx service?

Simple as that?!

gjr80

unread,
Aug 20, 2018, 5:34:39 AM8/20/18
to weewx-user
G'day Rich,

Yep, exactly that.

Gary

Rich K

unread,
Aug 20, 2018, 8:41:24 AM8/20/18
to weewx-user
Gary, just wanted to say "Thank you!!"

That's done exactly what I needed :)

Tested multiple times this morning, not a single problem.

Thanks my friend, very grateful!!!
Reply all
Reply to author
Forward
0 new messages