No data being received

394 views
Skip to first unread message

David Slater

unread,
Mar 25, 2014, 5:56:21 PM3/25/14
to py...@googlegroups.com
My Raspberry PI has stopped downloading information from my Maplin weather station. It's not been logging for a few days and ideally I don't want to reset the Weather Station as I lose the data. I have tried unplugging the usb cable and restarting the RPi to no avail.  There are no raw data files for the missing days.
I've done some tests to see if it can still see the station, and running python -m pywws.TestWeatherStation produces a reasonable looking set of numbers.
If I run python -m pywws.LogData -vvv ~/weather/data I get the following:

21:37:40:pywws.WeatherStation.CUSBDrive:using pywws.device_pyusb

Traceback (most recent call last):

  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main

    "__main__", fname, loader, pkg_name)

  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code

    exec code in run_globals

  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 315, in <module>

    sys.exit(main())

  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 312, in main

    DataStore.data_store(root_dir)).log_data(sync=sync, clear=clear)

  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 96, in __init__

    fixed_block = self.check_fixed_block()

  File "/usr/local/lib/python2.7/dist-pack(unbuffered=True)

  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 582, in get_fixed_block

    self._fixed_block = self._read_fixed_block()

  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 630, in _read_fixed_block

    result += self._read_block(mempos)

  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 618, in _read_block

    new_block = self.cusb.read_block(ptr)

  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 274, in read_block

    return self.dev.read_data(32)

  File "/usr/local/lib/python2.7/dist-packages/pywws/device_pyusb.py", line 157, in read_data

    result = self.devh.interruptRead(0x81, size, 1200)

usb.USBError: could not claim interface 0: Device or resource busy


The log files show:
2014-03-22 06:30:13:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-24 22:00:11:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-24 22:00:16:pywws.weather_station:setting station clock 16.5845
2014-03-24 22:00:16:pywws.weather_station:live_data log synchronised
2014-03-25 07:00:13:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-25 07:00:16:pywws.weather_station:setting station clock 16.5421
2014-03-25 07:00:16:pywws.weather_station:live_data log synchronised
2014-03-25 19:30:56:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-25 19:42:56:pywws.LiveLog:error sending control message: Device or resource busy
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LiveLog.py", line 80, in LiveLog
    logged_only=(not tasks.has_live_tasks())):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 262, in live_data
    for data, ptr, logged in self.ws.live_data(logged_only=logged_only):
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 397, in live_data
    new_ptr = self.current_pos()
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 557, in current_pos
    self._read_fixed_block(0x0020), self.lo_fix_format['current_pos'])
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 630, in _read_fixed_block
    result += self._read_block(mempos)
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 618, in _read_block
    new_block = self.cusb.read_block(ptr)
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 272, in read_block
    if not self.dev.write_data(buf):
  File "/usr/local/lib/python2.7/dist-packages/pywws/device_pyusb.py", line 179, in write_data
    usb.REQ_SET_CONFIGURATION, buf, value=0x200, timeout=50)
USBError: error sending control message: Device or resource busy
2014-03-25 20:00:10:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-25 20:00:10:pywws.LiveLog:station is not logging data
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LiveLog.py", line 80, in LiveLog
    logged_only=(not tasks.has_live_tasks())):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 262, in live_data
    for data, ptr, logged in self.ws.live_data(logged_only=logged_only):
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 495, in live_data
    raise IOError('station is not logging data')
IOError: station is not logging data
2014-03-25 20:31:03:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}
2014-03-25 20:35:17:pywws.LiveLog:could not claim interface 0: Device or resource busy
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LiveLog.py", line 80, in LiveLog
    logged_only=(not tasks.has_live_tasks())):
  File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line 262, in live_data
    for data, ptr, logged in self.ws.live_data(logged_only=logged_only):
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 397, in live_data
    new_ptr = self.current_pos()
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 557, in current_pos
    self._read_fixed_block(0x0020), self.lo_fix_format['current_pos'])
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 630, in _read_fixed_block
    result += self._read_block(mempos)
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 618, in _read_block
    new_block = self.cusb.read_block(ptr)
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 274, in read_block
    return self.dev.read_data(32)
  File "/usr/local/lib/python2.7/dist-packages/pywws/device_pyusb.py", line 157, in read_data
    result = self.devh.interruptRead(0x81, size, 1200)
USBError: could not claim interface 0: Device or resource busy

Any help appreciated.
Dave

Jim Easterbrook

