bkbilly / mqtt_fingerprint_pi

☝️ Read and write fingerprints through R503 sensor and send the result as MQTT messages.
3 stars 2 forks source link

RuntimeError: Failed to read data from sensor #4

Open AxelHoss opened 2 months ago

AxelHoss commented 2 months ago

Hey, sometimes i get the following error. It happens maybe 2 times per week. Is there a solution to restart the usb device if it isnt reachable?

Jun 15 06:41:00 rpiGarageGarten python3[661]: Exception in thread Thread-1: Jun 15 06:41:00 rpiGarageGarten python3[661]: Traceback (most recent call last): Jun 15 06:41:00 rpiGarageGarten python3[661]: File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner Jun 15 06:41:00 rpiGarageGarten python3[661]: self.run() Jun 15 06:41:00 rpiGarageGarten python3[661]: File "/usr/lib/python3.9/threading.py", line 892, in run Jun 15 06:41:00 rpiGarageGarten python3[661]: self._target(*self._args, **self._kwargs) Jun 15 06:41:00 rpiGarageGarten python3[661]: File "/opt/mqtt_fingerprint_pi/run.py", line 113, in get_fingerprint Jun 15 06:41:00 rpiGarageGarten python3[661]: if self.finger.get_image() == adafruit_fingerprint.OK: Jun 15 06:41:00 rpiGarageGarten python3[661]: File "/usr/local/lib/python3.9/dist-packages/adafruit_fingerprint.py", line 177, in get_image Jun 15 06:41:00 rpiGarageGarten python3[661]: return self._get_packet(12)[0] Jun 15 06:41:00 rpiGarageGarten python3[661]: File "/usr/local/lib/python3.9/dist-packages/adafruit_fingerprint.py", line ``342, in _get_packet Jun 15 06:41:00 rpiGarageGarten python3[661]: raise RuntimeError("Failed to read data from sensor") Jun 15 06:41:00 rpiGarageGarten python3[661]: RuntimeError: Failed to read data from sensor

bkbilly commented 2 months ago

I think you have an older version of my app. On the newer version I am catching these errors, so it runs without issues. You can check it by comparing the file run.py on line 113.

AxelHoss commented 2 months ago

is there an easy way to update?

bkbilly commented 2 months ago

Yeah, you can just go to the installation directory, download the new code and restart:

cd /opt/mqtt_fingerprint_pi
git pull
sudo systemctl restart mqtt_fingerprint_pi.service
AxelHoss commented 2 months ago

will try it thank you