mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
WebUI status line Berry tapp for Wifi and Free Heap (#23358)
This commit is contained in:
parent
736d4d6576
commit
f72a989976
BIN
tasmota/berry/modules/Webui_Status.tapp
Normal file
BIN
tasmota/berry/modules/Webui_Status.tapp
Normal file
Binary file not shown.
3
tasmota/berry/modules/webui_status/autoexec.be
Normal file
3
tasmota/berry/modules/webui_status/autoexec.be
Normal file
@ -0,0 +1,3 @@
|
||||
# rm Webui_Status.tapp; zip -j -0 Webui_Status.tapp webui_status/*
|
||||
import webui_status
|
||||
global._webui_status = webui_status
|
37
tasmota/berry/modules/webui_status/webui_status.be
Normal file
37
tasmota/berry/modules/webui_status/webui_status.be
Normal file
@ -0,0 +1,37 @@
|
||||
# display Wifi and Free Heap in the Web Status line
|
||||
class webui_status
|
||||
static var HTTP_HEAD_STYLE_WIFI =
|
||||
"<style>"
|
||||
".wifi{width:18px;height:18px;position:relative}"
|
||||
".arc{padding:0;position:absolute;border:2px solid transparent;border-radius:50%%;border-top-color:%s}"
|
||||
".a0{width:2px;height:3px;top:10px;left:11px}"
|
||||
".a1{width:6px;height:6px;top:7px;left:9px}"
|
||||
".a2{width:12px;height:12px;top:4px;left:6px}"
|
||||
".a3{width:18px;height:18px;top:1px;left:3px}"
|
||||
".arc.active{border-top-color:%s}"
|
||||
"</style>"
|
||||
|
||||
def init()
|
||||
tasmota.add_driver(self)
|
||||
end
|
||||
|
||||
def remove()
|
||||
tasmota.remove_driver(self)
|
||||
end
|
||||
def web_status_line_left()
|
||||
import webserver
|
||||
# display wifi
|
||||
if tasmota.wifi('up')
|
||||
webserver.content_send(format(self.HTTP_HEAD_STYLE_WIFI, tasmota.webcolor(2 #-COL_FORM-#), tasmota.webcolor(18 #-COL_TITLE-#)))
|
||||
var rssi = tasmota.wifi('rssi')
|
||||
webserver.content_send(format("<div class='wifi' title='RSSI %d%%, %d dBm' style='padding:0 2px 0 2px;'><div class='arc a3 %s'></div><div class='arc a2 %s'></div><div class='arc a1 %s'></div><div class='arc a0 active'></div></div>",
|
||||
tasmota.wifi('quality'), rssi,
|
||||
rssi >= -55 ? "active" : "",
|
||||
rssi >= -70 ? "active" : "",
|
||||
rssi >= -85 ? "active" : ""))
|
||||
end
|
||||
# display free heap
|
||||
webserver.content_send(f"<span> {tasmota.memory('heap_free')}k</span>")
|
||||
end
|
||||
end
|
||||
return webui_status()
|
Loading…
x
Reference in New Issue
Block a user