#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-02-29 16:49:12 +01:00
parent 419bac3137
commit 1c3c49bab9
4 changed files with 58 additions and 66 deletions

View File

@ -4,6 +4,7 @@
<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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/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_settings.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" 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" /> <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" />
@ -38,17 +39,17 @@
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.extensions.edit"> <usages-collector id="statistics.file.extensions.edit">
<counts> <counts>
<entry key="jinja2" value="654" /> <entry key="jinja2" value="669" />
<entry key="js" value="201" /> <entry key="js" value="213" />
<entry key="py" value="447" /> <entry key="py" value="467" />
<entry key="txt" value="103" /> <entry key="txt" value="107" />
</counts> </counts>
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.types.edit"> <usages-collector id="statistics.file.types.edit">
<counts> <counts>
<entry key="JavaScript" value="201" /> <entry key="JavaScript" value="213" />
<entry key="PLAIN_TEXT" value="757" /> <entry key="PLAIN_TEXT" value="776" />
<entry key="Python" value="447" /> <entry key="Python" value="467" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
@ -63,8 +64,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/__init__.py"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/__init__.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178"> <state relative-caret-position="1309">
<caret line="103" column="18" selection-start-line="103" selection-start-column="18" selection-end-line="103" selection-end-column="18" /> <caret line="213" column="40" selection-start-line="213" selection-start-column="40" selection-end-line="213" selection-end-column="40" />
<folding> <folding>
<element signature="e#15#53#0" expanded="true" /> <element signature="e#15#53#0" expanded="true" />
</folding> </folding>
@ -73,28 +74,19 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="607"> <state relative-caret-position="850">
<caret line="87" column="125" selection-start-line="87" selection-start-column="112" selection-end-line="87" selection-end-column="125" /> <caret line="62" column="9" lean-forward="true" selection-start-line="62" selection-start-column="9" selection-end-line="62" selection-end-column="9" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="65" column="10" selection-start-line="65" selection-start-column="10" selection-end-line="65" selection-end-column="10" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="85">
<caret line="10" column="115" selection-start-line="10" selection-start-column="115" selection-end-line="10" selection-end-column="115" /> <caret line="5" column="104" selection-start-line="5" selection-start-column="104" selection-end-line="5" selection-end-column="104" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -119,10 +111,10 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" />
<option value="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" /> <option value="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" />
<option value="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" /> <option value="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" />
<option value="$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js" /> <option value="$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js" />
<option value="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2" />
</list> </list>
</option> </option>
</component> </component>
@ -202,20 +194,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00014" summary="#6 UI Updates senden und anzeigen">
<created>1574281964923</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1574281964923</updated>
</task>
<task id="LOCAL-00015" summary="#6 UI Updates senden und anzeigen">
<created>1574282183896</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1574282183896</updated>
</task>
<task id="LOCAL-00016" summary="#6 UI Updates senden und anzeigen"> <task id="LOCAL-00016" summary="#6 UI Updates senden und anzeigen">
<created>1574282504648</created> <created>1574282504648</created>
<option name="number" value="00016" /> <option name="number" value="00016" />
@ -545,7 +523,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1582990110412</updated> <updated>1582990110412</updated>
</task> </task>
<option name="localTasksCounter" value="63" /> <task id="LOCAL-00063" summary="#21 Add PowerOFF when print is finished">
<created>1582990799626</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1582990799626</updated>
</task>
<task id="LOCAL-00064" summary="#21 Add PowerOFF when print is finished">
<created>1582991033421</created>
<option name="number" value="00064" />
<option name="presentableId" value="LOCAL-00064" />
<option name="project" value="LOCAL" />
<updated>1582991033421</updated>
</task>
<option name="localTasksCounter" value="65" />
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
@ -607,7 +599,6 @@
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="#5 Rest Api integration" />
<MESSAGE value="#5 Rest Api integration&#10;&#10;- Bugfix plugin_requires" /> <MESSAGE value="#5 Rest Api integration&#10;&#10;- Bugfix plugin_requires" />
<MESSAGE value="#5 Rest Api integration&#10;&#10;- Nullpointer fix" /> <MESSAGE value="#5 Rest Api integration&#10;&#10;- Nullpointer fix" />
<MESSAGE value="#6 UI Updates senden und anzeigen&#10;&#10;- unnötigen Code entfernen, erster Versuch" /> <MESSAGE value="#6 UI Updates senden und anzeigen&#10;&#10;- unnötigen Code entfernen, erster Versuch" />
@ -632,40 +623,41 @@
<MESSAGE value="#17 Logs aufgeräumt" /> <MESSAGE value="#17 Logs aufgeräumt" />
<MESSAGE value="#21 Add PowerOFF when print is finished&#10;&#10;neue Einstellmöglichkeiten anzeigen" /> <MESSAGE value="#21 Add PowerOFF when print is finished&#10;&#10;neue Einstellmöglichkeiten anzeigen" />
<MESSAGE value="#22 Button taucht nicht auf&#10;&#10;Fehler anzeigen wenn Verbindung zu switch nicht klappt" /> <MESSAGE value="#22 Button taucht nicht auf&#10;&#10;Fehler anzeigen wenn Verbindung zu switch nicht klappt" />
<option name="LAST_COMMIT_MESSAGE" value="#22 Button taucht nicht auf&#10;&#10;Fehler anzeigen wenn Verbindung zu switch nicht klappt" /> <MESSAGE value="#21 Add PowerOFF when print is finished" />
<option name="LAST_COMMIT_MESSAGE" value="#21 Add PowerOFF when print is finished" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="607">
<caret line="87" column="125" selection-start-line="87" selection-start-column="112" selection-end-line="87" selection-end-column="125" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/setup.py"> <entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="89" selection-start-line="3" selection-start-column="89" selection-end-line="3" selection-end-column="89" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/__init__.py"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/__init__.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178"> <state relative-caret-position="1309">
<caret line="103" column="18" selection-start-line="103" selection-start-column="18" selection-end-line="103" selection-end-column="18" /> <caret line="213" column="40" selection-start-line="213" selection-start-column="40" selection-end-line="213" selection-end-column="40" />
<folding> <folding>
<element signature="e#15#53#0" expanded="true" /> <element signature="e#15#53#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="850">
<caret line="10" column="115" selection-start-line="10" selection-start-column="115" selection-end-line="10" selection-end-column="115" /> <caret line="62" column="9" lean-forward="true" selection-start-line="62" selection-start-column="9" selection-end-line="62" selection-end-column="9" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493"> <state relative-caret-position="85">
<caret line="65" column="10" selection-start-line="65" selection-start-column="10" selection-end-line="65" selection-end-column="10" /> <caret line="5" column="104" selection-start-line="5" selection-start-column="104" selection-end-line="5" selection-end-column="104" />
</state> </state>
</provider> </provider>
</entry> </entry>

