pywws.device_pyusb

Low level USB interface to weather station, using PyUSB v0.4.

Introduction

This module handles low level communication with the weather station via the PyUSB library. It is one of several USB device modules, each of which uses a different USB library interface. See Installation - USB library for details.

Testing

Run pywws.TestWeatherStation with increased verbosity so it reports which USB device access module is being used:

python -m pywws.TestWeatherStation -vv
18:28:09:pywws.WeatherStation.CUSBDrive:using pywws.device_pyusb
0000 55 aa ff ff ff ff ff ff ff ff ff ff ff ff ff ff 05 20 01 41 11 00 00 00 81 00 00 0f 05 00 e0 51
0020 03 27 ce 27 00 00 00 00 00 00 00 12 02 14 18 27 41 23 c8 00 00 00 46 2d 2c 01 64 80 c8 00 00 00
0040 64 00 64 80 a0 28 80 25 a0 28 80 25 03 36 00 05 6b 00 00 0a 00 f4 01 12 00 00 00 00 00 00 00 00
0060 00 00 49 0a 63 12 05 01 7f 00 36 01 60 80 36 01 60 80 bc 00 7b 80 95 28 12 26 6c 28 25 26 c8 01
0080 1d 02 d8 00 de 00 ff 00 ff 00 ff 00 00 11 10 06 01 29 12 02 01 19 32 11 09 09 05 18 12 01 22 13
00a0 14 11 11 04 15 04 11 12 17 05 12 11 09 02 15 26 12 02 11 07 05 11 09 02 15 26 12 02 11 07 05 11
00c0 09 10 09 12 12 02 02 12 38 12 02 07 19 00 11 12 16 03 27 12 02 03 11 00 11 12 16 03 27 11 12 26
00e0 21 32 11 12 26 21 32 12 02 06 19 57 12 02 06 19 57 12 02 06 19 57 12 02 06 19 57 12 02 06 19 57

API

Classes

USBDevice(idVendor, idProduct) Low level USB device access via PyUSB library.
class pywws.device_pyusb.USBDevice(idVendor, idProduct)[source]

Low level USB device access via PyUSB library.

Parameters:
  • idVendor (int) – the USB “vendor ID” number, for example 0x1941.
  • idProduct (int) – the USB “product ID” number, for example 0x8021.
read_data(size)[source]

Receive data from the device.

If the read fails for any reason, an IOError exception is raised.

Parameters:size (int) – the number of bytes to read.
Returns:the data received.
Return type:list(int)
write_data(buf)[source]

Send data to the device.

If the write fails for any reason, an IOError exception is raised.

Parameters:buf (list(int)) – the data to send.
Returns:success status.
Return type:bool

Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.