WS3080 Lockup - FineOffsetUsb workaround not working.

951 views
Skip to first unread message

Johannes Ebner

unread,
May 14, 2019, 2:37:07 AM5/14/19
to weewx-user
Hi,

I have the WS3080 and I have every couple of days the issue with the Lockup and not retreiving any data anymore.

Therefore I have followed the procedure of this page https://github.com/weewx/weewx/wiki/FineOffset-USB-lockup and bought the DLINK 7 Port Hub.

After connecting the Hub I was running lsusb:

pi@weewx:/etc/weewx $ lsusb
Bus 001 Device 003: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
Bus 001 Device 002: ID 2001:f103 D-Link Corp. DUB-H7 7-port USB 2.0 hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So the DLINK USB Hub is on 001:003

then I have downloaded usb_control and where running a scan:

pi@weewx:~ $ sudo python usb_control-0.7rc3.py --scan
device at :unknown
  id: 2001:f103
  class: hub
  manufacturer: unknown
  product: unknown
  num_ports: 7
  power_switching: individual
  indicator_support: none
  port 1: 0000.0100 power
  port 2: 0000.0100 power
  port 3: 0000.0100 power
  port 4: 0000.0303 lowspeed power enable connect
  port 5: 0000.0100 power
  port 6: 0000.0100 power
  port 7: 0000.0100 power


Here we can see again the USB Hub and also that the Weatherstation is connected to Port 4.


When running the following command nothing will happen.

pi@weewx:~ $ sudo python usb_control-0.7rc3.py --hub 001:002 --port 4 --power 0
looking for 001:002
no match for '1941:8021' at ''
no match for '2001:f103' at ''
no match for '1d6b:0002' at ''
001:002 not found

When running this command, I can turn off and on the Power of the Weatherstation:

pi@weewx:~ $ sudo python usb_control-0.7rc3.py --hub 2001:f103 --port 4 --power 0
looking for 2001:f103
no match for '1941:8021' at ''
found match for '2001:f103' at ''
no match for '1d6b:0002' at ''


this it the weewx.conf:

[FineOffsetUSB]
    # This section is for the Fine Offset series of weather stations.

    # The station model, e.g., WH1080, WS1090, WS2080, WH3081
    model = WS3080

    # How often to poll the station for data, in seconds
    polling_interval = 60
    polling_mode = PERIODIC

    #power_cycle_hub = 2001:f103
    power_cycle_hub = 001:002
    power_cycle_port = 4

    # The driver to use:
    driver = weewx.drivers.fousb

Regardless if I use 001:002 or 2001:f103 weewx will not powercycle the Weatherstation.

Any ideas?

I am using the latest stable weewx version.

Br,
Johannes

HoracioDos

unread,
May 14, 2019, 9:40:53 AM5/14/19
to weewx-user
Hello!

I also had problems to reset port with usb_control. I own the same WS. I was able to reset raspberry pi port 2 without a hub with uhubctl

sudo ./uhubctl -a cycle -p 2
Current status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0303 power lowspeed enable connect [1941:8021]
Sent power off request
New status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0000 off
Current status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0000 off
Sent power on request
New status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0301 power lowspeed connect [1941:8021]

HoracioDos

unread,
May 14, 2019, 9:43:11 AM5/14/19
to weewx-user
Beware that port 1 shutdowns the Pi

Leon Shaner

unread,
May 14, 2019, 10:44:10 AM5/14/19
to weewx...@googlegroups.com
Wow!  This is great to know!  Thanks!

I will try this and if it works in my case, I will add it as the primary remediation step in my weewx_watchdog.  =D

Regards,
\Leon
--
Leon Shaner :: Dearborn, Michigan (iPhone)
--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/a7237ce7-a910-430c-812e-fb95af77b81b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

HoracioDos

unread,
May 14, 2019, 6:37:02 PM5/14/19
to weewx-user
Hello!

Forget what I said. I don't know what I did that worked only once or at least I thought it worked. I can only shutdown the pi with option -p 1
i apologize for the confusion.

