Skip to content

Commit c8687b6

Browse files
authored
0.9.20 (#156)
* Fixed @TPLINKON and @TPLINKOFF commands that were broken in last update
1 parent ac8d56f commit c8687b6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

octoprint_tplinksmartplug/__init__.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -905,17 +905,20 @@ def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwar
905905
else:
906906
return
907907

908-
elif cmd.startswith("@TPLINKON"):
909-
plugip = re.sub(r'^@TPLINKON\s?', '', cmd)
908+
def processAtCommand(self, comm_instance, phase, command, parameters, tags=None, *args, **kwargs):
909+
self._logger.info(command)
910+
self._logger.info(parameters)
911+
if command == "TPLINKON":
912+
plugip = parameters
910913
self._tplinksmartplug_logger.debug("Received @TPLINKON command, attempting power on of %s." % plugip)
911914
plug = self.plug_search(self._settings.get(["arrSmartplugs"]),"ip",plugip)
912915
self._tplinksmartplug_logger.debug(plug)
913916
if plug and plug["gcodeEnabled"]:
914917
t = threading.Timer(int(plug["gcodeOnDelay"]),self.gcode_turn_on,[plug])
915918
t.start()
916919
return None
917-
elif cmd.startswith("@TPLINKOFF"):
918-
plugip = re.sub(r'^@TPLINKOFF\s?', '', cmd)
920+
if command == "TPLINKOFF":
921+
plugip = parameters
919922
self._tplinksmartplug_logger.debug("Received TPLINKOFF command, attempting power off of %s." % plugip)
920923
plug = self.plug_search(self._settings.get(["arrSmartplugs"]),"ip",plugip)
921924
self._tplinksmartplug_logger.debug(plug)
@@ -974,6 +977,7 @@ def __plugin_load__():
974977
global __plugin_hooks__
975978
__plugin_hooks__ = {
976979
"octoprint.comm.protocol.gcode.sent": __plugin_implementation__.processGCODE,
980+
"octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.processAtCommand,
977981
"octoprint.comm.protocol.temperatures.received": __plugin_implementation__.monitor_temperatures,
978982
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
979983
}

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-TPLinkSmartplug"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.9.19"
17+
plugin_version = "0.9.20"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)