fineoffset usb lockup and Yepkit USB Switchable Hub

248 views
Skip to first unread message

Don

unread,
Jun 5, 2017, 11:32:21 PM6/5/17
to weewx-user
I have a fineoffset weather station and a yepkit usb switchable hub running weewx version 3.7.2 on ubuntu 17.04.

The usb hub is at bus 001, device 004 and the weather station on port 1.

don@wee:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 04d8:f2f7 Microchip Technology, Inc.
Bus 001 Device 011: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
Bus 001 Device 004: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 007: ID 04ca:3007 Lite-On Technology Corp.
Bus 001 Device 002: ID 0483:5020 STMicroelectronics
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

don@wee:~$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 480M
    |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 2: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 7, If 1, Class=Wireless, Driver=btusb, 12M
    |__ Port 4: Dev 7, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 6: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 11, If 0, Class=Human Interface Device, Driver=, 1.5M
        |__ Port 4: Dev 6, If 0, Class=Human Interface Device, Driver=, 12M

The relevant parts of the wee configuration are as follows.

[FineOffsetUSB]
    # This section is for the Fine Offset series of weather stations.
   
    # The station model, e.g., WH1080, WS1090, WS2080, WH3081
    model = WH3081
   
    # How often to poll the station for data, in seconds
    polling_interval = 60
   
    # The driver to use:
    driver = weewx.drivers.fousb

    power_cycle_hub = 001:004
    power_cycle_port = 1

When a lockup occurs (about every two or three weeks) the following is shown in the logs.

Jun 04 06:05:25 wee weewx[1729]: fousb: Attempting to power cycle
Jun 04 06:05:25 wee weewx[1729]: engine: Caught unrecoverable exception in engine:
Jun 04 06:05:25 wee weewx[1729]:     ****  %d format: a number is required, not NoneType
Jun 04 06:05:25 wee weewx[1729]:     ****  Traceback (most recent call last):
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/engine.py", line 865, in main
Jun 04 06:05:25 wee weewx[1729]:     ****      engine = engine_class(config_dict)
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/engine.py", line 77, in __init__
Jun 04 06:05:25 wee weewx[1729]:     ****      self.loadServices(config_dict)
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/engine.py", line 141, in loadServices
Jun 04 06:05:25 wee weewx[1729]:     ****      self.service_obj.append(weeutil.weeutil._get_object(svc)(self, config_dict))
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/engine.py", line 466, in __init__
Jun 04 06:05:25 wee weewx[1729]:     ****      if software_interval != self.engine.console.archive_interval:
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 991, in archive_interval
Jun 04 06:05:25 wee weewx[1729]:     ****      return self._archive_interval_minutes() * 60
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 1006, in _archive_interval_minutes
Jun 04 06:05:25 wee weewx[1729]:     ****      power_cycle_station(self.pc_hub, self.pc_port)
Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 715, in power_cycle_station
Jun 04 06:05:25 wee weewx[1729]:     ****      devid = "%s:%03d" % (bus.dirname, dev.devnum)
Jun 04 06:05:25 wee weewx[1729]:     ****  TypeError: %d format: a number is required, not NoneType
Jun 04 06:05:25 wee weewx[1729]:     ****  Exiting.


Also of interest,

on@wee:~$ python2 usb_control-0.6.py --scan
Traceback (most recent call last):
  File "usb_control-0.6.py", line 190, in <module>
    main()
  File "usb_control-0.6.py", line 187, in main
    scan()
  File "usb_control-0.6.py", line 72, in scan
    print "device at %s:%03d" % (bus.dirname, dev.devnum)
TypeError: %d format: a number is required, not NoneType

Using the yepkit software I can turn the port on and off successfully.

Any one with any thoughts?

Thanks heaps,
Don




mwall

unread,
Jun 6, 2017, 8:54:47 AM6/6/17
to weewx-user


On Monday, June 5, 2017 at 11:32:21 PM UTC-4, Don wrote:

Jun 04 06:05:25 wee weewx[1729]:     ****    File "/usr/share/weewx/weewx/drivers/fousb.py", line 715, in power_cycle_station
Jun 04 06:05:25 wee weewx[1729]:     ****      devid = "%s:%03d" % (bus.dirname, dev.devnum)
Jun 04 06:05:25 wee weewx[1729]:     ****  TypeError: %d format: a number is required, not NoneType
Jun 04 06:05:25 wee weewx[1729]:     ****  Exiting.


the code for managing a powered hub in fousb.py assumes pyusb version 0.1.  newer versions of pyusb return None for dirname and devnum.

as a workaround, you could change line 715 from this:


devid = "%s:%03d" % (bus.dirname, dev.devnum)

to this:

devid = "%s:%s" % (bus.dirname, dev.devnum)

but that will probably only prevent the exception - it won't enable the power cycling because you won't get a match for dirname:devnum.

another option is to downgrade to pyusb 0.1 instead of pyusb 1.0

one of these days i'll have to make the hub control stuff into a standalone weewx service...

m

Don

unread,
Jun 7, 2017, 4:54:20 AM6/7/17
to weewx-user
Thanks for that.

I tried downgrading pyusb but it seemed difficult.
I tried changing fousb.py to use the new version of pyusb but it seemed difficult.
I tried making fousb.py use the legacy interface to pyusb but that turned into a black hole of pain.

So I hacked fousb.py to execute the yepkit command directly. yuck! but it seems to work.

Thanks,
Don

Joachim Rummler

unread,
Aug 9, 2018, 12:53:29 PM8/9/18
to weewx-user
Hello,

I've the same problem with my WH1080. I bought a yepkit ykush xs. Because I#m not familiar with programming I would like how you changed the fousb.py to get it to work. I think yepkit doesn't know the power_cycle command only "on" or "off". Do you have some advices or help or the driver for me?

Thank you for your help

Joachim
Reply all
Reply to author
Forward
0 new messages