Johannes Ebner

unread,
Jun 9, 2019, 12:51:39 AM6/9/19
to weewx-user
I still have this issue. For me it seems that the Power-Cycle Implementation in WeeWx is broken.

Jun  9 02:48:17 weewx weewx[18929]: fousb: unstable read: blocks differ for ptr 0x003840
Jun  9 02:48:32 weewx weewx[18929]: fousb: get_observations failed: [Errno 110] Operation timed out
Jun  9 02:49:02 weewx weewx[18929]: fousb: avoid 0.268254041672
Jun  9 02:49:17 weewx weewx[18929]: fousb: get_observations failed: [Errno 110] Operation timed out
Jun  9 02:49:47 weewx weewx[18929]: fousb: avoid 2.95263600349
Jun  9 02:50:05 weewx weewx[18929]: fousb: get_observations failed: [Errno 110] Operation timed out
Jun  9 02:50:35 weewx weewx[18929]: fousb: avoid 2.95262002945
Jun  9 02:50:53 weewx weewx[18929]: fousb: get_observations failed: [Errno 110] Operation timed out
Jun  9 02:50:53 weewx weewx[18929]: engine: Main loop exiting. Shutting engine down.
Jun  9 02:50:53 weewx weewx[18929]: engine: Shutting down StdReport thread
Jun  9 02:50:53 weewx weewx[18929]: engine: StdReport thread has been terminated
Jun  9 02:50:53 weewx weewx[18929]: restx: Shut down MQTT thread.
Jun  9 02:50:53 weewx weewx[18929]: engine: Caught WeeWxIOError: Max retries exceeded while fetching observations
Jun  9 02:50:53 weewx weewx[18929]:     ****  Waiting 60 seconds then retrying...
Jun  9 02:51:53 weewx weewx[18929]: engine: retrying...
Jun  9 02:51:54 weewx weewx[18929]: engine: Using configuration file /etc/weewx/weewx.conf
Jun  9 02:51:54 weewx weewx[18929]: engine: Debug is 1
Jun  9 02:51:54 weewx weewx[18929]: engine: Initializing engine
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Jun  9 02:51:54 weewx weewx[18929]: fousb: driver version is 1.9
Jun  9 02:51:54 weewx weewx[18929]: fousb: power cycling enabled for port 4 on hub 001:002
Jun  9 02:51:54 weewx weewx[18929]: fousb: polling mode is PERIODIC
Jun  9 02:51:54 weewx weewx[18929]: fousb: polling interval is 60
Jun  9 02:51:54 weewx weewx[18929]: fousb: found station on USB bus= device=
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdTimeSynch
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdTimeSynch
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdConvert
Jun  9 02:51:54 weewx weewx[18929]: engine: StdConvert target unit is 0x1
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdConvert
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdCalibrate
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdCalibrate
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdQC
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdQC
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.wxservices.StdWXCalculate
Jun  9 02:51:54 weewx weewx[18929]: wxcalculate: The following values will be calculated: barometer=prefer_hardware, windchill=prefer_hardware, dewpoint=prefer_hardware, appTemp=prefer_hardware, rainRate=prefer_hardware, windrun=prefer_hardware, heatindex=prefer_hardware, maxSolarRad=prefer_hardware, humidex=prefer_hardware, pressure=prefer_hardware, inDewpoint=prefer_hardware, ET=prefer_hardware, altimeter=prefer_hardware, cloudbase=prefer_hardware
Jun  9 02:51:54 weewx weewx[18929]: wxcalculate: The following algorithms will be used for calculations: altimeter=aaNOAA, maxSolarRad=RS
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.wxservices.StdWXCalculate
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service user.weewxwd3.WdWXCalculate
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service user.weewxwd3.WdWXCalculate
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdArchive
Jun  9 02:51:54 weewx weewx[18929]: engine: Archive will use data binding wx_binding
Jun  9 02:51:54 weewx weewx[18929]: engine: Record generation will be attempted in 'software'
Jun  9 02:51:54 weewx weewx[18929]: engine: Using archive interval of 300 seconds (software record generation)
Jun  9 02:51:54 weewx weewx[18929]: engine: Use LOOP data in hi/low calculations: 1
Jun  9 02:51:54 weewx weewx[18929]: manager: Daily summary version is 2.0
Jun  9 02:51:54 weewx weewx[18929]: engine: Using binding 'wx_binding' to database 'weewx.sdb'
Jun  9 02:51:54 weewx weewx[18929]: manager: Starting backfill of daily summaries
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdArchive
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service user.weewxwd3.WdArchive
Jun  9 02:51:54 weewx weewx[18929]: WdArchive: WdArchive will use data binding wd_binding
Jun  9 02:51:54 weewx weewx[18929]: manager: Daily summary version is 2.0
Jun  9 02:51:54 weewx weewx[18929]: WdArchive: Using binding 'wd_binding' to database 'weewxwd.sdb'
Jun  9 02:51:54 weewx weewx[18929]: WdArchive: Starting backfill of daily summaries
Jun  9 02:51:54 weewx weewx[18929]: manager: Starting backfill of daily summaries
Jun  9 02:51:54 weewx weewx[18929]: WdArchive: Daily summaries up to date.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service user.weewxwd3.WdArchive
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdStationRegistry
Jun  9 02:51:54 weewx weewx[18929]: restx: StationRegistry: Registration not requested.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdStationRegistry
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdWunderground
Jun  9 02:51:54 weewx weewx[18929]: restx: Wunderground: Posting not enabled.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdWunderground
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdPWSweather
Jun  9 02:51:54 weewx weewx[18929]: restx: PWSweather: Posting not enabled.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdPWSweather
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdCWOP
Jun  9 02:51:54 weewx weewx[18929]: restx: CWOP: Posting not enabled.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdCWOP
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdWOW
Jun  9 02:51:54 weewx weewx[18929]: restx: WOW: Posting not enabled.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdWOW
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.restx.StdAWEKAS
Jun  9 02:51:54 weewx weewx[18929]: restx: AWEKAS: Posting not enabled.
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.restx.StdAWEKAS
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service user.mqtt.MQTT
Jun  9 02:51:54 weewx weewx[18929]: restx: MQTT: service version is 0.18
Jun  9 02:51:54 weewx weewx[18929]: restx: MQTT: binding to ['archive', 'loop']
Jun  9 02:51:54 weewx weewx[18929]: restx: MQTT: topic is weather/weewx
Jun  9 02:51:54 weewx weewx[18929]: restx: MQTT: desired unit system is METRIC
Jun  9 02:51:54 weewx weewx[18929]: restx: MQTT: data will be uploaded to mqtt://mqtt:x...@192.168.1.253:1883/
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service user.mqtt.MQTT
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdPrint
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdPrint
Jun  9 02:51:54 weewx weewx[18929]: engine: Loading service weewx.engine.StdReport
Jun  9 02:51:54 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdReport
Jun  9 02:51:54 weewx weewx[18929]: engine: Starting up weewx version 3.9.1
Jun  9 02:51:54 weewx weewx[18929]: engine: Station does not support reading the time
Jun  9 02:51:54 weewx weewx[18929]: manager: Daily summary version is 2.0
Jun  9 02:52:09 weewx weewx[18929]: fousb: get_records failed: [Errno 110] Operation timed out
Jun  9 02:52:54 weewx weewx[18929]: fousb: get_records failed: [Errno 110] Operation timed out
Jun  9 02:53:39 weewx weewx[18929]: fousb: get_records failed: [Errno 110] Operation timed out
Jun  9 02:54:24 weewx weewx[18929]: fousb: get_records failed: [Errno 110] Operation timed out
Jun  9 02:54:24 weewx weewx[18929]: engine: Main loop exiting. Shutting engine down.
Jun  9 02:54:24 weewx weewx[18929]: restx: Shut down MQTT thread.
Jun  9 02:54:24 weewx weewx[18929]: engine: Caught WeeWxIOError: Max retries exceeded while fetching records
Jun  9 02:54:24 weewx weewx[18929]:     ****  Waiting 60 seconds then retrying...
Jun  9 02:55:24 weewx weewx[18929]: engine: retrying...
Jun  9 02:55:24 weewx weewx[18929]: engine: Using configuration file /etc/weewx/weewx.conf
Jun  9 02:55:24 weewx weewx[18929]: engine: Debug is 1
Jun  9 02:55:24 weewx weewx[18929]: engine: Initializing engine
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading station type FineOffsetUSB (weewx.drivers.fousb)
Jun  9 02:55:24 weewx weewx[18929]: fousb: driver version is 1.9
Jun  9 02:55:24 weewx weewx[18929]: fousb: power cycling enabled for port 4 on hub 001:002
Jun  9 02:55:24 weewx weewx[18929]: fousb: polling mode is PERIODIC
Jun  9 02:55:24 weewx weewx[18929]: fousb: polling interval is 60
Jun  9 02:55:24 weewx weewx[18929]: fousb: found station on USB bus= device=
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading service weewx.engine.StdTimeSynch
Jun  9 02:55:24 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdTimeSynch
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading service weewx.engine.StdConvert
Jun  9 02:55:24 weewx weewx[18929]: engine: StdConvert target unit is 0x1
Jun  9 02:55:24 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdConvert
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading service weewx.engine.StdCalibrate
Jun  9 02:55:24 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdCalibrate
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading service weewx.engine.StdQC
Jun  9 02:55:24 weewx weewx[18929]: engine: Finished loading service weewx.engine.StdQC
Jun  9 02:55:24 weewx weewx[18929]: engine: Loading service weewx.wxservices.StdWXCalculate

