Skip to content

Commit

Permalink
0.9.20 (#156)
Browse files Browse the repository at this point in the history
* Fixed @TPLINKON and @TPLINKOFF commands that were broken in last update
  • Loading branch information
jneilliii authored May 2, 2020
1 parent ac8d56f commit c8687b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions octoprint_tplinksmartplug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,17 +905,20 @@ def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwar
else:
return

elif cmd.startswith("@TPLINKON"):
plugip = re.sub(r'^@TPLINKON\s?', '', cmd)
def processAtCommand(self, comm_instance, phase, command, parameters, tags=None, *args, **kwargs):
self._logger.info(command)
self._logger.info(parameters)
if command == "TPLINKON":
plugip = parameters
self._tplinksmartplug_logger.debug("Received @TPLINKON command, attempting power on of %s." % plugip)
plug = self.plug_search(self._settings.get(["arrSmartplugs"]),"ip",plugip)
self._tplinksmartplug_logger.debug(plug)
if plug and plug["gcodeEnabled"]:
t = threading.Timer(int(plug["gcodeOnDelay"]),self.gcode_turn_on,[plug])
t.start()
return None
elif cmd.startswith("@TPLINKOFF"):
plugip = re.sub(r'^@TPLINKOFF\s?', '', cmd)
if command == "TPLINKOFF":
plugip = parameters
self._tplinksmartplug_logger.debug("Received TPLINKOFF command, attempting power off of %s." % plugip)
plug = self.plug_search(self._settings.get(["arrSmartplugs"]),"ip",plugip)
self._tplinksmartplug_logger.debug(plug)
Expand Down Expand Up @@ -974,6 +977,7 @@ def __plugin_load__():
global __plugin_hooks__
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.sent": __plugin_implementation__.processGCODE,
"octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.processAtCommand,
"octoprint.comm.protocol.temperatures.received": __plugin_implementation__.monitor_temperatures,
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "OctoPrint-TPLinkSmartplug"

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

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

0 comments on commit c8687b6

Please sign in to comment.