From e32ef693916d973f57e51b5fbe84158623a9acad Mon Sep 17 00:00:00 2001 From: choibk Date: Fri, 14 Nov 2025 11:07:45 +0900 Subject: [PATCH] R_1_0_24 --- README.md | 11 +++++++++-- src/main.cpp | 12 +++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d8fb85..d5ca544 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ #### House Control -##### Version == R 1.0.23 +##### Version == R 1.0.24 1. OTA * https://esp32.qmsguide.synology.me * /housecontrol.txt + * .bin 파일 위치 == .pio/build/esp32dev/firmware.bin 2. 태양광 발전 및 LED 전등 제어 - 태양광 발전량 모니터링 @@ -48,4 +49,10 @@ - 11 / 10 == Relay 1 ON / OFF (Relay 2 는 Realy 1 과 항상 동기) - 31 / 30 == Relay 3 ON / OFF - - 100 == OTA Update Command \ No newline at end of file + - 100 == OTA Update Command + +##### Version History +###### R 1.0.24 +* 수정 + * 온습도 MQTT 발행 누락 수정 + diff --git a/src/main.cpp b/src/main.cpp index f2d5bc1..ff4024c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ #include "esp_sleep.h" #include "esp_wifi.h" // esp_wifi_set_ps -#define CURRENT_VERSION "R_1_0_23" +#define CURRENT_VERSION "R_1_0_24" // ---------- Low Power ---------- #define LOW_POWER_MODE 1 @@ -567,6 +567,9 @@ static inline void i2c_error_report_1s() { /* ----------------------------- Publish Status ----------------------------- */ void publishStatus() { + // ★ MD04 온습도 최신값 폴링 (내부에서 주기 제한: MD04_POLL_MS) + md04_poll_if_due(); + // I2C 상태 점검 & 복구 if (millis() - lastI2cCheckMs > 2000) { lastI2cCheckMs = millis(); @@ -690,6 +693,13 @@ void publishStatus() { doc["dwh1"] = roundf(dailyWh1 * 10000) / 10000.0f; doc["dwh2"] = roundf(dailyWh2 * 10000) / 10000.0f; + // ★ MD04 온습도 (소수 1자리로 반올림) + if (isfinite(md04_airT)) doc["airT"] = roundf(md04_airT * 10) / 10.0f; + else doc["airT"] = nullptr; + + if (isfinite(md04_airH)) doc["airH"] = roundf(md04_airH * 10) / 10.0f; + else doc["airH"] = nullptr; + char buffer[768]; size_t len = serializeJson(doc, buffer); digitalWrite(LED_TX, HIGH);