#21 Add PowerOFF when print is finished
This commit is contained in:
parent
39ff47e829
commit
6f96140e10
19
.idea/workspace.xml
generated
19
.idea/workspace.xml
generated
@ -2,8 +2,7 @@
|
|||||||
<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$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" 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" />
|
||||||
@ -48,13 +47,6 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1574193087583</updated>
|
<updated>1574193087583</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00034" summary="#8 Relais ein / ausschalten von Ocotprint aus">
|
|
||||||
<created>1574608700412</created>
|
|
||||||
<option name="number" value="00034" />
|
|
||||||
<option name="presentableId" value="LOCAL-00034" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1574608700412</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00035" summary="#8 Relais ein / ausschalten von Ocotprint aus">
|
<task id="LOCAL-00035" summary="#8 Relais ein / ausschalten von Ocotprint aus">
|
||||||
<created>1574609194050</created>
|
<created>1574609194050</created>
|
||||||
<option name="number" value="00035" />
|
<option name="number" value="00035" />
|
||||||
@ -391,7 +383,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1593353565224</updated>
|
<updated>1593353565224</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="83" />
|
<task id="LOCAL-00083" summary="#21 Add PowerOFF when print is finished">
|
||||||
|
<created>1593354627917</created>
|
||||||
|
<option name="number" value="00083" />
|
||||||
|
<option name="presentableId" value="LOCAL-00083" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1593354627917</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="84" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
|
@ -152,7 +152,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def _status_timer_task(self):
|
def _status_timer_task(self):
|
||||||
if self.ip is not None:
|
if self.ip is not None:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@ -189,7 +189,7 @@ def _status_timer_task(self):
|
|||||||
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):
|
||||||
nbRetry = 0
|
nbRetry = 0
|
||||||
value = '0'
|
value = '0'
|
||||||
if newState:
|
if newState:
|
||||||
@ -208,10 +208,10 @@ def _setRelaisState(self, newState):
|
|||||||
nbRetry = nbRetry + 1
|
nbRetry = nbRetry + 1
|
||||||
|
|
||||||
|
|
||||||
# Sets the switch to a specific inverse newState,
|
# Sets the switch to a specific inverse newState,
|
||||||
# waits for a specified amount of time (max 3h),
|
# waits for a specified amount of time (max 3h),
|
||||||
# then sets the the switch to the newState.
|
# then sets the the switch to the newState.
|
||||||
def _powerCycleRelais(self, newState, time):
|
def _powerCycleRelais(self, newState, time):
|
||||||
nbRetry = 0
|
nbRetry = 0
|
||||||
value = 'on'
|
value = 'on'
|
||||||
if newState:
|
if newState:
|
||||||
@ -236,7 +236,7 @@ def _powerCycleRelais(self, newState, time):
|
|||||||
nbRetry = nbRetry + 1
|
nbRetry = nbRetry + 1
|
||||||
|
|
||||||
|
|
||||||
def _toggleRelay(self):
|
def _toggleRelay(self):
|
||||||
nbRetry = 0
|
nbRetry = 0
|
||||||
while nbRetry < 3:
|
while nbRetry < 3:
|
||||||
try:
|
try:
|
||||||
@ -251,7 +251,7 @@ def _toggleRelay(self):
|
|||||||
nbRetry = nbRetry + 1
|
nbRetry = nbRetry + 1
|
||||||
|
|
||||||
|
|
||||||
def on_api_command(self, command, data):
|
def on_api_command(self, command, data):
|
||||||
if command == "enableRelais":
|
if command == "enableRelais":
|
||||||
self._logger.info("enableRelais")
|
self._logger.info("enableRelais")
|
||||||
self._setRelaisState(True)
|
self._setRelaisState(True)
|
||||||
@ -275,7 +275,7 @@ def on_api_command(self, command, data):
|
|||||||
self.powerOffAfterPrintFinished = False
|
self.powerOffAfterPrintFinished = False
|
||||||
|
|
||||||
|
|
||||||
def get_api_commands(self):
|
def get_api_commands(self):
|
||||||
return dict(
|
return dict(
|
||||||
enableRelais=[],
|
enableRelais=[],
|
||||||
disableRelais=[],
|
disableRelais=[],
|
||||||
@ -287,13 +287,13 @@ def get_api_commands(self):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def on_after_startup(self):
|
def on_after_startup(self):
|
||||||
if self.powerOnOnStart:
|
if self.powerOnOnStart:
|
||||||
self._logger.info("Turn on Relais on Start")
|
self._logger.info("Turn on Relais on Start")
|
||||||
self._setRelaisState(True)
|
self._setRelaisState(True)
|
||||||
|
|
||||||
|
|
||||||
def on_shutdown(self):
|
def on_shutdown(self):
|
||||||
self._logger.info("on_shutdown_event")
|
self._logger.info("on_shutdown_event")
|
||||||
if self.powerOffOnShutdown:
|
if self.powerOffOnShutdown:
|
||||||
if self.powerOffDelay <= 0:
|
if self.powerOffDelay <= 0:
|
||||||
@ -304,7 +304,7 @@ def on_shutdown(self):
|
|||||||
self._powerCycleRelais(False, self.powerOffDelay)
|
self._powerCycleRelais(False, self.powerOffDelay)
|
||||||
|
|
||||||
|
|
||||||
def on_settings_migrate(self, target, current):
|
def on_settings_migrate(self, target, current):
|
||||||
if target > current:
|
if target > current:
|
||||||
if current <= 1:
|
if current <= 1:
|
||||||
self.onOffButtonEnabled = False
|
self.onOffButtonEnabled = False
|
||||||
@ -318,11 +318,11 @@ def on_settings_migrate(self, target, current):
|
|||||||
self.shutdownDelay = 60
|
self.shutdownDelay = 60
|
||||||
|
|
||||||
|
|
||||||
def get_settings_version(self):
|
def get_settings_version(self):
|
||||||
return 4
|
return 4
|
||||||
|
|
||||||
|
|
||||||
def get_settings_defaults(self):
|
def get_settings_defaults(self):
|
||||||
return dict(
|
return dict(
|
||||||
ip=None,
|
ip=None,
|
||||||
intervall=1,
|
intervall=1,
|
||||||
@ -336,19 +336,19 @@ def get_settings_defaults(self):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_settings_restricted_paths(self):
|
def get_settings_restricted_paths(self):
|
||||||
return dict(admin=[
|
return dict(admin=[
|
||||||
['ip']
|
['ip']
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def on_settings_save(self, data):
|
def on_settings_save(self, data):
|
||||||
self._logger.info("on_settings_save")
|
self._logger.info("on_settings_save")
|
||||||
octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
|
octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
|
||||||
self.initialize()
|
self.initialize()
|
||||||
|
|
||||||
|
|
||||||
def on_event(self, event, payload):
|
def on_event(self, event, payload):
|
||||||
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:
|
if not self.shutdownAfterPrintFinished and not self.powerOffAfterPrintFinished:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ def on_event(self, event, payload):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def get_update_information(self):
|
def get_update_information(self):
|
||||||
return dict(
|
return dict(
|
||||||
mystromswitch=dict(
|
mystromswitch=dict(
|
||||||
displayName="OctoPrint-MyStromSwitch",
|
displayName="OctoPrint-MyStromSwitch",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user