markwal / OctoPrint-PortLister

An OctoPrint plugin that notices when a new serial port appears and refreshes the port list without a page refresh
GNU Affero General Public License v3.0
26 stars 10 forks source link

Exception in do_auto_connect #11

Open davidsielert opened 5 years ago

davidsielert commented 5 years ago
2018-12-29 00:38:31,198 - octoprint.plugins.portlister - INFO - on_port_created connection_options {'portPreference': '/dev/ttyUSB0', 'autoconnect': True, 'baudrates': [250000, 230400, 115200, 57600, 38400, 19200, 9600], 'ports': ['/dev/ttyUSB0'], 'baudratePreference': None}
2018-12-29 00:38:31,200 - octoprint.plugins.portlister - INFO - Checking if /dev/ttyUSB0 is in ['/dev/ttyUSB0']
2018-12-29 00:38:31,208 - octoprint.plugins.portlister - INFO - autoconnect_delay 20
2018-12-29 00:38:51,215 - octoprint.plugins.portlister - INFO - do_auto_connect
2018-12-29 00:38:51,217 - octoprint.plugins.portlister - INFO - realpath match
2018-12-29 00:38:51,300 - octoprint.plugins.portlister - ERROR - Exception in do_auto_connect TypeError: '%d format: a number is required, not NoneType' @ __init__.py:do_auto_connect:71
FisheyLP commented 5 years ago

I'm also getting this error in the version 0.1.8 According to the OctoPrint documentation, the baudrate value isn't saved in the config.yaml by default, if set to AUTO:

# Use the following option to define the default baudrate, defaults to unset (= AUTO) baudrate: 115200

So the plugin will try to get that setting, but actually receives a None, which can't be formatted as a number, nor be connected to.

A possible "fix" is to select the proper baudrate from the connection panel and saving that (tick the checkbox) or setting the baudrate value to 0 in the config manually.