Skip to content

Commit

Permalink
add @TASMOTAIDLEOFF and @TASMOTAIDLEON command support to be able to …
Browse files Browse the repository at this point in the history
…disable the idle timeouts via gcode, helpful for OctoDash for example
  • Loading branch information
jneilliii committed Mar 11, 2022
1 parent 4bc9a10 commit 250011d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions octoprint_tasmota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,20 @@ def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwar
self._reset_idle_timer()
return

def processAtCommand(self, comm_instance, phase, command, parameters, tags=None, *args, **kwargs):
if command == 'TASMOTAIDLEON':
self.powerOffWhenIdle = True
self._reset_idle_timer()
if 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
if command in ["TASMOTAIDLEON", "TASMOTAIDLEOFF"]:
self._plugin_manager.send_plugin_message(self._identifier, dict(powerOffWhenIdle=self.powerOffWhenIdle, type="timeout", timeout_value=self._timeout_value))

##~~ Temperatures received hook

def check_temps(self, parsed_temps):
Expand Down Expand Up @@ -1078,6 +1092,7 @@ def __plugin_load__():
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.queuing": __plugin_implementation__.processGCODE,
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.process_echo,
"octoprint.comm.protocol.atcommand.sending": __plugin_implementation__.processAtCommand,
"octoprint.comm.protocol.temperatures.received": __plugin_implementation__.monitor_temperatures,
"octoprint.access.permissions": __plugin_implementation__.get_additional_permissions,
"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-Tasmota"

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

# 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 250011d

Please sign in to comment.