From 05ec8c320abce30f4afe55bd6bc0381826c78137 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Tue, 17 Apr 2018 09:46:16 -0400 Subject: [PATCH 1/9] Add GitHub issue template --- .github/ISSUE_TEMPLATE.md | 78 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md 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 From b7b928b21871bd5fcf5b175865f11fb1d6d25b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 10 Apr 2019 01:07:39 +0200 Subject: [PATCH 2/9] Fix errors when heaters aren't reported by the firmware (#126) --- octoprint_psucontrol/__init__.py | 35 +++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index 19507dd..bd8ff77 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -418,15 +418,26 @@ def _wait_for_heaters(self): self._waitForHeaters = True heaters = self._printer.get_current_temperatures() - for heater in heaters.keys(): - if float(heaters.get(heater)["target"]) != 0: + for heater, entry in heaters.items(): + target = entry.get("target") + if target is None: + # heater doesn't exist in fw + continue + + try: + temp = float(target) + except ValueError: + # not a float for some reason, skip it + continue + + if temp != 0: self._logger.info("Turning off heater: %s" % heater) self._skipIdleTimer = True self._printer.set_temperature(heater, 0) self._skipIdleTimer = False else: self._logger.debug("Heater %s already off." % heater) - + while True: if not self._waitForHeaters: return False @@ -435,11 +446,21 @@ def _wait_for_heaters(self): highest_temp = 0 heaters_above_waittemp = [] - for heater in heaters.keys(): - if heater == 'bed': + for heater, entry in heaters.items(): + if not heater.startswith("tool"): continue - - temp = float(heaters.get(heater)["actual"]) + + actual = entry.get("actual") + if actual is None: + # heater doesn't exist in fw + continue + + try: + temp = float(actual) + except ValueError: + # not a float for some reason, skip it + continue + self._logger.debug("Heater %s = %sC" % (heater,temp)) if temp > self.idleTimeoutWaitTemp: heaters_above_waittemp.append(heater) From 6e036fd58b941cd9b7a2d76407510df09639f7ca Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Tue, 9 Apr 2019 19:15:19 -0400 Subject: [PATCH 3/9] Version 0.1.8 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index edadf96..e793fa7 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.7" +plugin_version = "0.1.8" plugin_description = "Control ATX/AUX power supply." plugin_author = "Shawn Bruce" plugin_author_email = "kantlivelong@gmail.com" From e474b45d7515be6caedae310bd25b46b2a7818b8 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Fri, 8 Nov 2019 18:33:39 -0500 Subject: [PATCH 4/9] Version 0.1.8 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index edadf96..e793fa7 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.7" +plugin_version = "0.1.8" plugin_description = "Control ATX/AUX power supply." plugin_author = "Shawn Bruce" plugin_author_email = "kantlivelong@gmail.com" From ae66df34e96daf67575d9e1f25f92650b2854802 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Fri, 8 Nov 2019 18:38:10 -0500 Subject: [PATCH 5/9] Add option to define polling interval for sensing. (#108) --- octoprint_psucontrol/__init__.py | 8 +++++++- .../templates/psucontrol_settings.jinja2 | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index bd8ff77..021fd8c 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -108,6 +108,7 @@ def __init__(self): self.idleTimeoutWaitTemp = 0 self.disconnectOnPowerOff = False self.sensingMethod = '' + self.sensePollingInterval = 0 self.senseGPIOPin = 0 self.invertsenseGPIOPin = False self.senseGPIOPinPUD = '' @@ -169,6 +170,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) @@ -373,7 +377,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): @@ -619,6 +623,7 @@ def get_settings_defaults(self): disconnectOnPowerOff = False, sensingMethod = 'INTERNAL', senseGPIOPin = 0, + sensePollingInterval = 5, invertsenseGPIOPin = False, senseGPIOPinPUD = '', senseSystemCommand = '', @@ -657,6 +662,7 @@ def on_settings_save(self, data): self.disconnectOnPowerOff = self._settings.get_boolean(["disconnectOnPowerOff"]) 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"]) diff --git a/octoprint_psucontrol/templates/psucontrol_settings.jinja2 b/octoprint_psucontrol/templates/psucontrol_settings.jinja2 index f691a66..cfcb06d 100644 --- a/octoprint_psucontrol/templates/psucontrol_settings.jinja2 +++ b/octoprint_psucontrol/templates/psucontrol_settings.jinja2 @@ -130,6 +130,15 @@ +
+ +
+
+ + sec +
+
+

Power On Options

From f5398219180eb06542c94d9b284747c503b21a55 Mon Sep 17 00:00:00 2001 From: Nick Singer Date: Tue, 17 Dec 2019 16:07:43 +0100 Subject: [PATCH 6/9] Support getting the PSU state with a GET request (#141) --- octoprint_psucontrol/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index 021fd8c..cd9319f 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -590,6 +590,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) From 8691ecfa7e1d62ba4238bc6688f36817bb0c14fd Mon Sep 17 00:00:00 2001 From: Psycho Date: Mon, 30 Dec 2019 10:42:03 +0100 Subject: [PATCH 7/9] Python 3 compatible --- octoprint_psucontrol/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index cd9319f..84c08da 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -766,6 +766,7 @@ def get_update_information(self): ) __plugin_name__ = "PSU Control" +__plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): global __plugin_implementation__ From 2a9e75567c8978797061119819237ec7f14edef6 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Mon, 30 Dec 2019 18:48:38 -0500 Subject: [PATCH 8/9] on_settings_migrate: Set current = 0 when None --- octoprint_psucontrol/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/octoprint_psucontrol/__init__.py b/octoprint_psucontrol/__init__.py index 84c08da..b01f4ea 100644 --- a/octoprint_psucontrol/__init__.py +++ b/octoprint_psucontrol/__init__.py @@ -702,7 +702,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": From 169d35e802a81049cf9fb1be54e530754f2726b3 Mon Sep 17 00:00:00 2001 From: Shawn Bruce Date: Sat, 4 Jan 2020 12:49:10 -0500 Subject: [PATCH 9/9] Version 0.1.9 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e793fa7..7b93887 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"