#21 Add PowerOFF when print is finished

This commit is contained in:
David Zingg 2020-02-29 17:04:39 +01:00
parent 531d795615
commit b5d23ef46f
3 changed files with 53 additions and 42 deletions

View File

@ -4,7 +4,6 @@
<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" />
@ -25,6 +24,7 @@
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.extensions.open"> <usages-collector id="statistics.file.extensions.open">
<counts> <counts>
<entry key="css" value="1" />
<entry key="jinja2" value="2" /> <entry key="jinja2" value="2" />
<entry key="js" value="1" /> <entry key="js" value="1" />
<entry key="py" value="2" /> <entry key="py" value="2" />
@ -32,6 +32,7 @@
</usages-collector> </usages-collector>
<usages-collector id="statistics.file.types.open"> <usages-collector id="statistics.file.types.open">
<counts> <counts>
<entry key="CSS" value="1" />
<entry key="JavaScript" value="1" /> <entry key="JavaScript" value="1" />
<entry key="PLAIN_TEXT" value="2" /> <entry key="PLAIN_TEXT" value="2" />
<entry key="Python" value="2" /> <entry key="Python" value="2" />
@ -40,14 +41,14 @@
<usages-collector id="statistics.file.extensions.edit"> <usages-collector id="statistics.file.extensions.edit">
<counts> <counts>
<entry key="jinja2" value="669" /> <entry key="jinja2" value="669" />
<entry key="js" value="213" /> <entry key="js" value="260" />
<entry key="py" value="467" /> <entry key="py" value="467" />
<entry key="txt" value="107" /> <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="213" /> <entry key="JavaScript" value="260" />
<entry key="PLAIN_TEXT" value="776" /> <entry key="PLAIN_TEXT" value="776" />
<entry key="Python" value="467" /> <entry key="Python" value="467" />
</counts> </counts>
@ -56,16 +57,11 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<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="1309"> <state relative-caret-position="236">
<caret line="213" column="40" selection-start-line="213" selection-start-column="40" selection-end-line="213" selection-end-column="40" /> <caret line="25" column="37" selection-start-line="25" selection-start-column="37" selection-end-line="25" selection-end-column="37" />
<folding> <folding>
<element signature="e#15#53#0" expanded="true" /> <element signature="e#15#53#0" expanded="true" />
</folding> </folding>
@ -76,8 +72,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js"> <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="850"> <state relative-caret-position="357">
<caret line="62" column="9" lean-forward="true" selection-start-line="62" selection-start-column="9" selection-end-line="62" selection-end-column="9" /> <caret line="48" column="46" selection-start-line="48" selection-start-column="13" selection-end-line="48" selection-end-column="46" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -85,8 +81,8 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<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="85"> <state relative-caret-position="170">
<caret line="5" column="104" selection-start-line="5" selection-start-column="104" selection-end-line="5" selection-end-column="104" /> <caret line="10" column="113" selection-start-line="10" selection-start-column="113" selection-end-line="10" selection-end-column="113" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -97,6 +93,7 @@
<findStrings> <findStrings>
<find>onOffBu</find> <find>onOffBu</find>
<find>onmystromswitchEvent</find> <find>onmystromswitchEvent</find>
<find>showShutdownOctopiOption</find>
<find>onOffButtonEnabled</find> <find>onOffButtonEnabled</find>
</findStrings> </findStrings>
</component> </component>
@ -148,6 +145,13 @@
<item name="octoprint_mystromswitch" type="462c0819:PsiDirectoryNode" /> <item name="octoprint_mystromswitch" type="462c0819:PsiDirectoryNode" />
<item name="static" type="462c0819:PsiDirectoryNode" /> <item name="static" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="OctoPrint-MyStromSwitch" type="b2602c69:ProjectViewProjectNode" />
<item name="OctoPrint-MyStromSwitch" type="462c0819:PsiDirectoryNode" />
<item name="octoprint_mystromswitch" type="462c0819:PsiDirectoryNode" />
<item name="static" type="462c0819:PsiDirectoryNode" />
<item name="css" type="462c0819:PsiDirectoryNode" />
</path>
<path> <path>
<item name="OctoPrint-MyStromSwitch" type="b2602c69:ProjectViewProjectNode" /> <item name="OctoPrint-MyStromSwitch" type="b2602c69:ProjectViewProjectNode" />
<item name="OctoPrint-MyStromSwitch" type="462c0819:PsiDirectoryNode" /> <item name="OctoPrint-MyStromSwitch" type="462c0819:PsiDirectoryNode" />
@ -194,20 +198,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00016" summary="#6 UI Updates senden und anzeigen">
<created>1574282504648</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1574282504648</updated>
</task>
<task id="LOCAL-00017" summary="#6 UI Updates senden und anzeigen">
<created>1574282834574</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1574282834574</updated>
</task>
<task id="LOCAL-00018" summary="#6 UI Updates senden und anzeigen"> <task id="LOCAL-00018" summary="#6 UI Updates senden und anzeigen">
<created>1574283002922</created> <created>1574283002922</created>
<option name="number" value="00018" /> <option name="number" value="00018" />
@ -537,7 +527,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1582991033421</updated> <updated>1582991033421</updated>
</task> </task>
<option name="localTasksCounter" value="65" /> <task id="LOCAL-00065" summary="#21 Add PowerOFF when print is finished">
<created>1582991352868</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1582991352868</updated>
</task>
<task id="LOCAL-00066" summary="#21 Add PowerOFF when print is finished">
<created>1582991720560</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1582991720560</updated>
</task>
<option name="localTasksCounter" value="67" />
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
@ -627,9 +631,6 @@
<option name="LAST_COMMIT_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$/setup.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2"> <entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51"> <state relative-caret-position="51">
@ -637,10 +638,20 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/css/mystromswitch.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-93" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1054" />
</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="1309"> <state relative-caret-position="236">
<caret line="213" column="40" selection-start-line="213" selection-start-column="40" selection-end-line="213" selection-end-column="40" /> <caret line="25" column="37" selection-start-line="25" selection-start-column="37" selection-end-line="25" selection-end-column="37" />
<folding> <folding>
<element signature="e#15#53#0" expanded="true" /> <element signature="e#15#53#0" expanded="true" />
</folding> </folding>
@ -649,15 +660,15 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octoprint_mystromswitch/static/js/mystromswitch.js"> <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="850"> <state relative-caret-position="357">
<caret line="62" column="9" lean-forward="true" selection-start-line="62" selection-start-column="9" selection-end-line="62" selection-end-column="9" /> <caret line="48" column="46" selection-start-line="48" selection-start-column="13" selection-end-line="48" selection-end-column="46" />
</state> </state>
</provider> </provider>
</entry> </entry>
<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="85"> <state relative-caret-position="170">
<caret line="5" column="104" selection-start-line="5" selection-start-column="104" selection-end-line="5" selection-end-column="104" /> <caret line="10" column="113" selection-start-line="10" selection-start-column="113" selection-end-line="10" selection-end-column="113" />
</state> </state>
</provider> </provider>
</entry> </entry>

View File

@ -62,8 +62,8 @@ $(function() {
}) })
} }
self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self); //self.automaticShutdownEnabled.subscribe(self.onAutomaticShutdownEnabledChanged,self);
self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self); //self.automaticPowerOffEnabled.subscribe(self.onAutomaticPowerOffEnabledChanged,self);
self.onDataUpdaterPluginMessage = function(plugin, data) { self.onDataUpdaterPluginMessage = function(plugin, data) {
if (plugin != "mystromswitch" && plugin != "octoprint_mystromswitch") { if (plugin != "mystromswitch" && plugin != "octoprint_mystromswitch") {

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