Search serial device, if not provided

This commit is contained in:
Ollo
2026-04-19 14:02:13 +02:00
parent 23507ac147
commit 3b3d194916

View File

@@ -18,7 +18,15 @@ COMMAND_PREFIX = "ollpe"
mqtt_server=os.environ['MQTT_SERVER'] mqtt_server=os.environ['MQTT_SERVER']
mqtt_topic=os.environ['MQTT_TOPIC'] mqtt_topic=os.environ['MQTT_TOPIC']
# SERIAL Port # SERIAL Port
serial_device=os.environ['SERIAL_DEVICE'] try:
serial_device=os.environ['SERIAL_DEVICE']
except (KeyError):
# search serial device
for root, dirs, files in os.walk("/dev/serial/by-id/"):
for name in files:
abspath=os.path.join(root, name)
serial_device=abspath
# Logging # Logging
try: try: