From 86408b3452846a736753000271aaee57eb91d152 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:06:31 +0100 Subject: [PATCH 01/10] package update --- interface/package.json | 2 +- interface/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/package.json b/interface/package.json index f286eb364..fd8ee3d64 100644 --- a/interface/package.json +++ b/interface/package.json @@ -35,7 +35,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "react-icons": "^5.4.0", - "react-router": "^7.1.2", + "react-router": "^7.1.3", "react-toastify": "^11.0.3", "typesafe-i18n": "^5.26.2", "typescript": "^5.7.3" diff --git a/interface/yarn.lock b/interface/yarn.lock index 82ff340c6..4c4190a9e 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1615,7 +1615,7 @@ __metadata: react: "npm:^19.0.0" react-dom: "npm:^19.0.0" react-icons: "npm:^5.4.0" - react-router: "npm:^7.1.2" + react-router: "npm:^7.1.3" react-toastify: "npm:^11.0.3" rollup-plugin-visualizer: "npm:^5.14.0" terser: "npm:^5.37.0" @@ -5607,9 +5607,9 @@ __metadata: languageName: node linkType: hard -"react-router@npm:^7.1.2": - version: 7.1.2 - resolution: "react-router@npm:7.1.2" +"react-router@npm:^7.1.3": + version: 7.1.3 + resolution: "react-router@npm:7.1.3" dependencies: "@types/cookie": "npm:^0.6.0" cookie: "npm:^1.0.1" @@ -5621,7 +5621,7 @@ __metadata: peerDependenciesMeta: react-dom: optional: true - checksum: 10c0/f2ef57c8c95cfee0c0689cbcb9a28ebbc5a554831b9e8f9d0295f4c6ac0960a448e16b828dd75168b4e8da228068c99d88248be3418467d6a76ab4ea02bf0d71 + checksum: 10c0/f42f7b245533d1adaa00779a0287993a836d5b56039d97a6643a8b3a721ffb92ff47c97cfb36409fec8794ac3c8a884339f588cf21fcd7f6dccdfc834520c76f languageName: node linkType: hard From 8685ffb1bf8a0dca161adec2d8316cfddcd311d4 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:06:54 +0100 Subject: [PATCH 02/10] update Tasmota platform (for testing 3.x) --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 911d9c031..e75b3b384 100644 --- a/platformio.ini +++ b/platformio.ini @@ -95,8 +95,8 @@ platform = espressif32@6.9.0 ; Arduino Core 2.0.18 / IDF 4.4.8 framework = arduino board_build.partitions = partitions/esp32_partition_4M.csv board_upload.flash_size = 4MB -platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.00/platform-espressif32.zip ; Arduino Core 2.0.18 with IPv6 support, based on IDF 4.4.8 -; platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.12.30/platform-espressif32.zip ; Arduino Core 3.1.0.241206 based on IDF 5.3.2 +platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.00/platform-espressif32.zip ; Arduino Core 2.0.18 with IPv6 support, based on IDF 4.4.8 +; platform = https://github.com/tasmota/platform-espressif32/releases/download/2025.01.31/platform-espressif32.zip ; Arduino Core 3.1.1, based on IDF 5.3.2 ; use Tasmota's library for 16MB Flash variants. ; Removes libs (like mbedtsl, so no WiFi_secure.h) to increase available heap From 4d3cafcf29d11e1a2ca669eb32d4c6b35743d6ae Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:07:05 +0100 Subject: [PATCH 03/10] fix DASHBOARD_1 in DE --- interface/src/i18n/de/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index fae5cf18a..341b4f19c 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -343,7 +343,7 @@ const de: Translation = { DEVELOPER_MODE: 'Entwicklermodus', DUPLICATE: 'Kopieren', UPGRADE: 'Aktualisieren', - DASHBOARD_1: 'All EMS entities that are active and marked as Favorite, plus all Custom Entities, Schedules and external Sensors data are displayed below.', // TODO translate + DASHBOARD_1: 'Alle EMS-Entitäten, die aktiv und als Favorit markiert sind, sowie alle benutzerdefinierten Entitäten, Zeitpläne und externen Sensordaten werden unten angezeigt.', NO_DATA_1: 'Keine favorisierten EMS-Entitäten gefunden! Verwenden Sie das Modul', NO_DATA_2: ', um sie zu markieren.', NO_DATA_3: 'Um alle verfügbaren Entitäten anzuzeigen, gehen Sie zu' From 2d9ea3ee8d4a42626f77c095835ace8590668359 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:07:18 +0100 Subject: [PATCH 04/10] show CPU temp in C or F --- interface/src/app/status/HardwareStatus.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/app/status/HardwareStatus.tsx b/interface/src/app/status/HardwareStatus.tsx index 27b31a9c8..65b599688 100644 --- a/interface/src/app/status/HardwareStatus.tsx +++ b/interface/src/app/status/HardwareStatus.tsx @@ -99,7 +99,8 @@ const HardwareStatus = () => { ' @ ' + data.cpu_freq_mhz + ' Mhz' + - (data.temperature ? ', T: ' + data.temperature + ' °C' : '') + // bit of a hack : if the CPU temp is higher than 90 (=32 Fahrenheit if using Celsius), show F, otherwise C + (data.temperature ? ', T: ' + data.temperature + ' °' + (data.temperature > 90 ? 'F' : 'C') : '') } /> From db90546bc3c865802a1e15ede9af4aa94127ba58 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:07:41 +0100 Subject: [PATCH 05/10] transformNumFloat with default values --- src/web/WebCustomEntityService.cpp | 10 +++++----- src/web/WebDataService.cpp | 8 ++++---- src/web/WebStatusService.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/web/WebCustomEntityService.cpp b/src/web/WebCustomEntityService.cpp index 49ca51f46..6ff441e39 100644 --- a/src/web/WebCustomEntityService.cpp +++ b/src/web/WebCustomEntityService.cpp @@ -517,25 +517,25 @@ void WebCustomEntityService::generate_value_web(JsonObject output, const bool is } case DeviceValueType::INT8: if ((int8_t)entity.value != EMS_VALUE_INT8_NOTSET) { - obj["v"] = Helpers::transformNumFloat(entity.factor * (int8_t)entity.value, 0); + obj["v"] = Helpers::transformNumFloat(entity.factor * (int8_t)entity.value); include = true; } break; case DeviceValueType::UINT8: if ((uint8_t)entity.value != EMS_VALUE_UINT8_NOTSET) { - obj["v"] = Helpers::transformNumFloat(entity.factor * (uint8_t)entity.value, 0); + obj["v"] = Helpers::transformNumFloat(entity.factor * (uint8_t)entity.value); include = true; } break; case DeviceValueType::INT16: if ((int16_t)entity.value != EMS_VALUE_INT16_NOTSET) { - obj["v"] = Helpers::transformNumFloat(entity.factor * (int16_t)entity.value, 0); + obj["v"] = Helpers::transformNumFloat(entity.factor * (int16_t)entity.value); include = true; } break; case DeviceValueType::UINT16: if ((uint16_t)entity.value != EMS_VALUE_UINT16_NOTSET) { - obj["v"] = Helpers::transformNumFloat(entity.factor * (uint16_t)entity.value, 0); + obj["v"] = Helpers::transformNumFloat(entity.factor * (uint16_t)entity.value); include = true; } break; @@ -543,7 +543,7 @@ void WebCustomEntityService::generate_value_web(JsonObject output, const bool is case DeviceValueType::TIME: case DeviceValueType::UINT32: if (entity.value != EMS_VALUE_UINT24_NOTSET) { - obj["v"] = Helpers::transformNumFloat(entity.factor * entity.value, 0); + obj["v"] = Helpers::transformNumFloat(entity.factor * entity.value); include = true; } break; diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index bd4580add..0abd8b1ef 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -145,7 +145,7 @@ void WebDataService::sensor_data(AsyncWebServerRequest * request) { obj["t"] = sensor.type(); if (sensor.type() != AnalogSensor::AnalogType::NOTUSED) { - obj["v"] = Helpers::transformNumFloat(sensor.value(), 0); // is optional and is a float + obj["v"] = Helpers::transformNumFloat(sensor.value()); // is optional and is a float } else { obj["v"] = 0; // must have a value for web sorting to work } @@ -423,11 +423,11 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) { dv["id"] = "00" + sensor.name(); #if CONFIG_IDF_TARGET_ESP32 if (sensor.type() == AnalogSensor::AnalogType::DIGITAL_OUT && (sensor.gpio() == 25 || sensor.gpio() == 26)) { - obj["v"] = Helpers::transformNumFloat(sensor.value(), 0); + obj["v"] = Helpers::transformNumFloat(sensor.value()); } else #elif CONFIG_IDF_TARGET_ESP32S2 if (sensor.type() == AnalogSensor::AnalogType::DIGITAL_OUT && (sensor.gpio() == 17 || sensor.gpio() == 18)) { - obj["v"] = Helpers::transformNumFloat(sensor.value(), 0); + obj["v"] = Helpers::transformNumFloat(sensor.value()); } else #endif if (sensor.type() == AnalogSensor::AnalogType::DIGITAL_OUT || sensor.type() == AnalogSensor::AnalogType::DIGITAL_IN) { @@ -437,7 +437,7 @@ void WebDataService::dashboard_data(AsyncWebServerRequest * request) { l.add(Helpers::render_boolean(s, false, true)); l.add(Helpers::render_boolean(s, true, true)); } else { - dv["v"] = Helpers::transformNumFloat(sensor.value(), 0); + dv["v"] = Helpers::transformNumFloat(sensor.value()); dv["u"] = sensor.uom(); } if (sensor.type() == AnalogSensor::AnalogType::COUNTER || sensor.type() >= AnalogSensor::AnalogType::DIGITAL_OUT) { diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 0000c39cb..4014b9edc 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -130,8 +130,8 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { root["free_psram"] = ESP.getFreePsram() / 1024; } root["model"] = EMSESP::system_.getBBQKeesGatewayDetails(); -#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 - root["temperature"] = EMSESP::system_.temperature(); +#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 + root["temperature"] = Helpers::transformNumFloat(EMSESP::system_.temperature(), 0, EMSESP::system_.fahrenheit() ? 2 : 0); // only 2 decimal places #endif // check for a factory partition first From a5e5ec5098d128bbd085a1e3f193888abd448a7b Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:07:57 +0100 Subject: [PATCH 06/10] transformNumFloat with default values --- src/core/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/helpers.h b/src/core/helpers.h index 1758f2dee..144653018 100644 --- a/src/core/helpers.h +++ b/src/core/helpers.h @@ -51,7 +51,7 @@ class Helpers { static uint16_t string2minutes(const std::string & str); static float numericoperator2scalefactor(int8_t numeric_operator); - static double transformNumFloat(double value, const int8_t numeric_operator, const uint8_t fahrenheit = 0); + static double transformNumFloat(double value, const int8_t numeric_operator = 0, const uint8_t fahrenheit = 0); static std::string toLower(std::string const & s); static std::string toUpper(std::string const & s); From 9f2485194845dddf80a6c105895a6af9b8bf7b9c Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:08:04 +0100 Subject: [PATCH 07/10] add comments --- src/core/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/helpers.cpp b/src/core/helpers.cpp index dce45b27f..95b2b366e 100644 --- a/src/core/helpers.cpp +++ b/src/core/helpers.cpp @@ -33,7 +33,7 @@ char * Helpers::hextoa(char * result, const uint8_t value) { return result; } -// same as above but to a hex string +// same as hextoa but uses to a hex std::string std::string Helpers::hextoa(const uint8_t value, bool prefix) { char buf[3]; if (prefix) { From 462d865fc97c522303fe51485b9f198061e16475 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:08:26 +0100 Subject: [PATCH 08/10] implement CPU temp for ESP32 --- src/core/system.cpp | 5 ++++- src/core/system.h | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index 44e51453f..18d00f245 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -789,7 +789,10 @@ void System::system_check() { last_system_check_ = uuid::get_uptime(); #ifndef EMSESP_STANDALONE -#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 +#if defined(CONFIG_IDF_TARGET_ESP32) + uint8_t raw = temprature_sens_read(); + temperature_ = (raw - 32) / 1.8f; // convert to Celsius +#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 #if ESP_IDF_VERSION_MAJOR < 5 temp_sensor_read_celsius(&temperature_); #else diff --git a/src/core/system.h b/src/core/system.h index 35db0cd83..746803a35 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -39,7 +39,12 @@ #include #include -#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 +#if defined(CONFIG_IDF_TARGET_ESP32) +// there is no official API available on the original ESP32 +extern "C" { +uint8_t temprature_sens_read(); +} +#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 #if ESP_IDF_VERSION_MAJOR < 5 #include "driver/temp_sensor.h" #else @@ -331,7 +336,7 @@ class System { test_set_all_active_ = n; } -#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 +#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 float temperature() { return temperature_; } @@ -435,8 +440,8 @@ class System { #if ESP_IDF_VERSION_MAJOR >= 5 temperature_sensor_handle_t temperature_handle_ = NULL; #endif - float temperature_ = 0; #endif + float temperature_ = 0; }; } // namespace emsesp From 648675d002ceee06ec6a68a62f6276b513481bce Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:10:44 +0100 Subject: [PATCH 09/10] auto-formatting --- interface/src/app/status/HardwareStatus.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/src/app/status/HardwareStatus.tsx b/interface/src/app/status/HardwareStatus.tsx index 65b599688..681ac0a47 100644 --- a/interface/src/app/status/HardwareStatus.tsx +++ b/interface/src/app/status/HardwareStatus.tsx @@ -100,7 +100,12 @@ const HardwareStatus = () => { data.cpu_freq_mhz + ' Mhz' + // bit of a hack : if the CPU temp is higher than 90 (=32 Fahrenheit if using Celsius), show F, otherwise C - (data.temperature ? ', T: ' + data.temperature + ' °' + (data.temperature > 90 ? 'F' : 'C') : '') + (data.temperature + ? ', T: ' + + data.temperature + + ' °' + + (data.temperature > 90 ? 'F' : 'C') + : '') } /> From 9a7f7fa1d58e084d8ad8bc87f5f19732c71a185e Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 18 Jan 2025 16:12:59 +0100 Subject: [PATCH 10/10] updated --- CHANGELOG_LATEST.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 9261a08d7..548d02dd5 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -14,6 +14,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - thermostat `reduce threshold` [#2288](https://github.com/emsesp/EMS-ESP32/issues/2288) - thermostat `absent` [#1957](https://github.com/emsesp/EMS-ESP32/issues/1957) - CR11 thermostat [#2295](https://github.com/emsesp/EMS-ESP32/issues/2295) +- Show ESP32's CPU temp in Hardware Status ## Fixed