* show device name in html title #1639
* update AsyncWebserver library to `3.2.2`
This commit is contained in:
lumapu 2024-05-31 00:10:36 +02:00
parent 21416d1efd
commit 64ee494a06
11 changed files with 31 additions and 17 deletions

View file

@ -7,6 +7,8 @@
* add option to publish mqtt as json * add option to publish mqtt as json
* publish rssi not on ch0 any more, published on `topic/rssi` * publish rssi not on ch0 any more, published on `topic/rssi`
* add total power to index page (if multiple inverters are configured) * add total power to index page (if multiple inverters are configured)
* show device name in html title #1639
* update AsyncWebserver library to `3.2.2`
## 0.8.122 - 2024-05-23 ## 0.8.122 - 2024-05-23
* add button for donwloading coredump (ESP32 variants only) * add button for donwloading coredump (ESP32 variants only)

View file

@ -26,7 +26,7 @@ extra_scripts =
post:../scripts/add_littlefs_binary.py post:../scripts/add_littlefs_binary.py
lib_deps = lib_deps =
https://github.com/esphome/ESPAsyncWebServer @ ^3.2.0 https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2
https://github.com/nRF24/RF24.git#v1.4.8 https://github.com/nRF24/RF24.git#v1.4.8
paulstoffregen/Time @ ^1.6.1 paulstoffregen/Time @ ^1.6.1
https://github.com/bertmelis/espMqttClient#v1.7.0 https://github.com/bertmelis/espMqttClient#v1.7.0

View file

@ -391,6 +391,7 @@ class RestApi {
obj[F("modules")] = String(mApp->getVersionModules()); obj[F("modules")] = String(mApp->getVersionModules());
obj[F("build")] = String(AUTO_GIT_HASH); obj[F("build")] = String(AUTO_GIT_HASH);
obj[F("env")] = String(ENV_NAME); obj[F("env")] = String(ENV_NAME);
obj[F("host")] = mConfig->sys.deviceName;
obj[F("menu_prot")] = mApp->isProtected(request->client()->remoteIP().toString().c_str(), "", true); obj[F("menu_prot")] = mApp->isProtected(request->client()->remoteIP().toString().c_str(), "", true);
obj[F("menu_mask")] = (uint16_t)(mConfig->sys.protectionMask ); obj[F("menu_mask")] = (uint16_t)(mConfig->sys.protectionMask );
obj[F("menu_protEn")] = (bool) (mConfig->sys.adminPwd[0] != '\0'); obj[F("menu_protEn")] = (bool) (mConfig->sys.adminPwd[0] != '\0');
@ -418,7 +419,6 @@ class RestApi {
obj[F("dark_mode")] = (bool)mConfig->sys.darkMode; obj[F("dark_mode")] = (bool)mConfig->sys.darkMode;
obj[F("sched_reboot")] = (bool)mConfig->sys.schedReboot; obj[F("sched_reboot")] = (bool)mConfig->sys.schedReboot;
obj[F("hostname")] = mConfig->sys.deviceName;
obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0); obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0);
obj[F("prot_mask")] = mConfig->sys.protectionMask; obj[F("prot_mask")] = mConfig->sys.protectionMask;

View file

@ -143,7 +143,7 @@ function parseVersion(obj) {
function parseESP(obj) { function parseESP(obj) {
document.getElementById("esp_type").replaceChildren( document.getElementById("esp_type").replaceChildren(
document.createTextNode("Board: " + obj["esp_type"]) document.createTextNode("Board: " + obj.esp_type)
); );
} }
@ -153,7 +153,11 @@ function parseRssi(obj) {
icon = iconWifi1; icon = iconWifi1;
else if(obj["wifi_rssi"] <= -70) else if(obj["wifi_rssi"] <= -70)
icon = iconWifi2; icon = iconWifi2;
document.getElementById("wifiicon").replaceChildren(svg(icon, 32, 32, "icon-fg2", obj["wifi_rssi"])); document.getElementById("wifiicon").replaceChildren(svg(icon, 32, 32, "icon-fg2", obj.wifi_rssi));
}
function parseTitle(obj) {
document.title = obj.host + " - " + document.title
} }
function toIsoDateStr(d) { function toIsoDateStr(d) {

View file

@ -149,6 +149,7 @@
parseNav(obj.generic) parseNav(obj.generic)
parseESP(obj.generic) parseESP(obj.generic)
parseRssi(obj.generic) parseRssi(obj.generic)
parseTitle(obj.generic)
window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", obj.refresh * 1000) window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", obj.refresh * 1000)
setTimeout(() => { setTimeout(() => {
window.setInterval("getAjax('/api/powerHistoryDay', parsePowerHistoryDay)", obj.refresh * 1000) window.setInterval("getAjax('/api/powerHistoryDay', parsePowerHistoryDay)", obj.refresh * 1000)

View file

@ -57,8 +57,10 @@
} }
function parseGeneric(obj) { function parseGeneric(obj) {
if(exeOnce) if(exeOnce) {
parseESP(obj) parseESP(obj)
parseTitle(obj)
}
parseRssi(obj) parseRssi(obj)
} }

View file

@ -40,10 +40,11 @@
+ ("0"+min).substr(-2) + ":" + ("0"+min).substr(-2) + ":"
+ ("0"+sec).substr(-2); + ("0"+sec).substr(-2);
parseRssi(obj); parseRssi(obj)
if(true == exeOnce) { if(true == exeOnce) {
parseNav(obj); parseNav(obj)
parseESP(obj); parseESP(obj)
parseTitle(obj)
window.setInterval("getAjax('/api/generic', parseGeneric)", 5000); window.setInterval("getAjax('/api/generic', parseGeneric)", 5000);
exeOnce = false; exeOnce = false;
setTimeOffset(); setTimeOffset();

View file

@ -717,9 +717,10 @@
} }
function parseGeneric(obj) { function parseGeneric(obj) {
parseNav(obj); parseNav(obj)
parseESP(obj); parseESP(obj)
parseRssi(obj); parseRssi(obj)
parseTitle(obj)
if(0 != obj.cst_lnk.length) { if(0 != obj.cst_lnk.length) {
document.getElementsByName("cstLnk")[0].value = obj.cst_lnk document.getElementsByName("cstLnk")[0].value = obj.cst_lnk

View file

@ -15,9 +15,10 @@
{#HTML_FOOTER} {#HTML_FOOTER}
<script type="text/javascript"> <script type="text/javascript">
function parseGeneric(obj) { function parseGeneric(obj) {
parseNav(obj); parseNav(obj)
parseESP(obj); parseESP(obj)
parseRssi(obj); parseRssi(obj)
parseTitle(obj)
} }
function parseSysInfo(obj) { function parseSysInfo(obj) {

View file

@ -44,6 +44,7 @@
parseNav(obj) parseNav(obj)
parseESP(obj) parseESP(obj)
parseRssi(obj) parseRssi(obj)
parseTitle(obj)
env = obj.env env = obj.env
document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin" document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin"
} }

View file

@ -34,10 +34,11 @@
function parseGeneric(obj) { function parseGeneric(obj) {
if(true == exeOnce){ if(true == exeOnce){
parseNav(obj); parseNav(obj)
parseESP(obj); parseESP(obj)
parseTitle(obj)
} }
parseRssi(obj); parseRssi(obj)
} }
function numBig(val, unit, des) { function numBig(val, unit, des) {