Author Topic: WH3080 communications issue due to flaky USB interface - remedy  (Read 8031 times)

Michel

  • Gentle Breeze
  • **
  • Posts: 46
    • MichelsWunderland
  • Station Details: WH3080 - See website for details
WH3080 communications issue due to flaky USB interface - remedy
« on: December 01, 2015, 11:30:39 AM »

Dear WH3080 (and derivatives) users !

It seems that a lot (if not all) of the WH3080 stations (and its derivatives
sold under various brandings) do suffer from a poor implementation of the USB
bus or its driver causing communications failures with the computer or WeatherCat
respectively. The only remedy then is resetting the weather station, which is
difficult at times you aren't near the computer or the station.
Hence I implemented a little watchdog procedure which makes use of WC's COMMSFAILFLAG$
and which will reset the station and restore comms in case of a failure.

Prerequisites are a little piece of additional software and an USB hub
compatible with it. The software is used to toggle the USB port's power the
WH3080 is connected to. This little software package (just 27k) can be found at:

https://github.com/mvp/uhubctl

Download, unzip and run make...

It's possible your Mac's built-in USB hub supports the commands sent via uhubctl.
But this depends upon the exact model - some don't support these commands.
If it doesn't, you'll have to get hold of an additional USB hub. For a list
of compatible models see https://github.com/mvp/uhubctl - but be assured the
list is incomplete. There are further compatible USB hubs like f.i. the
D-Link DU-H7 (turquoise housing).

How to put it to work...

1 - In order to make use of WC's COMMSFAILFLAG$ you need to put a file into the
    folder WeatherCat expects files to be resident in for being processed. F.i.:

    /Users/your_name/WeatherCat_files_2beProcessed/comms_stat.txt :

    Station communications failure status is COMMSFAILFLAG$

2 - Add the following to your crontab:

    0,10,20,30,40,50 * * * * /Users/your_name/scripts/check_ws-comms.sh >> /Users/your_name/log/check_ws-comms.log


3 - /Users/your_name/scripts/check_ws-comms.sh

-------------------------------------------------------------------------------

FILE="/Users/your_name/WeatherCat_output/comms_stat.txt"

if [ -f $FILE ];
 then
   if grep -q "failure status is 1" /Users/your_name/WeatherCat_output/comms_stat.txt;
    then
     echo `date` " - Communications failure detected, trying to restore them"

     osascript -e 'tell application "WeatherCat" to quit'
     sleep 20
     
# modify the value for -n according to the hub and port address used with the
# weather station - run uhubctl manually from the command line to see how that
# works.

     /Applications/Utilities/uhubctl -n 05e3:0604 -p 1 -a 2 -d 2
     sleep 180
     osascript -e 'tell application "WeatherCat" to launch'

# Following line is optional. It sends mail via a command line mail interface, in this case "mutt" which probably won't be installed on your system.
#    echo "Weather station comms failed, check whether relaunch procedure succeeded" | /usr/local/bin/mutt -s "WH3080 restarted" your.name@your.domain

    else
     MINU=$(date +%M)
     if [ "$MINU" -eq 00 ]; then
     echo `date` " - Time stamp"
    fi
   fi

 else
   echo "File $FILE does not exist."
   echo "Start and configure WeatherCat first."
fi
   
-------------------------------------------------------------------------------

And ensure your WH3080 (or derivative) runs on USB power only
as soon as the above script is put into operations, since toggling
the USB port's power with batteries inserted would not really help ...

Useless to mention the above directory and file names are suggestions only...

Those of you being bothered by the WH3080's USB interface will (I believe ;-)
feel more comfortable with this little workaround.

 Regards !

  Michel



elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6661
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Thanks for sharing! (Re: WH3080 communications issue - remedy)
« Reply #1 on: December 01, 2015, 11:47:37 PM »
Dear Michel and WeatherCat victims of hardware that is "a little economical" to work properly. . . .

Thanks for sharing your solution.  I would assume it might work on some other brands of stations as well.

Would you mind if I copied your posting onto the WeatherCat Wiki?  We are definitely short of remedies related to the WH3080.

Thanks again,

Edouard

Blicj11

  • Storm
  • *****
  • Posts: 4061
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Sonoma 14.8.3 | WeatherCat 3.3 | Supportive Wife
Re: WH3080 communications issue due to flaky USB interface - remedy
« Reply #2 on: December 02, 2015, 07:04:23 AM »
Nice work Michel. Thanks for the contribution.
Blick


Michel

  • Gentle Breeze
  • **
  • Posts: 46
    • MichelsWunderland
  • Station Details: WH3080 - See website for details
Re: Thanks for sharing! (Re: WH3080 communications issue - remedy)
« Reply #3 on: December 02, 2015, 09:20:24 AM »
Edouard,

Quote
Thanks for sharing your solution.  I would assume it might work on some other brands of stations as well.

Sharing such solutions always is a pleasure since you know there probably is some soul out there being happy to find it.
And yes, it will work on all brands of the "Fine Offset" hardware, be it "Velleman" or "Froggit" or whatever. At least I can't
see any reason why it shouldn't since the only difference between the brands is the console's label.

Quote
Would you mind if I copied your posting onto the WeatherCat Wiki?  We are definitely short of remedies related to the WH3080.

I would not mind, of course - I would appreciate it !
In case you already prepared/accomplished something in this regard, you might need to update it since I added a hint
that batteries of course need to be removed from the console if one expects the procedure to work :)

 Regards !

    Michel

Michel

  • Gentle Breeze
  • **
  • Posts: 46
    • MichelsWunderland
  • Station Details: WH3080 - See website for details
Re: WH3080 communications issue due to flaky USB interface - remedy
« Reply #4 on: December 02, 2015, 09:27:03 AM »
Quote
Nice work Michel.

<Blush>  Thanks for the kudos  :-)



mcrossley

  • Gale
  • ****
  • Posts: 277
  • Sorry, I'm not a WeatherCat user!
    • ICHESHIR25
    • Wilmslow Astro Weather
  • Station Details: Davis VP2 + home brew
Re: WH3080 communications issue due to flaky USB interface - remedy
« Reply #5 on: December 02, 2015, 09:46:55 AM »
The USB 'issues' with later model Fine Offset stations causing the console to lock up are pretty well known. I don't know if WeatherCat implements any sort of workaround for it, but I know Cumulus and pywws do. For those that don't know, the problem seems to be caused when the station memory is read at the same time the console is writing to it. Cumulus and pywws have the option to 'back off' their reads at the expected memory update time, this strategy has proved very successful in virtually eliminating the lockups for most people.
Mark