From 9a8bb382f0f8ab8665ad7d6c107141984036c077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Nardi?= Date: Wed, 1 May 2024 14:20:07 +0200 Subject: [PATCH] Fix DHT11/DHT22/AM2302 temperature retrieval with recent versions of adafruit_dht library --- octoprint_enclosure/getDHTTemp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint_enclosure/getDHTTemp.py b/octoprint_enclosure/getDHTTemp.py index e898977..92960e5 100644 --- a/octoprint_enclosure/getDHTTemp.py +++ b/octoprint_enclosure/getDHTTemp.py @@ -1,7 +1,7 @@ import sys import time import adafruit_dht - +from microcontroller import Pin # Parse command line parameters. sensor_args = { @@ -16,7 +16,7 @@ else: sys.exit(1) -dht_dev = sensor(pin) +dht_dev = sensor(Pin(pin)) # DHT sensor read fails quite often, causing enclosure plugin to report value of 0. # If this happens, retry as suggested in the adafruit_dht docs. @@ -42,4 +42,4 @@ retry_count += 1 print('-1 | -1') -sys.exit(1) \ No newline at end of file +sys.exit(1)