diff --git a/octoprint_tasmota/__init__.py b/octoprint_tasmota/__init__.py index 92e156d..424a024 100644 --- a/octoprint_tasmota/__init__.py +++ b/octoprint_tasmota/__init__.py @@ -841,13 +841,34 @@ def processAtCommand(self, comm_instance, phase, command, parameters, tags=None, if command == 'TASMOTAIDLEON': self.powerOffWhenIdle = True self._reset_idle_timer() - if command == 'TASMOTAIDLEOFF': + elif command == 'TASMOTAIDLEOFF': self.powerOffWhenIdle = False self._stop_idle_timer() if self._abort_timer is not None: self._abort_timer.cancel() self._abort_timer = None self._timeout_value = None + elif command == 'TASMOTAON': + plugip, plugidx = parameters.split(" ") + self._tasmota_logger.debug("Received TASMOTAON command, attempting power on of %s:%s." % (plugip, plugidx)) + plug = self.plug_search(self._settings.get(["arrSmartplugs"]), "ip", plugip, "idx", plugidx) + self._tasmota_logger.debug(plug) + if plug and plug["gcodeEnabled"]: + t = threading.Timer(int(plug["gcodeOnDelay"]), self.gcode_on, [plug]) + t.daemon = True + t.start() + return None + elif command == 'TASMOTAOFF': + plugip, plugidx = parameters.split(" ") + self._tasmota_logger.debug("Received TASMOTAOFF command, attempting power off of %s:%s." % (plugip, plugidx)) + plug = self.plug_search(self._settings.get(["arrSmartplugs"]), "ip", plugip, "idx", plugidx) + self._tasmota_logger.debug(plug) + if plug and plug["gcodeEnabled"]: + t = threading.Timer(int(plug["gcodeOffDelay"]), self.gcode_off, [plug]) + t.daemon = True + t.start() + return None + if command in ["TASMOTAIDLEON", "TASMOTAIDLEOFF"]: self._plugin_manager.send_plugin_message(self._identifier, dict(powerOffWhenIdle=self.powerOffWhenIdle, type="timeout", diff --git a/setup.py b/setup.py index 53de0cb..e200cdb 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-Tasmota" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.1.2" +plugin_version = "1.1.3rc1" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module