On Monday, 15 July 2019 16:16:00 UTC+1, HoracioDos wrote:
>
> 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!
>
> On Monday, July 15, 2019 at 11:27:04 AM UTC-3, Dave (G1OGY) wrote:
>>
>> 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
>>
>>
>> On Mon, 15 Jul 2019 at 14:08, HoracioDos <[email protected]> wrote:
>>
>>> 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, <
>>>> [email protected]> 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.
>>>>>>
>>>>>
I believe I have identifed 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 the log print 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 text is log-printed while the system is in a
benign status
and not being sufficiently clever to grep out either/or of the error 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 powercycle 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
YMMV!
[ RPi 2B + Raspian `buster,10.2`, Weewx 3.9.2 : http://g1ogy.com/wx ]
--
Dave, G1OGY
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/1ca3a279-6671-4200-a726-c72aa565dba8%40googlegroups.com.