Skip to content

Commit

Permalink
cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanrobichaud4 committed Apr 12, 2022
1 parent 5190776 commit 077f303
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions octoprint_realemergencystop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 077f303

Please sign in to comment.