Skip to content

Commit

Permalink
0.9.4
Browse files Browse the repository at this point in the history
If M81 command is received to power off plug with a configured delay and `Warn While Printing` is enabled the plug will not be powered off if another print is started before the delay is reached.
  • Loading branch information
jneilliii authored Jun 14, 2018
2 parents 28bd597 + e1f4da2 commit 0edf789
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.9.2] - 2018-02-03
## [0.9.4] - 2018-06-09
### Changed
- If M81 command is received to power off plug with a configured delay and `Warn While Printing` is enabled the plug will not be powered off if another print is started before the delay is reached.

## [0.9.3] - 2018-02-03
### Fixed
- Icon not displaying in IE due to binding css issue.

Expand Down Expand Up @@ -120,6 +124,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Initial release.

[0.9.4]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.4
[0.9.3]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.3
[0.9.2]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.2
[0.9.1]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.1
[0.8.0]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.8.0
Expand Down
8 changes: 7 additions & 1 deletion octoprint_tplinksmartplug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ def sendCommand(self, cmd, plugip):

##~~ Gcode processing hook

def gcode_turn_off(self, plug):
if plug["warnPrinting"] and self._printer.is_printing():
self._logger.info("Not powering off %s because printer is printing." % plug["label"])
else:
self.turn_off(plug["ip"])

def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs):
if gcode:
if cmd.startswith("M80"):
Expand All @@ -229,7 +235,7 @@ def processGCODE(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwar
plug = self.plug_search(self._settings.get(["arrSmartplugs"]),"ip",plugip)
self._tplinksmartplug_logger.debug(plug)
if plug["gcodeEnabled"]:
t = threading.Timer(int(plug["gcodeOffDelay"]),self.turn_off,args=[plugip])
t = threading.Timer(int(plug["gcodeOffDelay"]),self.gcode_turn_off,[plug])
t.start()
return
else:
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.3"
plugin_version = "0.9.4"

# 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 0edf789

Please sign in to comment.