@@ -905,17 +905,20 @@ def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwar
905
905
else :
906
906
return
907
907
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
910
913
self ._tplinksmartplug_logger .debug ("Received @TPLINKON command, attempting power on of %s." % plugip )
911
914
plug = self .plug_search (self ._settings .get (["arrSmartplugs" ]),"ip" ,plugip )
912
915
self ._tplinksmartplug_logger .debug (plug )
913
916
if plug and plug ["gcodeEnabled" ]:
914
917
t = threading .Timer (int (plug ["gcodeOnDelay" ]),self .gcode_turn_on ,[plug ])
915
918
t .start ()
916
919
return None
917
- elif cmd . startswith ( "@ TPLINKOFF") :
918
- plugip = re . sub ( r'^@TPLINKOFF\s?' , '' , cmd )
920
+ if command == " TPLINKOFF" :
921
+ plugip = parameters
919
922
self ._tplinksmartplug_logger .debug ("Received TPLINKOFF command, attempting power off of %s." % plugip )
920
923
plug = self .plug_search (self ._settings .get (["arrSmartplugs" ]),"ip" ,plugip )
921
924
self ._tplinksmartplug_logger .debug (plug )
@@ -974,6 +977,7 @@ def __plugin_load__():
974
977
global __plugin_hooks__
975
978
__plugin_hooks__ = {
976
979
"octoprint.comm.protocol.gcode.sent" : __plugin_implementation__ .processGCODE ,
980
+ "octoprint.comm.protocol.atcommand.sending" : __plugin_implementation__ .processAtCommand ,
977
981
"octoprint.comm.protocol.temperatures.received" : __plugin_implementation__ .monitor_temperatures ,
978
982
"octoprint.plugin.softwareupdate.check_config" : __plugin_implementation__ .get_update_information
979
983
}
0 commit comments