diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..5c8e3ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,78 @@ + + +#### What were you doing? + + + +1. ... +2. ... +3. ... + + + +#### What did you expect to happen? + +#### What happened instead? + +#### Version of OctoPrint-PSUControl + + + +#### Operating System running OctoPrint + + + +#### Printer model & used firmware incl. version + + + + +#### Link to octoprint.log with octoprnt.plugins.psucontrol set to DEBUG + + + +#### Wiring diagram + + \ No newline at end of file diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index ed51910..74ca90d 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -113,6 +113,7 @@ def __init__(self): self.autoConnectBaudrate = '' self.autoConnectPrinterProfile = '' self.sensingMethod = '' + self.sensePollingInterval = 0 self.senseGPIOPin = 0 self.invertsenseGPIOPin = False self.senseGPIOPinPUD = '' @@ -189,6 +190,9 @@ def on_settings_initialized(self): self.sensingMethod = self._settings.get(["sensingMethod"]) self._logger.debug("sensingMethod: %s" % self.sensingMethod) + self.sensePollingInterval = self._settings.get_int(["sensePollingInterval"]) + self._logger.debug("sensePollingInterval: %s" % self.sensePollingInterval) + self.senseGPIOPin = self._settings.get_int(["senseGPIOPin"]) self._logger.debug("senseGPIOPin: %s" % self.senseGPIOPin) @@ -393,7 +397,7 @@ def _check_psu_state(self): self._plugin_manager.send_plugin_message(self._identifier, dict(hasGPIO=self._hasGPIO, isPSUOn=self.isPSUOn)) - self._check_psu_state_event.wait(5) + self._check_psu_state_event.wait(self.sensePollingInterval) self._check_psu_state_event.clear() def _start_idle_timer(self): @@ -617,6 +621,9 @@ def get_api_commands(self): getPSUState=[] ) + def on_api_get(self, request): + return self.on_api_command("getPSUState", []) + def on_api_command(self, command, data): if not user_permission.can(): return make_response("Insufficient rights", 403) @@ -655,6 +662,7 @@ def get_settings_defaults(self): autoConnectPrinterProfile = '', sensingMethod = 'INTERNAL', senseGPIOPin = 0, + sensePollingInterval = 5, invertsenseGPIOPin = False, senseGPIOPinPUD = '', senseSystemCommand = '', @@ -698,6 +706,7 @@ def on_settings_save(self, data): self.autoConnectPrinterProfile = self._settings.get(["autoConnectPrinterProfile"]) self.sensingMethod = self._settings.get(["sensingMethod"]) self.senseGPIOPin = self._settings.get_int(["senseGPIOPin"]) + self.sensePollingInterval = self._settings.get_int(["sensePollingInterval"]) self.invertsenseGPIOPin = self._settings.get_boolean(["invertsenseGPIOPin"]) self.senseGPIOPinPUD = self._settings.get(["senseGPIOPinPUD"]) self.senseSystemCommand = self._settings.get(["senseSystemCommand"]) @@ -734,7 +743,10 @@ def get_settings_version(self): return 3 def on_settings_migrate(self, target, current=None): - if current is None or current < 2: + if current is None: + current = 0 + + if current < 2: # v2 changes names of settings variables to accomidate system commands. cur_switchingMethod = self._settings.get(["switchingMethod"]) if cur_switchingMethod is not None and cur_switchingMethod == "COMMAND": @@ -798,6 +810,7 @@ def get_update_information(self): ) __plugin_name__ = "PSU Control" +__plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): global __plugin_implementation__ diff --git a/octoprint_psucontrol/templates/psucontrol_settings.jinja2 b/octoprint_psucontrol/templates/psucontrol_settings.jinja2 index 35d146b..2bcb0df 100644 --- a/octoprint_psucontrol/templates/psucontrol_settings.jinja2 +++ b/octoprint_psucontrol/templates/psucontrol_settings.jinja2 @@ -130,6 +130,15 @@ +
+ +
+
+ + sec +
+
+

Power On Options

diff --git a/setup.py b/setup.py index 0f3f23c..92d9b55 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ plugin_identifier = "psucontrol" plugin_package = "octoprint_%s" % plugin_identifier plugin_name = "OctoPrint-PSUControl" -plugin_version = "0.1.8" +plugin_version = "0.1.9" plugin_description = "Control ATX/AUX power supply." plugin_author = "Shawn Bruce" plugin_author_email = "kantlivelong@gmail.com"