ccwienk / temper Goto Github PK
View Code? Open in Web Editor NEWThis project forked from urwen/temper
Simple python for accessing TEMPer USB thermometers
License: MIT License
This project forked from urwen/temper
Simple python for accessing TEMPer USB thermometers
License: MIT License
Hey,
i just received a TEMPer2 and a TEMPerGold device, and both are identified by the same USB ids: 1a86:e025
which means it's not really useful to select a device using its id. Maybe it'd make sense to select by name or something like that?
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
Hi everyone, thanks for the work for adding support for Linux for the PC sensors.
My PC sensor, I just bough, has a humidity and temperature sensor with a black serial cable that connects to the sticks. I also has a red button with TXT written on it as well temperature range.
Running ./temper.py -l I get
Bus 001 Dev 001 1d6b:0002 xHCI Host Controller ['hidraw1', 'hidraw2', 'hidraw3', 'hidraw4', 'hidraw5']
Bus 001 Dev 004 04ca:3016
Bus 001 Dev 005 1bcf:2ca0 HD WebCam
Bus 001 Dev 011 093a:2510 USB Optical Mouse ['hidraw1']
Bus 001 Dev 024 03f0:034a HP Elite USB Keyboard ['hidraw2', 'hidraw3']
Bus 001 Dev 027 3553:a001 TEMPer2 ['hidraw4', 'hidraw5']
Bus 002 Dev 001 1d6b:0003 xHCI Host Controller
But ./temper.py doesn give any ouput.
I tried sudo ./temper.py --force 3553:a001
and I got:
Bus 001 Dev 027 3553:a001 TEMPer2_V4.1 Error: Unknown firmware TEMPer2_V4.1: b'80800bf64e200000'
Can anyone give me a hint in how to add support to this new version. Then I will gladly make a PR for that.
Thanks a lot
Hi,
I'm getting this message:
Bus 001 Dev 006 1a86:e025 TEMPerHUM_V3.9 Error: Unknown firmware TEMPerHUM_V3.9: b'8020096d18d80000'
any idea?
EDIT: has nothing to do with a kernel update. It never worked
I have installed and used the Pypi package 'temper_py' in the Jetson J3010 device, to read the sensor (PCSensor: TEMPER1F V4.1) values.
This sensor is connected through USB HUB. When running the program, it raised a firmware compatibility issue, Please instruct us to avoid this.
Here I attached screenshots for your reference.
Recently purchased two new sensors. They now have a version identified as "TEMPerGold_V3.3". Was able to modify my local version of temper.py to get it to identify and read temperature data. Thanks.
Hello,
I am trying to use this script with new Temper2 usb key (https://thepihut.com/products/temper2-usb-dual-temperature-sensor)
After runing setup when I try to run
:/tmp/temper# python temper.py --verbose --json
[]
I am using raspberry pi and usb is detected as bellow.
:/tmp/temper# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 3553:a001 PCsensor TEMPer2
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
:/tmp/temper# python temper.py -l
Bus 001 Dev 001 1d6b:0002 xHCI Host Controller
Bus 001 Dev 002 2109:3431 USB2.0 Hub
Bus 001 Dev 003 3553:a001 TEMPer2
Bus 002 Dev 001 1d6b:0003 xHCI Host Controller
I also tried to add
if vendorid == 0x3553 and productid == 0xa001:
return True
to temper.py and then it returns
:/tmp/temper# python temper.py --verbose --json
[
{
"vendorid": 13651,
"productid": 40961,
"manufacturer": "PCsensor",
"product": "TEMPer2",
"busnum": 1,
"devnum": 3,
"devices": [],
"port": "1-1.1",
"error": "no hid/tty devices available"
}
]
what am I doing wrong?
Hi, I noticed I sometime get the same temperature reading for multiple hours using TEMPER2 external sensor:
I'm unsure if it's something in the firmware or in the way it's queried with Python. It looks a bit like that โoldโ issue in a different project: padelt/temper-python#61
Not sure there's anything which can be done at the software level but in case some other people experience that and/or have a workaround, I'd be interested.
Hi, it seems I have a slightly different model, mis-matched USB ID too?... I'm afraid I'm not too familiar with python, but I'm very happy to try to help... I see there was a guy with TEMPerGold_V3.3 who got it working, but no PR as yet... I guess they are probably related versions? Physically, it is the metal device with the thermometer printed on it.
root@trinity:/home/james# python3 temper.py --json
[
{
"vendorid": 6790,
"productid": 57381,
"manufacturer": "PCsensor",
"product": "TEMPerGold",
"busnum": 1,
"devnum": 12,
"devices": [
"hidraw6",
"hidraw7"
],
"port": "1-5.1",
"firmware": "TEMPerGold_V3.4",
"hex_firmware": "54454d506572476f6c645f56332e3420",
"hex_data": "80800c674e200000",
"error": "Unknown firmware TEMPerGold_V3.4: b'80800c674e200000'"
}
]
Bus 001 Dev 012 1a86:e025 * TEMPerGold ['hidraw6', 'hidraw7']
I bought two TEMPerX232 (V2.5) USB devices and they appear to work fine, but their temp difference is often off by 1.5 degrees between each other:
$ sudo ./temper.py
Bus 002 Dev 014 1a86:5523 TEMPerX232_V2.5 25.10C 77.18F 37% - - -
Bus 002 Dev 015 1a86:5523 TEMPerX232_V2.5 26.29C 79.32F 37% - - -
Is there a way to define an offset for one or both the cards so the readings are closer to reality?
Sorry for a total newbee question but why do I need SU rights to run this script? Without SUDO i get an permission denied error
I have been looking at the code and noticed that its was using select is an odd way.
The oddity is that the fd is not set O_NONBLOCK.
The end result of using O_NONBLOCK is that the code will report the temperatures as soon the sensor reports them.
Takes 0.386s vs the old code taking 0.558s. Tested with a TEMPer2.
If you are interest in my refactors let me know and I will raise a PR.
My refactor is in barry-scott@772d8c0.
Hello,
on raspberry PI, the response I have is:
sudo python ./temper.py
Traceback (most recent call last):
File "/home/admin/scripts/./temper.py", line 472, in
main()
File "/home/admin/scripts/./temper.py", line 469, in main
sys.exit(temper.main())
^^^^^^^^^^^^^
File "/home/admin/scripts/./temper.py", line 462, in main
results = self.read(args.verbose)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/scripts/./temper.py", line 379, in read
results.append({ **info, **usbread.read() })
^^^^^^^^^^^^^^
File "/home/admin/scripts/./temper.py", line 304, in read
return self._read_hidraw(self.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/scripts/./temper.py", line 181, in _read_hidraw
firmware = self._read_hidraw_firmware(fd, self.verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/admin/scripts/./temper.py", line 149, in _read_hidraw_firmware
os.write(fd, query)
BrokenPipeError: [Errno 32] Broken pipe
and the response if requesting a --list is
sudo python ./temper.py --list
Bus 001 Dev 001 1d6b:0002 xHCI Host Controller ['hidraw0']
Bus 001 Dev 002 2109:3431 USB2.0 Hub ['hidraw0']
Bus 001 Dev 003 1a86:e025 * TEMPerX232 ['hidraw0']
Bus 002 Dev 001 1d6b:0003 xHCI Host Controller
Bus 002 Dev 012 1058:107c Elements 107C
not sure why. Thanks for your kind support
Hi,
To make this device work, I modified:
if info['firmware'][:12] in [ 'TEMPerX_V3.1', 'TEMPerX_V3.3', 'TEMPer2_V3.9' ]:
to include the V3.9 version, and:
if vendorid == 0x1a86 and productid == 0xe025:
return True
to recognise the corresponding USB id (1a86:e025).
This trick works for temperature, but not for humidity:
Bus 001 Dev 031 1a86:e025 TEMPer2_V3.9 28.93C 84.07F - - - -
is it possible to add full compatibility for this device? can I help in any way?
Thanks in advance
Hello,
thanks for your Open Source software.
/temper.py -l
Bus 001 Dev 003 3553:a001 TEMPer2 ['hidraw1', 'hidraw2']
./temper.py --json
[]
/temper.py --force 3553:a001
Bus 001 Dev 003 3553:a001 TEMPer2_V4.1 Error: Unknown firmware TEMPer2_V4.1: b'808009e94e200000800109084e200000'
PS: WHY IS IT SO HARD TO GET GNU LINUX TALK TO A THERMOMETER?
(it would probably easier to build an https://duckduckgo.com/?t=ffab&q=arduino+weather+station)
1a86:e025 TEMPerGold_V3.3 appears to have been skipped :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.