From c14238f54db369dff6975afb8bf38b2e0d1d2f88 Mon Sep 17 00:00:00 2001 From: jneilliii Date: Fri, 19 Nov 2021 08:25:16 -0500 Subject: [PATCH] fix issues with key errors with recent psu control changes --- octoprint_simplyprint/comm/simplyprint.py | 12 ++++++------ setup.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/octoprint_simplyprint/comm/simplyprint.py b/octoprint_simplyprint/comm/simplyprint.py index 709c1ca..dcb0499 100644 --- a/octoprint_simplyprint/comm/simplyprint.py +++ b/octoprint_simplyprint/comm/simplyprint.py @@ -383,13 +383,13 @@ def request(self): if self._settings.get_boolean(["has_power_controller"]) and not self.has_checked_power_controller: helpers = self.plugin._plugin_manager.get_helpers("psucontrol") or self.plugin._plugin_manager.get_helpers("simplypowercontroller") if helpers: - if helpers["get_psu_state"]: + if "get_psu_state" in helpers: status = helpers["get_psu_state"]() if status is True: extra += "&power_controller=on" else: extra += "&power_controller=off" - if helpers["get_status"]: + if "get_status" in helpers: status = helpers["get_status"]() if "isPSUOn" in status and status["isPSUOn"]: extra += "&power_controller=on" @@ -590,19 +590,19 @@ def process_demands(self, demand_list, response_json): if any_demand(demand_list, ["psu_on", "psu_keepalive"]): helpers = self.plugin._plugin_manager.get_helpers("psucontrol") or self.plugin._plugin_manager.get_helpers("simplypowercontroller") # psucontrol plugin - if helpers and helpers["turn_psu_on"]: + if "turn_psu_on" in helpers: helpers["turn_psu_on"]() # simplypowercontroller plugin - if helpers and helpers["psu_on"]: + if "psu_on" in helpers: helpers["psu_on"]() if "psu_off" in demand_list: helpers = self.plugin._plugin_manager.get_helpers("psucontrol") or self.plugin._plugin_manager.get_helpers("simplypowercontroller") # psucontrol plugin - if helpers and helpers["turn_psu_off"]: + if "turn_psu_off" in helpers: helpers["turn_psu_off"]() # simplypowercontroller plugin - if helpers and helpers["psu_off"]: + if "psu_off" in helpers: helpers["psu_off"]() pass diff --git a/setup.py b/setup.py index 11f88c4..1844179 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module # Remember to bump the version in octoprint_simplyprint/__init__.py as well -plugin_version = "3.1.0" +plugin_version = "3.1.1" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module