Search serial device, if not provided
This commit is contained in:
@@ -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
|
||||||
|
try:
|
||||||
serial_device=os.environ['SERIAL_DEVICE']
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user