Skip to content

Commit

Permalink
add uptime to resolve issues with idle timeout from initial pi boot, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jneilliii committed Mar 2, 2021
2 parents 4e221eb + 3251efd commit a8582f1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mark Stale Issues
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale because it has not had activity in 14 days. It will be closed if no further activity occurs in 7 days'
days-before-stale: 14
days-before-close: 7
stale-issue-label: 'stale'
days-before-issue-stale: 14
days-before-pr-stale: -1
days-before-issue-close: 7
days-before-pr-close: -1
exempt-issue-labels: 'bug,enhancement'
7 changes: 7 additions & 0 deletions octoprint_tasmota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import threading
import sqlite3
import flask
from uptime import uptime
from datetime import datetime, timedelta

try:
Expand Down Expand Up @@ -755,6 +756,12 @@ def _idle_poweroff(self):
if self._printer.is_printing() or self._printer.is_paused():
return

if (uptime() / 60) <= (self._settings.get_int(["idleTimeout"])):
self._tasmota_logger.debug("Just booted so wait for time sync.")
self._tasmota_logger.debug("uptime: {}, comparison: {}".format((uptime() / 60), (self._settings.get_int(["idleTimeout"]))))
self._reset_idle_timer()
return

self._tasmota_logger.debug(
"Idle timeout reached after %s minute(s). Turning heaters off prior to powering off plugs." % self.idleTimeout)
if self._wait_for_heaters():
Expand Down
2 changes: 1 addition & 1 deletion octoprint_tasmota/static/js/plotly-latest.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions 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.0.1"
plugin_version = "1.0.2rc1"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand All @@ -33,7 +33,7 @@
plugin_license = "AGPLv3"

# Any additional requirements besides OctoPrint should be listed here
plugin_requires = ["requests"]
plugin_requires = ["requests", "uptime"]

### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
Expand Down

0 comments on commit a8582f1

Please sign in to comment.