View File

@ -7,8 +7,8 @@ $(function() {
self.printer = parameters[2]; self.printer = parameters[2];
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.mystromswitchPowerValue = document.getElementById("mystromswitchPowerValue") self.mystromswitchPowerValue = document.getElementById("mystromswitchPowerValue")
self.mystromswitchEnergyValue = document.getElementById("mystromswitchEnergyValue") self.mystromswitchEnergyValue = document.getElementById("mystromswitchEnergyValue")
@ -30,7 +30,7 @@ $(function() {
//self.onOffButtonEnabled.subscribe(self.onmystromswitchEvent, self); //self.onOffButtonEnabled.subscribe(self.onmystromswitchEvent, self);
/*self.onAutomaticShutdownEnabledChanged = function(){ self.onAutomaticShutdownEnabledChanged = function(){
var cmd = "disableShutdownAfterFinish"; var cmd = "disableShutdownAfterFinish";
if (self.automaticShutdownEnabled()) { if (self.automaticShutdownEnabled()) {
var cmd = "enableShutdownAfterFinish"; var cmd = "enableShutdownAfterFinish";
@ -60,7 +60,7 @@ $(function() {
}), }),
contentType: "application/json; charset=UTF-8" contentType: "application/json; charset=UTF-8"
}) })
}*/ }
//self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self); //self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self);
//self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self); //self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);
@ -70,8 +70,8 @@ $(function() {
return; return;
} }
self.onOffButtonEnabled(data.onOffButtonEnabled); self.onOffButtonEnabled(data.onOffButtonEnabled);
self.showShutdownOctopiOption(data.showShutdownOctopiOption); //self.showShutdownOctopiOption(data.showShutdownOctopiOption);
self.showPowerOffPrintFinishOption(data.showPowerOffPrintFinishOption); //self.showPowerOffPrintFinishOption(data.showPowerOffPrintFinishOption);
self.mystromswitchEnergyValue.innerHTML = "Energy: "+data.energy.toFixed(1)+"Wh" self.mystromswitchEnergyValue.innerHTML = "Energy: "+data.energy.toFixed(1)+"Wh"
if(data.relay == false){ if(data.relay == false){
self.mystromswitchPowerValue.innerHTML = "Relay is off"; self.mystromswitchPowerValue.innerHTML = "Relay is off";

View File

@ -1,7 +1,7 @@
<form class="form-horizontal"> <form class="form-horizontal">
<h4>General</h4> <h4>General</h4>
<div class="control-group"> <div class="control-group">
<label class="control-label">{{ _('URL or IP-Address of your switch') }}</label> <label class="control-label">{{ _('URL or IP-Address of your switch (without http)') }}</label>
<div class="controls"> <div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.ip"> <input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.ip">
</div> </div>

View File

@ -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(), checked: automaticShutdownEnabled, visible: showShutdownOctopiOption"> <input type="checkbox" data-bind="enable: loginState.isUser(), checked: automaticShutdownEnabled">
{{ _('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(), checked: automaticPowerOffEnabled, visible: showPowerOffPrintFinishOption"> <input type="checkbox" data-bind="enable: loginState.isUser(), checked: automaticPowerOffEnabled">
{{ _('Power Off Relais after print finishes') }} {{ _('Power Off Relais after print finishes') }}
</label> </label>
</div> </div>