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/uhubctlDownload, 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