From eb9a002c8be2859ba17ad7f23fadcde465273db5 Mon Sep 17 00:00:00 2001 From: "Andreas L." Date: Tue, 29 Oct 2024 14:53:57 +0100 Subject: [PATCH] One likely fix, 2 cosmetic fixes, udev-rules-file --- etc--udev--rules.d--24-TEMPer.rules | 6 ++++++ temper.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 etc--udev--rules.d--24-TEMPer.rules diff --git a/etc--udev--rules.d--24-TEMPer.rules b/etc--udev--rules.d--24-TEMPer.rules new file mode 100644 index 0000000..167c57c --- /dev/null +++ b/etc--udev--rules.d--24-TEMPer.rules @@ -0,0 +1,6 @@ +ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", GROUP="plugdev", MODE="660" +ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7402", GROUP="plugdev", MODE="660" +ATTRS{idVendor}=="413d", ATTRS{idProduct}=="2107", GROUP="plugdev", MODE="660" +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5523", GROUP="plugdev", MODE="660" +ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e025", GROUP="plugdev", MODE="660" +ATTRS{idVendor}=="3553", ATTRS{idProduct}=="a001", GROUP="plugdev", MODE="660" diff --git a/temper.py b/temper.py index 6a2adef..a283f09 100755 --- a/temper.py +++ b/temper.py @@ -303,7 +303,7 @@ def _read_serial(self, device): info = dict() info['firmware'] = firmware - m = re.search(r'Temp-Inner:([0-9.]*).*, ?([0-9.]*)', reply) + m = re.search(r'Temp-Inner:([0-9.]*).*?, ?([0-9.]*)', reply) if m is not None: info['internal temperature'] = float(m.group(1)) info['internal humidity'] = float(m.group(2)) @@ -338,7 +338,7 @@ def __init__(self, verbose=False): self.verbose = verbose def _is_known_id(self, vendorid, productid): - '''Returns True if the vendorid and product id are valid. + '''Returns True if the vendorid and productid are valid. ''' if self.forced_vendor_id is not None and \ @@ -479,8 +479,8 @@ def main(self): except: print('Cannot parse hexadecimal id: %s' % args.force) return 1 - self.forced_vendor_id = vendor_id; - self.forced_product_id = product_id; + self.forced_vendor_id = vendor_id + self.forced_product_id = product_id # By default, output the temperature and humidity for all known sensors. results = self.read(args.verbose)