From 187b163ffda3263edf45f7192bf50a19d90a69ba Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 14 Oct 2025 18:56:19 +0200 Subject: [PATCH] add testdata, use selRoomTemp for climate --- src/core/emsdevice.cpp | 2 +- src/core/mqtt.cpp | 8 ++++---- src/test/test.cpp | 20 ++++++++++++++++++++ src/test/test.h | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/core/emsdevice.cpp b/src/core/emsdevice.cpp index d94cea415..36992c1e8 100644 --- a/src/core/emsdevice.cpp +++ b/src/core/emsdevice.cpp @@ -1902,7 +1902,7 @@ void EMSdevice::mqtt_ha_entity_config_create() { count++; } // SRC thermostats mapped to connect/src1/... - if (dv.tag >= DeviceValueTAG::TAG_SRC1 && dv.tag <= DeviceValueTAG::TAG_SRC16 && !strcmp(dv.short_name, FL_(roomTemp)[0])) { + if (dv.tag >= DeviceValueTAG::TAG_SRC1 && dv.tag <= DeviceValueTAG::TAG_SRC16 && !strcmp(dv.short_name, FL_(selRoomTemp)[0])) { Mqtt::publish_ha_climate_config(dv.tag, true, false, dv.min, dv.max); } diff --git a/src/core/mqtt.cpp b/src/core/mqtt.cpp index 8e5c40032..130838116 100644 --- a/src/core/mqtt.cpp +++ b/src/core/mqtt.cpp @@ -1240,10 +1240,10 @@ void Mqtt::add_ha_classes(JsonObject doc, const uint8_t device_type, const uint8 } bool Mqtt::publish_ha_climate_config(const int8_t tag, const bool has_roomtemp, const bool remove, const int16_t min, const uint32_t max) { - uint8_t hc_num = tag < DeviceValueTAG::TAG_SRC1 ? tag : tag - DeviceValueTAG::TAG_SRC1 + 1; - const char * tagname = tag < DeviceValueTAG::TAG_SRC1 ? "hc" : "src"; - const uint device_type = tag < DeviceValueTAG::TAG_SRC1 ? EMSdevice::DeviceType::THERMOSTAT : EMSdevice::DeviceType::CONNECT; - const char * devicename = EMSdevice::device_type_2_device_name(device_type); + uint8_t hc_num = tag < DeviceValueTAG::TAG_SRC1 ? tag : tag - DeviceValueTAG::TAG_SRC1 + 1; + const char * tagname = tag < DeviceValueTAG::TAG_SRC1 ? "hc" : "src"; + const uint8_t device_type = tag < DeviceValueTAG::TAG_SRC1 ? EMSdevice::DeviceType::THERMOSTAT : EMSdevice::DeviceType::CONNECT; + const char * devicename = EMSdevice::device_type_2_device_name(device_type); char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; char topic_t[Mqtt::MQTT_TOPIC_MAX_SIZE]; diff --git a/src/test/test.cpp b/src/test/test.cpp index ac46e17ae..59927e424 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -260,6 +260,26 @@ bool Test::test(const std::string & cmd, int8_t id1, int8_t id2) { return true; } + if (cmd == "src") { + EMSESP::logger().notice("Adding SRC plus thermostat..."); + + add_device(0x50, 17); // MX400 module + uart_telegram("50 00 FF 00 0A DD 00 E6 36 2A"); // monitor, temperatures + uart_telegram("50 00 FF 00 0A B5 00 FF 00 24 01 FF 24 00"); // mode, childlock + // switchprogram + uart_telegram("50 00 FF 00 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 12 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 24 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 36 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 48 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 5A 0A 65 2A 00 3C 2A FF FF 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + uart_telegram("50 00 FF 6C 0A 65 2A 00 3C 20 01 08 2A FF FF 2A FF FF 2A FF FF 2A FF FF"); + // icon ,name + uart_telegram("50 00 FF 00 0A 3D 01 00 4B 00 FC 00 63 00 68 00 65 00 00 00 00 00 00 00 00 00"); + + return true; + } + #endif return false; diff --git a/src/test/test.h b/src/test/test.h index 952730d6a..77e1da771 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -63,6 +63,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "upload" // #define EMSESP_DEBUG_DEFAULT "hpmode" #define EMSESP_DEBUG_DEFAULT "shuntingyard" +// #define EMSESP_DEBUG_DEFAULT "src" #ifndef EMSESP_DEBUG_DEFAULT #define EMSESP_DEBUG_DEFAULT "general"