unread,
Mar 25, 2014, 6:17:41 PM3/25/14
to py...@googlegroups.com
On 25/03/14 21:56, David Slater wrote:
> My Raspberry PI has stopped downloading information from my Maplin
> weather station. It's not been logging for a few days and ideally I
> don't want to reset the Weather Station as I lose the data. I have tried
> unplugging the usb cable and restarting the RPi to no avail. There are
> no raw data files for the missing days.
> I've done some tests to see if it can still see the station, and running
> python -m pywws.TestWeatherStation produces a reasonable looking set of
> numbers.
> If I run python -m pywws.LogData -vvv ~/weather/data I get the following:
>
[snip]
> 2014-03-25 20:00:10:pywws.weather_station:status {'unknown': 0,
> 'lost_connection': 0, 'rain_overflow': 0}
> 2014-03-25 20:00:10:pywws.LiveLog:station is not logging data
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/pywws/LiveLog.py", line
> 80, in LiveLog
> logged_only=(not tasks.has_live_tasks())):
> File "/usr/local/lib/python2.7/dist-packages/pywws/LogData.py", line
> 262, in live_data
> for data, ptr, logged in self.ws.live_data(logged_only=logged_only):
> File
> "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line
> 495, in live_data
> raise IOError('station is not logging data')
> IOError: station is not logging data

This is significant - your station appears to have gone wrong and is not
logging data, i.e. the address that data is written to is not
incrementing. This means that you almost certainly won't have any stored
data since the fault developed anyway.

As for all the 'USBError: could not claim interface 0: Device or
resource busy' errors - are you sure you're not trying to run two (or
more) pywws processes simultaneously? E.g. one cron job starting before
the previous one has finished (because it takes time to be sure that the
station is not actively logging data).
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

David Slater

unread,
Mar 25, 2014, 6:21:58 PM3/25/14
to py...@googlegroups.com
Thanks Jim.
Yes I can confirm no other pywws process is running. I've checked with ps and pidof.
I'll take the batteries out. I have say I've been having quite a few problems with the station not responding. This is the 2nd time in a couple of months this has happened. 
Dave

David Slater

unread,
Mar 27, 2014, 4:57:39 PM3/27/14
to py...@googlegroups.com
Well I'm not having much luck.
Ive reset the weather station twice, turned off and rebooted the RPi many times all to no avail.
The data collection seems to be the bits its sticking on.

If I've run it manually and the last line is where it sticks:

20:48:58:pywws.WeatherStation.CUSBDrive:using pywws.device_pyusb

20:49:01:pywws.DataLogger:Synchronising to weather station

20:49:02:pywws.weather_station:delay 1, pause 22.0119

20:49:24:pywws.weather_station:avoid 5.94240903854

20:49:30:pywws.weather_station:status {'unknown': 0, 'lost_connection': 0, 'rain_overflow': 0}

20:49:30:pywws.weather_station:live_data new data

20:49:30:pywws.DataLogger:Reading time 20:49:27

20:49:30:pywws.DataLogger:log time 20:47:19

20:49:31:pywws.DataLogger:Fetching data


Any ideas?
I guess the SD card is the next candidate or some faulty hardware somewhere?

Jim Easterbrook

unread,
Mar 27, 2014, 6:01:27 PM3/27/14
to py...@googlegroups.com
On 27/03/14 20:57, David Slater wrote:
> Well I'm not having much luck.
> Ive reset the weather station twice, turned off and rebooted the RPi
> many times all to no avail.
> The data collection seems to be the bits its sticking on.
>
> If I've run it manually and the last line is where it sticks:
>
> 20:48:58:pywws.WeatherStation.CUSBDrive:using pywws.device_pyusb
>
> 20:49:01:pywws.DataLogger:Synchronising to weather station
>
> 20:49:02:pywws.weather_station:delay 1, pause 22.0119
>
> 20:49:24:pywws.weather_station:avoid 5.94240903854
>
> 20:49:30:pywws.weather_station:status {'unknown': 0, 'lost_connection':
> 0, 'rain_overflow': 0}
>
> 20:49:30:pywws.weather_station:live_data new data
>
> 20:49:30:pywws.DataLogger:Reading time 20:49:27
>
> 20:49:30:pywws.DataLogger:log time 20:47:19
>
> 20:49:31:pywws.DataLogger:Fetching data
>
>
> Any ideas?
> I guess the SD card is the next candidate or some faulty hardware somewhere?

I don't think the SD card is the problem. I'd try adding some 'print'
statements at various points after the 'Fetching data' log message is
generated to try and track down where it's getting stuck. I assume
you've already tried deleting status.ini to eliminate one known problem.

David Slater

unread,
Mar 28, 2014, 2:12:38 AM3/28/14
to py...@googlegroups.com
Thank you Jim as ever.
I wasn't aware that I could delete status.ini . I renamed that and its started to work immediately.
Will remember to try that next time.
Thanks
Dave

Jim Easterbrook

unread,
Mar 28, 2014, 2:21:10 AM3/28/14
to py...@googlegroups.com
On 28/03/14 06:12, David Slater wrote:
> I wasn't aware that I could delete status.ini . I renamed that and its
> started to work immediately.

Ah, I'm losing track of who I've told what in recent weeks.

> Will remember to try that next time.

If you upgrade pywws to the most recent release there shouldn't be a
next time. I believe I've cured this particular bug.

David Slater

unread,
Mar 28, 2014, 4:45:46 PM3/28/14
to py...@googlegroups.com
Thanks once again. Have upgraded to the latest version.
Reply all
Reply to author
Forward
0 new messages