Migrate monitoring scripts from Python 2 to Python 3.

Replace the dhtreader.so extension with adafruit-circuitpython-dht and run the daemon with python3.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-14 19:53:00 +08:00
co-authored by Cursor
parent 6f12d2c459
commit adb8573833
12 changed files with 113 additions and 28 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
#!/usr/bin/python
#!/usr/bin/env python3
##
## Script to read the last temperature and humidity readings from a MySQL database
##
import time
import MySQLdb
NO_PREVIOUS = ('NULL', 'NULL')
@@ -37,7 +38,7 @@ def main(host, db, user, passwd, logging, sql_retries, sql_timeout):
)
return oldtemp, oldhumid
except MySQLdb.Error as e:
logging.warn(
logging.warning(
'MySQL read failed (attempt %d/%d): %d: %s',
attempt + 1, sql_retries, e.args[0], e.args[1],
)