From a6a8214ea7ca3fef365070f2c806f3aaa3e78f18 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 23 Dec 2023 16:13:13 +0100 Subject: [PATCH] Fix support for Domoticz floor/room topics Fix support for Domoticz floor/room topics. Regression from v12.0.1 (#20299) --- CHANGELOG.md | 1 + RELEASENOTES.md | 2 ++ .../tasmota_xdrv_driver/xdrv_07_domoticz.ino | 20 ++++++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b85a015..2a7795908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. - CVE-2021-36603 Cross Site Scripting (XSS) vulnerability (#12221) - ESP32 piezo ceramic buzzer doesn't buzz (#20118) - Syslog server warning caused by lack of field and hostname starting with 'z' (#14689) +- Support for Domoticz floor/room topics. Regression from v12.0.1 (#20299) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 52c7e1e08..dba6bb153 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -121,6 +121,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Support for CST816S touch interface [#20213](https://github.com/arendst/Tasmota/issues/20213) - Support for Sonoff Basic R4 Magic Switch [#20247](https://github.com/arendst/Tasmota/issues/20247) - NeoPool hydrolysis FL1 and Redox flag [#20258](https://github.com/arendst/Tasmota/issues/20258) +- Matter support for password for remote Tasmota devices [#20296](https://github.com/arendst/Tasmota/issues/20296) ### Breaking Changed - Refactoring of Berry `animate` module for WS2812 Leds [#20236](https://github.com/arendst/Tasmota/issues/20236) @@ -131,6 +132,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Fixed - CVE-2021-36603 Cross Site Scripting (XSS) vulnerability [#12221](https://github.com/arendst/Tasmota/issues/12221) - Syslog server warning caused by lack of field and hostname starting with 'z' [#14689](https://github.com/arendst/Tasmota/issues/14689) +- Support for Domoticz floor/room topics. Regression from v12.0.1 [#20299](https://github.com/arendst/Tasmota/issues/20299) - ESP32 piezo ceramic buzzer doesn't buzz [#20118](https://github.com/arendst/Tasmota/issues/20118) - Matter Contact sensor was not triggering any update [#20232](https://github.com/arendst/Tasmota/issues/20232) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino index d3e18c4d0..2994eeafc 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino @@ -218,14 +218,18 @@ bool DomoticzMqttData(void) { return true; // No valid data } - int32_t relay_index = -1; +// char dom_data[XdrvMailbox.data_len +1]; +// strcpy(dom_data, XdrvMailbox.data); +// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "Topic '%s', Data '%s'"), XdrvMailbox.topic, RemoveControlCharacter(dom_data)); // Quick check if this is mine using topic domoticz/out/{$idx} if (strlen(XdrvMailbox.topic) > strlen(DOMOTICZ_OUT_TOPIC)) { char* topic_index = &XdrvMailbox.topic[strlen(DOMOTICZ_OUT_TOPIC) +1]; - relay_index = DomoticzIdx2Relay(atoi(topic_index)); - if (relay_index < 0) { - return true; // Idx not mine + int32_t top_index = atoi(topic_index); // 0 if no number (in case of domoticz/out/floor/room) + if (top_index > 0) { + if (DomoticzIdx2Relay(top_index) < 0) { + return true; // Idx not mine + } } } @@ -235,18 +239,16 @@ bool DomoticzMqttData(void) { if (!domoticz) { return true; // To much or invalid data } + int32_t relay_index = DomoticzIdx2Relay(domoticz.getUInt(PSTR("idx"), 0)); if (relay_index < 0) { - relay_index = DomoticzIdx2Relay(domoticz.getUInt(PSTR("idx"), 0)); - if (relay_index < 0) { - return true; // Idx not mine - } + return true; // Idx not mine } int32_t nvalue = domoticz.getInt(PSTR("nvalue"), -1); if ((nvalue < 0) || (nvalue > 16)) { return true; // Nvalue out of boundaries } - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), Settings->domoticz_relay_idx[relay_index], nvalue); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "Topic %s, idx %d, nvalue %d"), XdrvMailbox.topic, Settings->domoticz_relay_idx[relay_index], nvalue); bool iscolordimmer = (strcmp_P(domoticz.getStr(PSTR("dtype")), PSTR("Color Switch")) == 0); bool isShutter = (strcmp_P(domoticz.getStr(PSTR("dtype")), PSTR("Light/Switch")) == 0) && (strncmp_P(domoticz.getStr(PSTR("switchType")),PSTR("Blinds"), 6) == 0);