diff --git a/octoprint_realemergencystop/__init__.py b/octoprint_realemergencystop/__init__.py index 7bd8ba4..c3eb72b 100644 --- a/octoprint_realemergencystop/__init__.py +++ b/octoprint_realemergencystop/__init__.py @@ -7,6 +7,7 @@ from octoprint.events import Events from time import sleep from gpiozero import LED, Button +import click class realemergencystopPlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.EventHandlerPlugin, @@ -87,10 +88,12 @@ def on_api_command(self, command, data): elif command == "emergencyStopReset": self.estop_reset() - def custom_stop_command(self, comm, phase, command, parameters, tags=None, *args, **kwargs): - if command == "estop": + def custom_stop_command(cli_group, self, pass_octoprint_ctx, *args, **kwargs): + @click.command("estop") + def estop_command(): self.send_emergency_stop() - elif command == "estopreset": + @click.command("estopreset") + def estopreset_command(): self.estop_reset() #Button Setup Function @@ -188,7 +191,7 @@ def get_update_information(self): __plugin_pythoncompat__ = ">=2.7,<4" # python 2 and 3 __plugin_name__ = "Real Emergency Stop" -__plugin_version__ = "0.1.1" +__plugin_version__ = "0.1.2" def __plugin_check__(): try: @@ -204,5 +207,5 @@ def __plugin_load__(): global __plugin_hooks__ __plugin_hooks__ = { "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information, - "octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.custom_stop_command, + "octoprint.cli.commands": __plugin_implementation__.custom_stop_command } diff --git a/setup.py b/setup.py index 511e440..b28347e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "Real Emergency stop" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.1.1" +plugin_version = "0.1.2" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module