fix(shelly): fix BLE variable overwriting bug in checkBlu

This commit is contained in:
Moritz Graf 2026-07-03 11:54:23 +02:00
parent be7dcc97bc
commit 3f7c501340
1 changed files with 26 additions and 10 deletions

View File

@ -136,19 +136,35 @@ function checkBlu(event) {
}
if (addr === aussen) {
temperatur_aussen = event.temperature;
humidity_aussen = event.humidity;
taupunkt_aussen = taupunkt(event.temperature, event.humidity);
battery_aussen = event.battery;
if (typeof event.temperature !== "undefined") {
temperatur_aussen = event.temperature;
}
if (typeof event.humidity !== "undefined") {
humidity_aussen = event.humidity;
}
if (typeof temperatur_aussen !== "undefined" && typeof humidity_aussen !== "undefined") {
taupunkt_aussen = taupunkt(temperatur_aussen, humidity_aussen);
}
if (typeof event.battery !== "undefined") {
battery_aussen = event.battery;
}
lost_connection_aussen = 0;
print("Neue Werte für Außen:", temperatur_aussen, "°C,", humidity_aussen, "%, Tp:", taupunkt_aussen, "°C, Batt: ", battery_aussen, " % ");
print("Neue Werte für Außen: T=", temperatur_aussen, "°C, RH=", humidity_aussen, "%, Tp=", taupunkt_aussen, "°C, Batt=", battery_aussen, "%");
} else if (addr === innen) {
temperatur_innen = event.temperature;
humidity_innen = event.humidity;
taupunkt_innen = taupunkt(event.temperature, event.humidity);
battery_innen = event.battery;
if (typeof event.temperature !== "undefined") {
temperatur_innen = event.temperature;
}
if (typeof event.humidity !== "undefined") {
humidity_innen = event.humidity;
}
if (typeof temperatur_innen !== "undefined" && typeof humidity_innen !== "undefined") {
taupunkt_innen = taupunkt(temperatur_innen, humidity_innen);
}
if (typeof event.battery !== "undefined") {
battery_innen = event.battery;
}
lost_connection_innen = 0;
print("Neue Werte für Innen:", temperatur_innen, "°C,", humidity_innen, "%, Tp:", taupunkt_innen, "°C, Batt: " , battery_innen, " % ");
print("Neue Werte für Innen: T=", temperatur_innen, "°C, RH=", humidity_innen, "%, Tp=", taupunkt_innen, "°C, Batt=", battery_innen, "%");
}
}