ccwienk / temper

Simple python for accessing TEMPer USB thermometers
MIT License
35 stars 27 forks source link

unidentifiable version of TEMPer #4

Open charterhouse-services opened 3 years ago

charterhouse-services commented 3 years ago
temper.py -l
Bus 001 Dev 009 1130:660c   PCsensor Temper ['hidraw1', 'hidraw2']

When running ./temper.py receive the following traceback:

root@john-desktop:/home/john/temper/pcsensor-temper# python3 /usr/local/lib/python3.9/dist-packages/temper.py --force 1130:660c --verbose
Firmware query: b'0186ff0100000000'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 436, in <module>
    main()
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 433, in main
    sys.exit(temper.main())
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 426, in main
    results = self.read(args.verbose)
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 343, in read
    results.append({ **info, **usbread.read() })
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 270, in read
    return self._read_hidraw(self.device)
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 178, in _read_hidraw
    firmware = self._read_hidraw_firmware(fd, self.verbose)
  File "/usr/local/lib/python3.9/dist-packages/temper.py", line 158, in _read_hidraw_firmware
    raise RuntimeError('Cannot read device firmware identifier')
RuntimeError: Cannot read device firmware identifier
charterhouse-services commented 3 years ago

Its a pretty old model - I had a look at the PCSensor site and couldnt find it on there :-D If you're up for a challenge Ill gladly help out with testing ;-)

image

eode commented 2 years ago

Currently, that function has a select() timeout of 0.2. That might be too fast for that older hardware version.

Try changing:

# in _read_hidraw_firmware
select.select([fd], [], [], 0.2
                            ^^^

..to something longer than 0.2, like 0.4, 0.6, or 1.

eode commented 1 year ago

@charterhouse-services Did this work for you?

eode commented 1 year ago

I'll be closing this as inactive soon.

spv-1 commented 1 year ago

I'm not the original submitter, but I was trying to get this working with the same device and came across this bug report.

I tried several different timeouts on that line, going all the way up to 5, without any effect.

spv-1 commented 1 year ago

If it helps, I found this old Python 2 script that works with this device: https://github.com/kiloforce/PyTEMPer

OTOH, these might be old enough that it's not worth your time adding in support for them, since there don't seem to be that many of us trying to get them working.