Hi guys!
I've been working on a very specific plugin for a printer, which requires me to process GCODE on the fly before it is sent to the printer. The plugin also must connect to a websocket server implemented in another program which is preforming the processing and spitting out the several replacement commands to be queued.
This is the stack trace from octoprint.log from the plugin:
2018-12-30 06:37:19,370 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Printing"
2018-12-30 06:37:19,391 - octoprint.plugin - ERROR - Error while calling plugin tracking
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/plugin/init.py", line 230, in call_plugin
result = getattr(plugin, method)(*args, **kwargs)
File "/home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/tracking/init.py", line 119, in on_event
self._track_printjob_event(event, payload)
File "/home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/tracking/init.py", line 237, in _track_printjob_event
sha.update(self._settings.get([b"unique_id"]))
TypeError: update() argument 1 must be string or buffer, not None
This is the plugin code here [ Please excuse any obvious glaring issues here, Python isn't my language of choice ]
ws = None
_logger = None
def convert2(self, comm_instance, phase, cmd, cmd_type, gcode, subcode=None, tags=None, *args, **kwargs):
ws.send("gcode cmd here")
#self._logger.info("gcode was sent!");
#return [data.splitlines()] # will take the (likely) several generated commands and put it enqueue
return[cmd]
def on_open(ws):
ws.send("Plugin Loaded!!!")
def __plugin_load__():
_logger = logging.getLogger("octoprint.plugins.gcode_converter")
_logger.info("Conversion Processor Init!");
ws = websocket.WebSocketApp("ws://127.0.0.1:9000/gcodestream")
ws.on_open = on_open
wst = threading.Thread(target=ws.run_forever)
wst.daemon = True
wst.start()
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.queuing": convert2
}
The websocket appears to connect perfectly fine, and the server receives the "Plugin Loaded!!!" string perfectly fine. The problem arises when GCODE is being sent however, and that error is sent on each line in the log file. I've been troubleshooting this for the past few hours and I've hit a brick wall.
Any ideas as to what's causing this issue??
Thanks,
Nick