diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b152604..fd5005a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -48,13 +48,6 @@
1574193087583
-
- 1574279821388
-
-
-
- 1574279821388
-
1574280075129
@@ -391,7 +384,14 @@
1578939868816
-
+
+ 1578940345174
+
+
+
+ 1578940345174
+
+
diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py
index 87c1fde..24fcc77 100644
--- a/octoprint_mystromswitch/__init__.py
+++ b/octoprint_mystromswitch/__init__.py
@@ -82,22 +82,24 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
'http://{}/report'.format(self.ip), timeout=1)
self._logger.info("timer request finish")
if request.status_code == 200:
- self._logger.info("timer request OK, timestamp: " + str(time.time()) + " lastTimestamp: " + str(
- self.lastTimeStamp))
timestamp = time.time()
data = request.json()
if not self.lastTimeStamp == 0:
intervall = timestamp - self.lastTimeStamp
# Energy in Wh
self.energy = self.energy + (intervall * data["power"] / 3600)
- self._logger.info("Energy: " + str(self.energy))
+ self._logger.info(
+ "Energy: " + str(self.energy) + " interval: " + str(intervall) + " power: " + str(
+ data["power"]))
self.lastTimeStamp = timestamp
data["energy"] = self.energy
data["onOffButtonEnabled"] = self.onOffButtonEnabled
self._plugin_manager.send_plugin_message(self._identifier, data)
except (requests.exceptions.ConnectionError, ValueError) as e:
+ self._logger.exception(e)
self._logger.info('Connection Error Host: {}, {}'.format(self.ip, e))
except Exception as exp:
+ self._logger.exception(exp)
self._logger.info(exp.message)
else:
self._logger.info("Ip is None")
@@ -132,6 +134,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
try:
try:
self._logger.info("try to send Powercycle Request")
+ self._logger.info('http://{}/timer'.format(self.ip))
request = requests.post(
'http://{}/timer'.format(self.ip), params={'mode': value, 'time': time}, timeout=1)
self._logger.info("a")
@@ -142,9 +145,11 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._logger.info(
"Could not powerCycle Relais, Http Status Code: {}".format(request.status_code))
except requests.exceptions.ConnectionError as e:
+ self._logger.exception(e)
self._logger.info("Error during powerCycle Relais: " + e.message)
except Exception as exp:
self._logger.info("Exception aufgetreten: " + exp.message)
+ self._logger.exception(exp)
nbRetry = nbRetry + 1
def _toggleRelay(self):