From e5a0da06dc9e00881ddeb8f8988d96116f39244d Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sun, 7 Jan 2024 23:19:53 +0100 Subject: [PATCH] Update GPIO Viewer (#20425) --- tasmota/berry/gpio_viewer/gpioviewer.be | 22 ++++++++++++++++++++-- tasmota/berry/gpio_viewer/gpioviewer.bec | Bin 12122 -> 12614 bytes 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tasmota/berry/gpio_viewer/gpioviewer.be b/tasmota/berry/gpio_viewer/gpioviewer.be index c0f99af67..91df7624b 100644 --- a/tasmota/berry/gpio_viewer/gpioviewer.be +++ b/tasmota/berry/gpio_viewer/gpioviewer.be @@ -20,6 +20,7 @@ var gpio_viewer = module('gpio_viewer') class GPIO_viewer + var port var web var sampling_interval var pin_actual # actual value @@ -64,6 +65,7 @@ class GPIO_viewer "" def init(port) + self.port = port self.web = webserver_async(5555) self.sampling_interval = self.SAMPLING self.payload1 = bytes(100) # reserve 100 bytes by default @@ -85,9 +87,12 @@ class GPIO_viewer self.web.on("/release", self, self.send_release_page) self.web.on("/events", self, self.send_events_page) self.web.on("/", self, self.send_index_page) + + tasmota.add_driver(self) end def close() + tasmota.remove_driver(self) self.web.close() end @@ -217,15 +222,28 @@ class GPIO_viewer end end + # Add button 'GPIO Viewer' redirects to '/part_wiz?' + def web_add_button() + import webserver + var ip = tasmota.wifi().find('ip') + if (ip == nil) + ip = tasmota.eth().find('ip') + end + if (ip != nil) + webserver.content_send( + f"

") + end + end + end gpio_viewer.GPIO_viewer = GPIO_viewer if tasmota - var gpio_viewer = GPIO_viewer(5555) + global.gpioviewer = GPIO_viewer(5555) end -return gpio_viewer +return global.gpioviewer #- Test diff --git a/tasmota/berry/gpio_viewer/gpioviewer.bec b/tasmota/berry/gpio_viewer/gpioviewer.bec index bc2d96dfa4ea7b6465d613540849e0feb2b39ff0..5000b670fd33186560536a3bfe9ce172028f9944 100644 GIT binary patch delta 1022 zcmZ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