mirror of https://github.com/arendst/Tasmota.git
Skip MQTT response if command is prefixed with underscore (#21740)
This commit is contained in:
parent
09b2670c45
commit
105a08dd20
|
@ -16,6 +16,8 @@ All notable changes to this project will be documented in this file.
|
||||||
- Berry `int64` added `low32()` and `high32()` methods, used in Matter (#21728)
|
- Berry `int64` added `low32()` and `high32()` methods, used in Matter (#21728)
|
||||||
- Matter support for 'Generic Switch' based on Tasmota Buttons (#21731)
|
- Matter support for 'Generic Switch' based on Tasmota Buttons (#21731)
|
||||||
- Berry cam module and img class (#21743)
|
- Berry cam module and img class (#21743)
|
||||||
|
- Skip MQTT response if command is prefixed with underscore (#21740)
|
||||||
|
- Skip MQTT response if commands are executed prefixed with ``Backlog2`` (no delay) or ``Backlog3`` (#21740)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
- Support for QMP6988 temperature and pressure sensor
|
- Support for QMP6988 temperature and pressure sensor
|
||||||
- Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3``
|
- Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3``
|
||||||
- Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131)
|
- Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131)
|
||||||
|
- Skip MQTT response if command is prefixed with underscore [#21740](https://github.com/arendst/Tasmota/issues/21740)
|
||||||
|
- Skip MQTT response if commands are executed prefixed with ``Backlog2`` (no delay) or ``Backlog3`` [#21740](https://github.com/arendst/Tasmota/issues/21740)
|
||||||
- Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages [#21574](https://github.com/arendst/Tasmota/issues/21574)
|
- Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages [#21574](https://github.com/arendst/Tasmota/issues/21574)
|
||||||
- NeoPool data validation and communication statistics default enabled for ESP32 only [#21721](https://github.com/arendst/Tasmota/issues/21721)
|
- NeoPool data validation and communication statistics default enabled for ESP32 only [#21721](https://github.com/arendst/Tasmota/issues/21721)
|
||||||
- ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase [#21695](https://github.com/arendst/Tasmota/issues/21695)
|
- ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase [#21695](https://github.com/arendst/Tasmota/issues/21695)
|
||||||
|
|
|
@ -374,7 +374,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char stemp1[TOPSZ];
|
char stemp1[TOPSZ];
|
||||||
GetFallbackTopic_P(stemp1, ""); // Full Fallback topic = cmnd/DVES_xxxxxxxx_fb/
|
GetFallbackTopic_P(stemp1, ""); // Full Fallback topic = cmnd/DVES_xxxxxxxx_fb/
|
||||||
TasmotaGlobal.fallback_topic_flag = (!strncmp(topicBuf, stemp1, strlen(stemp1)));
|
TasmotaGlobal.fallback_topic_flag = (!strncmp(topicBuf, stemp1, strlen(stemp1)));
|
||||||
|
|
||||||
char *type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type)
|
char *type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type)
|
||||||
|
@ -384,13 +384,13 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
|
||||||
if (type != nullptr) {
|
if (type != nullptr) {
|
||||||
type++;
|
type++;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int nLen; // strlen(type)
|
int nLen; // strlen(type)
|
||||||
char *s = type;
|
char *s = type;
|
||||||
for (nLen = 0; *s; s++, nLen++) {
|
for (nLen = 0; *s; s++, nLen++) {
|
||||||
*s=toupper(*s);
|
*s=toupper(*s);
|
||||||
}
|
}
|
||||||
i = nLen;
|
i = nLen;
|
||||||
if (i > 0) { // may be 0
|
if (i > 0) { // may be 0
|
||||||
while (isdigit(type[i-1])) {
|
while (isdigit(type[i-1])) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -400,13 +400,17 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
|
||||||
user_index = true;
|
user_index = true;
|
||||||
}
|
}
|
||||||
type[i] = '\0';
|
type[i] = '\0';
|
||||||
|
if ((i > 1) && ('_' == type[0])) {
|
||||||
|
type++; // Skip leading _ in command
|
||||||
|
TasmotaGlobal.no_mqtt_response = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool binary_data = (index > 299); // Suppose binary data on topic index > 299
|
bool binary_data = (index > 299); // Suppose binary data on topic index > 299
|
||||||
if (!binary_data) {
|
if (!binary_data) {
|
||||||
bool keep_spaces = ((strstr_P(type, PSTR("SERIALSEND")) != nullptr) && (index > 9)); // Do not skip leading spaces on (s)serialsend10 and up
|
bool keep_spaces = ((strstr_P(type, PSTR("SERIALSEND")) != nullptr) && (index > 9)); // Do not skip leading spaces on (s)serialsend10 and up
|
||||||
if (!keep_spaces) {
|
if (!keep_spaces) {
|
||||||
while (*dataBuf && isspace(*dataBuf)) {
|
while (*dataBuf && isspace(*dataBuf)) {
|
||||||
dataBuf++; // Skip leading spaces in data
|
dataBuf++; // Skip leading spaces in data
|
||||||
data_len--;
|
data_len--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue