From b3b0329e50bfef02abf90858c67e5af4d9d2e1f1 Mon Sep 17 00:00:00 2001 From: David Zingg Date: Wed, 20 Nov 2019 21:01:15 +0100 Subject: [PATCH] Revert "#6 UI Updates senden und anzeigen" This reverts commit f83d4259 --- octoprint_mystromswitch/__init__.py | 8 ++------ octoprint_mystromswitch/static/js/mystromswitch.js | 10 ++-------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py index 8956d99..9d0adbe 100644 --- a/octoprint_mystromswitch/__init__.py +++ b/octoprint_mystromswitch/__init__.py @@ -56,12 +56,8 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, try: request = requests.get( 'http://{}/report'.format(self.ip), timeout=1) - if request.status_code == 200: - self._logger.debug("update view") - self._logger.debug(request.json()) - - self._plugin_manager.send_plugin_message(self._identifier, - request.json()) + self._plugin_manager.send_plugin_message(self._identifier, + request.json()) except (requests.exceptions.ConnectionError, ValueError): self._logger.info('Connection Error Host: {}'.format(self.ip)) # Do all Staff here diff --git a/octoprint_mystromswitch/static/js/mystromswitch.js b/octoprint_mystromswitch/static/js/mystromswitch.js index e998258..fb48df3 100644 --- a/octoprint_mystromswitch/static/js/mystromswitch.js +++ b/octoprint_mystromswitch/static/js/mystromswitch.js @@ -129,20 +129,14 @@ $(function() { } } - self.onEventPrinterStateChanged = function(payload) { - if (payload.state_id == "PRINTING" || payload.state_id == "PAUSED"){ - self.testButtonChangeStatus(true); - } else { - self.testButtonChangeStatus(false); - } - } - self.mystromswitchEnabled.subscribe(self.onmystromswitchEvent, self); self.onDataUpdaterPluginMessage = function(plugin, data) { if (plugin != "mystromswitch" && plugin != "octoprint_mystromswitch") { return; } + + self.mystromswitchEnabled(data.mystromswitchEnabled); if (data.power != null) { self.timeoutPopupOptions.text = self.timeoutPopupText + data.power; if (typeof self.timeoutPopup != "undefined") {