#21 Add PowerOFF when print is finished
This commit is contained in:
parent
42f80d831c
commit
c624769e9d
@ -2,7 +2,10 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -47,13 +50,6 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1574193087583</updated>
|
<updated>1574193087583</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00023" summary="#6 UI Updates senden und anzeigen">
|
|
||||||
<created>1574284365024</created>
|
|
||||||
<option name="number" value="00023" />
|
|
||||||
<option name="presentableId" value="LOCAL-00023" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1574284365024</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00024" summary="#6 UI Updates senden und anzeigen">
|
<task id="LOCAL-00024" summary="#6 UI Updates senden und anzeigen">
|
||||||
<created>1574284478325</created>
|
<created>1574284478325</created>
|
||||||
<option name="number" value="00024" />
|
<option name="number" value="00024" />
|
||||||
@ -390,7 +386,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1593346998123</updated>
|
<updated>1593346998123</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="72" />
|
<task id="LOCAL-00072" summary="#21 Add PowerOFF when print is finished">
|
||||||
|
<created>1593347175159</created>
|
||||||
|
<option name="number" value="00072" />
|
||||||
|
<option name="presentableId" value="LOCAL-00072" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1593347175159</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="73" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
|
@ -5,8 +5,8 @@ import octoprint.plugin
|
|||||||
import requests
|
import requests
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
from octoprint.util import RepeatedTimer
|
|
||||||
from octoprint.events import eventManager, Events
|
from octoprint.events import eventManager, Events
|
||||||
|
from octoprint.util import RepeatedTimer
|
||||||
|
|
||||||
|
|
||||||
class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
||||||
@ -110,6 +110,8 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
data["onOffButtonEnabled"] = self.onOffButtonEnabled
|
data["onOffButtonEnabled"] = self.onOffButtonEnabled
|
||||||
data["showShutdownOctopiOption"] = self.showShutdownOctopiOption
|
data["showShutdownOctopiOption"] = self.showShutdownOctopiOption
|
||||||
data["showPowerOffPrintFinishOption"] = self.showPowerOffPrintFinishOption
|
data["showPowerOffPrintFinishOption"] = self.showPowerOffPrintFinishOption
|
||||||
|
data["automaticShutdownEnabled"] = self.shutdownAfterPrintFinished
|
||||||
|
data["automaticPowerOffEnabled"] = self.powerOffAfterPrintFinished
|
||||||
self._plugin_manager.send_plugin_message(self._identifier, data)
|
self._plugin_manager.send_plugin_message(self._identifier, data)
|
||||||
return
|
return
|
||||||
except (requests.exceptions.ConnectionError, ValueError) as e:
|
except (requests.exceptions.ConnectionError, ValueError) as e:
|
||||||
@ -119,7 +121,8 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
else:
|
else:
|
||||||
self._logger.info("Ip is None")
|
self._logger.info("Ip is None")
|
||||||
data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False,
|
data = {"relay": True, "energy": 0, "onOffButtonEnabled": False, "showShutdownOctopiOption": False,
|
||||||
"showPowerOffPrintFinishOption": False}
|
"showPowerOffPrintFinishOption": False, "automaticShutdownEnabled": self.shutdownAfterPrintFinished,
|
||||||
|
"v": self.powerOffAfterPrintFinished}
|
||||||
self._plugin_manager.send_plugin_message(self._identifier, data)
|
self._plugin_manager.send_plugin_message(self._identifier, data)
|
||||||
|
|
||||||
def _setRelaisState(self, newState):
|
def _setRelaisState(self, newState):
|
||||||
@ -203,10 +206,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
elif command == "disablePowerOffAfterFinish":
|
elif command == "disablePowerOffAfterFinish":
|
||||||
self._logger.info("disablePowerOffAfterFinish")
|
self._logger.info("disablePowerOffAfterFinish")
|
||||||
self.powerOffAfterPrintFinished = False
|
self.powerOffAfterPrintFinished = False
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
|
||||||
dict(showShutdownOctopiOption=self.shutdownAfterPrintFinished))
|
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
|
||||||
dict(showPowerOffPrintFinishOption=self.powerOffAfterPrintFinished))
|
|
||||||
|
|
||||||
def get_api_commands(self):
|
def get_api_commands(self):
|
||||||
return dict(
|
return dict(
|
||||||
@ -277,9 +277,9 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
if event == Events.CLIENT_OPENED:
|
if event == Events.CLIENT_OPENED:
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
self._plugin_manager.send_plugin_message(self._identifier,
|
||||||
dict(showShutdownOctopiOption=self.shutdownAfterPrintFinished))
|
dict(automaticShutdownEnabled=self.shutdownAfterPrintFinished))
|
||||||
self._plugin_manager.send_plugin_message(self._identifier,
|
self._plugin_manager.send_plugin_message(self._identifier,
|
||||||
dict(showPowerOffPrintFinishOption=self.powerOffAfterPrintFinished))
|
dict(automaticPowerOffEnabled=self.powerOffAfterPrintFinished))
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:
|
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:
|
||||||
|
@ -9,6 +9,8 @@ $(function() {
|
|||||||
self.onOffButtonEnabled = ko.observable();
|
self.onOffButtonEnabled = ko.observable();
|
||||||
self.showShutdownOctopiOption = ko.observable();
|
self.showShutdownOctopiOption = ko.observable();
|
||||||
self.showPowerOffPrintFinishOption = ko.observable();
|
self.showPowerOffPrintFinishOption = ko.observable();
|
||||||
|
self.automaticPowerOffEnabled = ko.observable();
|
||||||
|
self.automaticShutdownEnabled = ko.observable();
|
||||||
self.mystromswitchPowerValue = document.getElementById("mystromswitchPowerValue")
|
self.mystromswitchPowerValue = document.getElementById("mystromswitchPowerValue")
|
||||||
self.mystromswitchEnergyValue = document.getElementById("mystromswitchEnergyValue")
|
self.mystromswitchEnergyValue = document.getElementById("mystromswitchEnergyValue")
|
||||||
|
|
||||||
@ -81,6 +83,8 @@ $(function() {
|
|||||||
self.mystromswitchPowerValue.innerHTML = "myStrom switch not reachable"
|
self.mystromswitchPowerValue.innerHTML = "myStrom switch not reachable"
|
||||||
self.mystromswitchEnergyValue.innerHTML = "Check url in Plugin Settings"
|
self.mystromswitchEnergyValue.innerHTML = "Check url in Plugin Settings"
|
||||||
}
|
}
|
||||||
|
self.automaticShutdownEnabled = data.automaticShutdownEnabled;
|
||||||
|
self.automaticPowerOffEnabled = data.automaticPowerOffEnabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
<label class="control-label" id="mystromswitchEnergyValue">Energy 0.0Wh</label>
|
<label class="control-label" id="mystromswitchEnergyValue">Energy 0.0Wh</label>
|
||||||
<button class="btn btn-primary" data-bind="click: onToggleRelayEvent, visible : onOffButtonEnabled">{{ _('Toggle Relais') }}</button>
|
<button class="btn btn-primary" data-bind="click: onToggleRelayEvent, visible : onOffButtonEnabled">{{ _('Toggle Relais') }}</button>
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="enable: loginState.isUser(), change: onAutomaticShutdownEnabledChanged, visible :showShutdownOctopiOption">
|
<input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticShutdownEnabled, visible :showShutdownOctopiOption">
|
||||||
{{ _('Shutdown Octoprint after print finishes') }}
|
{{ _('Shutdown Octoprint after print finishes') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input type="checkbox" data-bind="enable: loginState.isUser(), change: onAutomaticPowerOffEnabledChanged", visible: showPowerOffPrintFinishOption>
|
<input type="checkbox" data-bind="enable: loginState.isUser(), change: automaticPowerOffEnabled", visible: showPowerOffPrintFinishOption>
|
||||||
{{ _('Power Off Relais after print finishes') }}
|
{{ _('Power Off Relais after print finishes') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user