From 7a4d53d2210a455f1b99f526db1865583b9e52f3 Mon Sep 17 00:00:00 2001 From: David Zingg Date: Sun, 24 Nov 2019 15:29:45 +0100 Subject: [PATCH] #8 Relais ein / ausschalten von Ocotprint aus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Button Style auf default geƤndert - get_api_commands implementiert --- octoprint_mystromswitch/__init__.py | 7 +++++++ .../static/css/mystromswitch.css | 14 -------------- octoprint_mystromswitch/static/js/mystromswitch.js | 3 --- .../templates/mystromswitch_sidebar.jinja2 | 1 + 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py index a384367..806a8f9 100644 --- a/octoprint_mystromswitch/__init__.py +++ b/octoprint_mystromswitch/__init__.py @@ -101,6 +101,13 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin, self._logger.info("toggleRelais") self._toggleRelay() + def get_api_commands(self): + return dict( + enableRelais=[], + disableRelais=[], + toggleRelais=[] + ) + def on_after_startup(self): pass diff --git a/octoprint_mystromswitch/static/css/mystromswitch.css b/octoprint_mystromswitch/static/css/mystromswitch.css index fabdd89..13eb0ab 100644 --- a/octoprint_mystromswitch/static/css/mystromswitch.css +++ b/octoprint_mystromswitch/static/css/mystromswitch.css @@ -32,20 +32,6 @@ display:none; } -.mystromToggleButton { - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25); - display: block; - height: 100%; - padding-left: 10px; - padding-right: 10px; - margin-left: 20px; - margin-right: 20px; - font-size: 14px; - font-weight: bold; - color: #fff; - background-color: #eb0000; -} - #touch body #tabs #sidebar_plugin_mystromswitch_wrapper_link a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_mystromswitch_wrapper_link a:before,#touch body #tabs #sidebar_plugin_mystromswitch_wrapper_link2 a:before, #touch body #navbar #all_touchui_settings #sidebar_plugin_mystromswitch_wrapper_link2 a:before { content: "\f011"; } diff --git a/octoprint_mystromswitch/static/js/mystromswitch.js b/octoprint_mystromswitch/static/js/mystromswitch.js index d72565d..b38a543 100644 --- a/octoprint_mystromswitch/static/js/mystromswitch.js +++ b/octoprint_mystromswitch/static/js/mystromswitch.js @@ -9,8 +9,6 @@ $(function() { self.mystromswitchEnabled = ko.observable(); self.mystromswitchPowerValue = document.getElementById("mystromswitchPowerValue") - self.mystromToggleButton = document.getElementById("myStromRelaisToggleButton") - self.onToggleRelayEvent = function(){ $.ajax({ url: API_BASEURL + "plugin/mystromswitch", @@ -22,7 +20,6 @@ $(function() { contentType: "application/json; charset=UTF-8" }) } - self.mystromToggleButton.addEventListener("click",self.onToggleRelayEvent) self.onmystromswitchEvent = function() { if (self.mystromswitchEnabled()) { diff --git a/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2 b/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2 index 955e6ca..04b6b93 100644 --- a/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2 +++ b/octoprint_mystromswitch/templates/mystromswitch_sidebar.jinja2 @@ -1,4 +1,5 @@