Open mtoner23 opened 11 months ago
@mtoner23 so are you saying that even with this code you are unable to send prints to the printer from Prusa when having ankerctl
configured as an Octoprint provider?
Sorry bad phrasing. With this code I can send prints via prusaslicer to the webserver. I was trying to send manual gcode for something else which exposed this issue in the constructor.
Here is an example traceback without this change:
user@system$ ./ankerctl.py mqtt send ZZ_MQTT_CMD_FIRMWARE_VERSION
[*] Connecting printer AnkerMake M5 (XXXXXXX-000000-XXXXX) through make-mqtt.ankermake.com
[*] Connected to mqtt
Traceback (most recent call last):
File "/Users/user/Projects/ankermake-m5-protocol/./ankerctl.py", line 494, in <module>
main()
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Projects/ankermake-m5-protocol/./ankerctl.py", line 160, in mqtt_send
cli.mqtt.mqtt_command(client, cmd)
File "/Users/user/Projects/ankermake-m5-protocol/cli/mqtt.py", line 37, in mqtt_command
client.command(msg)
File "/Users/user/Projects/ankermake-m5-protocol/libflagship/mqttapi.py", line 131, in command
return self.send(f"/device/maker/{self.sn}/command", msg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Projects/ankermake-m5-protocol/libflagship/mqttapi.py", line 123, in send
payload = self.make_mqtt_pkt(self._guid, json.dumps(msg).encode())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Projects/ankermake-m5-protocol/libflagship/mqttapi.py", line 107, in make_mqtt_pkt
return MqttMsg(
^^^^^^^^
TypeError: _MqttMsg.__init__() missing 1 required positional argument: 'padding'
This is an example result with the change in place:
user@system$ ./ankerctl.py mqtt send ZZ_MQTT_CMD_FIRMWARE_VERSION
[*] Connecting printer AnkerMake M5 (XXXXXXX-000000-XXXXX) through make-mqtt.ankermake.com
[*] Connected to mqtt
{
"currVer": "Vx.y.z_a.b.c",
"commandType": 1002,
"reply": 0
}
This is also fixed in PR #145 in a way which supports both Ankermake M5 and M5C printers, see https://github.com/Ankermgmt/ankermake-m5-protocol/pull/145/commits/d9af57732b163ed81115dab0dea6386c3e564530 . You can try the fork at https://github.com/anselor/ankermake-m5-protocol/tree/exiles which integrates this PR and a number of other pending ones.
I tried sending gcode over mqtt and this errored out. even with this fix the printer doesnt respond to the gcode but maybe thats my user error. since we have no clue what this field does i think its fine to do what we were doing before the previous fix; send all zeros.