#17 Logging zur Fehleranalyse eingebaut

This commit is contained in:
David Zingg 2020-01-16 16:28:23 +01:00
parent ad66d2df68
commit 4a0136317b
2 changed files with 12 additions and 12 deletions

View File

@ -48,13 +48,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1574193087583</updated> <updated>1574193087583</updated>
</task> </task>
<task id="LOCAL-00007" summary="Revert &quot;#6 UI Updates senden und anzeigen&quot;&#10;&#10;This reverts commit f83d4259">
<created>1574280075129</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1574280075129</updated>
</task>
<task id="LOCAL-00008" summary="#6 UI Updates senden und anzeigen"> <task id="LOCAL-00008" summary="#6 UI Updates senden und anzeigen">
<created>1574280301030</created> <created>1574280301030</created>
<option name="number" value="00008" /> <option name="number" value="00008" />
@ -391,7 +384,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1578940345174</updated> <updated>1578940345174</updated>
</task> </task>
<option name="localTasksCounter" value="56" /> <task id="LOCAL-00056" summary="#17 Logging zur Fehleranalyse eingebaut">
<created>1578941071143</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1578941071143</updated>
</task>
<option name="localTasksCounter" value="57" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">

View File

@ -107,7 +107,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
def _setRelaisState(self, newState): def _setRelaisState(self, newState):
nbRetry = 0 nbRetry = 0
value = '0' value = '0'
if (newState == True): if newState:
value = '1' value = '1'
while nbRetry < 3: while nbRetry < 3:
try: try:
@ -146,9 +146,9 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
"Could not powerCycle Relais, Http Status Code: {}".format(request.status_code)) "Could not powerCycle Relais, Http Status Code: {}".format(request.status_code))
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
self._logger.exception(e) self._logger.exception(e)
self._logger.info("Error during powerCycle Relais: " + e.message) self._logger.info("Error during powerCycle Relais: " + str(e.message))
except Exception as exp: except Exception as exp:
self._logger.info("Exception aufgetreten: " + exp.message) self._logger.info("Exception aufgetreten: " + str(exp.message))
self._logger.exception(exp) self._logger.exception(exp)
nbRetry = nbRetry + 1 nbRetry = nbRetry + 1
@ -193,7 +193,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
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:
self._logger.info("Turn on Relais off Shutdown") self._logger.info("Turn off Relais on Shutdown")
self._setRelaisState(False) self._setRelaisState(False)
else: else:
self._logger.info("Turn off Relais on Shutdown Delayed") self._logger.info("Turn off Relais on Shutdown Delayed")