I can see here that "power cycling" is enabled, but it is not executed.

When running

sudo python usb_control-0.7rc3.py --hub 2001:f103 --port 4 --power 0
sudo python usb_control-0.7rc3.py --hub 2001:f103 --port 4 --power 1

The Weatherstation gets resetted and everything works again.

Br,
Johannes

Nick

unread,
Jun 9, 2019, 8:33:54 AM6/9/19
to weewx...@googlegroups.com
On 09/06/2019 05:51, 'Johannes Ebner' via weewx-user wrote:
> I still have this issue. For me it seems that the Power-Cycle
> Implementation in WeeWx is broken.
>

Hi,

I am in the same boat :-(

I am not sure if it is the power cycling in weewx or (here at least) the
implementation of the sub-system used

If I run the usb_control program I get:

<code>

sudo python ./usb_control-0.6.py
Traceback (most recent call last):
File "./usb_control-0.6.py", line 191, in <module>
main()
File "./usb_control-0.6.py", line 188, in main
scan()
File "./usb_control-0.6.py", line 73, in scan
print "device at %s:%03d" % (bus.dirname, dev.devnum)
TypeError: %d format: a number is required, not NoneType

</code>

So obviously it won't work ...

However uhubctl work 100% - I am at a loss ...

Any help would be appreciated.

Regards/73

Nick
M0HGU


--
The truth may be out there, but lies are inside your head.
(Hogfather)
13:25:02 up 10 days, 1:57, 10 users, load average: 0.81, 0.83, 1.04

signature.asc
Message has been deleted
Message has been deleted

Johannes Ebner

unread,
Jun 23, 2019, 2:30:53 AM6/23/19
to weewx...@googlegroups.com
How is this script working?

Do you run it once and it stays in the background? Or do you run it via crontab?

Br,
Johannes

Am Sa., 22. Juni 2019 um 14:48 Uhr schrieb Dave, G1OGY <dave...@gmail.com>:


On Saturday, 22 June 2019 13:05:21 UTC+1, Dave, G1OGY wrote:


   while read line ; do
       echo "$line" | grep -q "[Errno 110]"
          if [ $? = 0 ]



the "[" "]" are an unforeseen problem to `grep`;
Change to simply:
     "Errno 110"


'OGY
--- 

--
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/topic/weewx-user/owhSpmklNlc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ceed2f5d-c73c-45aa-92e5-b343679f523c%40googlegroups.com.
Message has been deleted

Dave, G1OGY

unread,
Jun 23, 2019, 4:03:18 AM6/23/19
to weewx-user


On Sunday, 9 June 2019 13:33:54 UTC+1, Nick wrote:
On 09/06/2019 05:51, 'Johannes Ebner' via weewx-user wrote:
> I still have this issue. For me it seems that the Power-Cycle
> Implementation in WeeWx is broken.
>

Hi,

I am in the same boat :-(


Likewise.

I have just implemented a couple of scripts to use `uhubctrl` (which does control the RPi's USB port):

   #!/bin/bash
   # monitorlockup
   # watch the weewx log file for lockup condition and use USB power recycling to clear the lockup
   # 20190622
  
   LOGfile="<path-to>/weewx.log"
   tail -Fn0 $LOGfile |
   while read line ; do
       echo "$line" | grep -q "Errno 110"
          if [ $? = 0 ]
              then
                  /home/weewx/powercycleusb
          fi
  done

And

   #!/bin/bash
   # powercycleusb

   <path-to>/uhubctl -a off -p2
   sleep 45
   <path-to>/uhubctl -a on -p2

Both scripts are executable, owned by root and also setuid root.
`monitorlockup` will run from /etc/rc.local on boot (I trust).

Note: The -F (CAPS) in `tail` should track the logfile despite any log rotation.

It is possible that the 45 second `sleep` could be reduced.  
My logs show approx 2 minutes between the first (of 4) prints of [`Errno 110]` 
so I hope to have the console restarted and stable before `weewx` resets itself.

Does it work?  Time will tell... 

Dave, G1OGY

unread,
Jun 23, 2019, 4:06:18 AM6/23/19
to weewx-user


On Sunday, 23 June 2019 07:30:53 UTC+1, Johannes Ebner wrote:
How is this script working?

Do you run it once and it stays in the background? Or do you run it via crontab?



ATM it is running from the command line as I did not want to reboot the Pi:

     /home/weewx/monitorlockup &

I have also added that command line to /etc/rc.local so that the script will start on reboot.

The monitoring script sits in the background waiting for a log print.  When weewx writes to the log file the script wakes up and checks the new log line(s) for "Errno 110".  If the string is absent the script goes back to waiting for the next log print.  If the print is an error line then it fires off the second script to powercycle the relevant USB port.
You can watch it come alive every 5 minutes with `top(1)`.

Obviously, you will need to have acquired and built the source of `uhubctrl` in advance.

Nick

unread,
Jun 23, 2019, 5:21:29 AM6/23/19
to weewx...@googlegroups.com
Dave,

Very many thanks

The bit of the puzzle (& confess I'd not looked hard) was how tp parse
the log file - easily (& not read ALL of it each time and keep count or
numbers of errors etc. etc. etc.)

Now in place on my system (not a Pi) and not yet rebooted as it is also
the system for WxSat images (EuMetCast MSG)

Thanks again

Nick
(who really ought to read 'man $CMD' more often)
p.s. I see the cookie monster is reading my emails again :-)

--
"But you read a lot of books, I'm thinking. Hard to have faith, ain't
it, when you've read too many books?"
(Carpe Jugulum)
10:15:02 up 8 days, 13 min, 8 users, load average: 0.83, 0.93, 0.91

signature.asc

Dave, G1OGY

unread,
Jun 24, 2019, 1:57:36 PM6/24/19
to weewx-user


On Sunday, 23 June 2019 10:21:29 UTC+1, Nick wrote:


Very many thanks


You (and all) are welcome.

Been thinking (bad habit)...
add to the end of `powercycleusb` - should be OK while `monitor...` is running

    logger -t powercycleusb USB port <your-USB-port> - power cycled

the logger(1) adds the date/time 

Nick

unread,
Jun 24, 2019, 2:14:46 PM6/24/19
to weewx...@googlegroups.com
:-)

I just got it to send me an email - not had a failure yet ... but it
works as a dry run.

Regards all

Nick
M0HGU

--
'You've got the loudest silences I ever did hear from anyone who wasn't
dead!'
(Lords and Ladies)
19:10:01 up 9 days, 9:08, 8 users, load average: 1.05, 1.04, 0.77

signature.asc

Johannes Ebner

unread,
Jul 15, 2019, 5:54:29 AM7/15/19
to weewx-user
Thanks, works perfectly for me!

Br,
Johannes

Dave (G1OGY)

unread,
Jul 15, 2019, 6:06:46 AM7/15/19
to weewx...@googlegroups.com
Good news, Johannes!
I'm pleased it helps.


--
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/topic/weewx-user/owhSpmklNlc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

HoracioDos

unread,
Jul 15, 2019, 9:08:17 AM7/15/19
to weewx-user
Hello Dave.

Did uhubctl work for you? Which raspberry pi model do you have? Are you using a usb hub?
uhubctl can disable port 2 but it still provide power to the weather station.so it can reset the WS.

Any hint will be welcome.
Thanks in advance!


On Monday, July 15, 2019 at 7:06:46 AM UTC-3, Dave (G1OGY) wrote:
Good news, Johannes!
I'm pleased it helps.
On Mon, 15 Jul 2019, 10:54 'Johannes Ebner' via weewx-user, <weewx...@googlegroups.com> wrote:
Thanks, works perfectly for me!

Br,
Johannes

Am Sonntag, 23. Juni 2019 10:06:18 UTC+2 schrieb Dave, G1OGY:


On Sunday, 23 June 2019 07:30:53 UTC+1, Johannes Ebner wrote:
How is this script working?

Do you run it once and it stays in the background? Or do you run it via crontab?



ATM it is running from the command line as I did not want to reboot the Pi:

     /home/weewx/monitorlockup &

I have also added that command line to /etc/rc.local so that the script will start on reboot.

The monitoring script sits in the background waiting for a log print.  When weewx writes to the log file the script wakes up and checks the new log line(s) for "Errno 110".  If the string is absent the script goes back to waiting for the next log print.  If the print is an error line then it fires off the second script to powercycle the relevant USB port.
You can watch it come alive every 5 minutes with `top(1)`.

Obviously, you will need to have acquired and built the source of `uhubctrl` in advance.

--
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/topic/weewx-user/owhSpmklNlc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

Johannes Ebner

unread,
Jul 15, 2019, 9:59:49 AM7/15/19
to weewx-user
I am using it with a USB Hub from Linksys on a Raspberry Pi Zero W.

uhubctl works without issues. I am shutting down the corresponding USB Port of the USB Hub.

Dave (G1OGY)

unread,
Jul 15, 2019, 10:27:04 AM7/15/19
to weewx...@googlegroups.com
uhubctl works fine on my Pi.

pi@raspberrypi4:/home/weewx $ sudo ./powercycleusb

Current status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0100 power
Sent power off request
New status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0000 off
Current status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0000 off
Sent power on request
New status for hub 1-1 [0424:9514, USB 2.00, 5 ports]
  Port 2: 0100 power

My current command line is:
# <path-to>/uhubctl -d 15 -a cycle -p 2

And the O/S is

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
pi@raspberrypi4:/home/weewx $ uname -a
Linux raspberrypi4 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

This Pi is a 3-B v1.2 (quad core).

Bear in mind that you must not have any other power source for the WeatherStation.  You must take the batteries out and/or disconnect any wall-wart; thus powering the Station ~only~ from the Pi's USB port.

Dave, G1OGY


To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/51dc66c7-d2ca-4e85-bb11-5e44f657fb63%40googlegroups.com.

HoracioDos

unread,
Jul 15, 2019, 11:16:00 AM7/15/19
to weewx-user
Thanks Johannes and Dave for your quick answer.
I have realized that I got confused between raspberry pi models. My old Pi 1 model B works perfectly fine with weewx but it is not supported by uhubctl. I have five pi 1 model B and two Pi 2 model B that still do their job without any problems running raspbian buster. I'm going to swap micro usb cards between them and check if uhubctl works. Supported models are: B+, 2 B, 3 B (port 2 only)
Thanks again!
Message has been deleted

Dave, G1OGY

unread,
Feb 15, 2020, 4:50:05 PM2/15/20
to weewx-user
I believe I have identified a hitherto unreported "lockup" situation with a Fine Offset system.
The USB lockup suffered by certain systems is known and work-arounds have been published 
(not least by me); this problem is manifest by Wind, Rain, Temp/Humidity being absent while Solar
data continues to be reported on the console.
The weewx log prints the following report:
<day> <time> <hostname> weewx[<PID>]: fousb: station status {'unknown': 0, 'lost_connection': 64, 'rain_overflow': 0} (64)

Note that this print is ~similar~ to that printed after startup and catch-up of EEPROM data:
<day> <time> <hostname>  weewx[<PID>]: engine: Starting main packet loop.
<day> <time> <hostname>  weewx[<PID>]: fousb: station status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0} (0)

The difference being the `'lost_connection': 64,` inclusion and the final characters: `(64)`.
This is the (new) lockup condition. There is no "Errno" print.

Because the majority of the log text is printed while the system is in a benign state and not 
being sufficiently clever to grep out either/or of the error condition prints - the quoted long text within the 
string defeated me - I have modified my lockup-detector script to capture the unique `(64)` and fire off the 
USB power cycler script. 
It is sufficient.



#!/bin/bash
# monitorlockup
# watch the weewx log file for lockup condition and use USB power recycling to clear the lockup
# 20190622+20200110


LOGfile=/home/weewx/weather/logs/weewx.log
tail
-Fn0 $LOGfile |
while read line ; do
    echo
"$line" | grep -qe 'Errno 110' -e '(64)'

       
if [ $? = 0 ]
           
then

                logger
-t monitorlockup Error No 110 or lost connection 64 Observed in weewx.log
               
/home/weewx/powercycleusb
       
fi
done
READY
=1




and the power-cycler (requires acquisition and build of `uhubctl`)



#!/bin/bash
/home/weewx/uhubctl -d 15 -a cycle -p 2


logger
-t powercycleusb USB port 2 power cycled

READY
=0


YMMV!
[RPi2B, Raspian 10.2, Weewx 3.9.2: http://g1ogy.com/wx ]

-- 
Dave, G1OGY

Andrew Milner

unread,
Feb 16, 2020, 12:01:50 AM2/16/20
to weewx-user
I think lost connection:64 indicates a lost connection beteen base station and external transmitter - probably caused by a low battery - have you tried changing the batteries in the external transmitter??

Dave, G1OGY

unread,
Feb 16, 2020, 5:37:48 AM2/16/20
to weewx-user


On Sunday, 16 February 2020 05:01:50 UTC, Andrew Milner wrote:
I think lost connection:64 indicates a lost connection beteen base station and external transmitter - probably caused by a low battery - have you tried changing the batteries in the external transmitter??



Hello Andrew
Thanks for the suggestion.  Low battery could be a contributory factor (2 standard alkalines installed in Jan) but note that Solar data continues to be displayed during these `lost connection: 64` episodes.  

Furthermore, I can ~see~, with the aid of an SDR, all three transmissions sequences being sent at equitable signal strengths during a Wind/Temp/RH/Rain outage.
A console restart (when unattended) or a 4-second hold of the `Down-Arrow` recovers full functionality within three cycles, usually.

The manual states that 8 missed packets triggers the condition (it may not be coincidence that 8^2=64) the trick will be to find the cause; maybe `per site` (battery/interference/underperforming firmware/...).  Of course, this scenario may be limited to those Fine Offset systems with Solar capability but the point is - It Happens Here.  What I propose is an enhanced auto-recovery method should others find themselves in the same situation.

-D

Reply all
Reply to author
Forward
0 new messages