Add entered command to MQTT command unknown message

This commit is contained in:
Theo Arends 2024-09-17 10:00:47 +02:00
parent 97970974fc
commit fd7d2fc0a4
3 changed files with 13 additions and 13 deletions

View File

@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Refactored I2C drivers HTU21, BH1750 and HYT
- Add entered command to MQTT command unknown message
### Fixed
- Shutter missing HOLD on shutterbutton (#22108)

View File

@ -144,6 +144,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- ESP32 platform update from 2024.08.10 to 2024.08.11 [#22021](https://github.com/arendst/Tasmota/issues/22021)
- ESP32 LVGL library from v9.1.0 to v9.2.0 [#22031](https://github.com/arendst/Tasmota/issues/22031)
- GPIOViewer from v1.5.5 to v1.5.6
- Add entered command to MQTT command unknown message
- Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
- Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power [#20653](https://github.com/arendst/Tasmota/issues/20653)
- Refactored I2C drivers HTU21, BH1750 and HYT

View File

@ -379,6 +379,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
char *type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type)
bool command_unknown = false;
uint32_t index = 1;
bool user_index = false;
if (type != nullptr) {
@ -448,32 +449,29 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
XdrvMailbox.data = dataBuf;
#ifdef USE_SCRIPT_SUB_COMMAND
// allow overwrite tasmota cmds
if (!Script_SubCmd()) {
if (!Script_SubCmd()) { // Allow override tasmota cmds
#endif // USE_SCRIPT_SUB_COMMAND
if (!DecodeCommand(kTasmotaCommands, TasmotaCommand, kTasmotaSynonyms)) {
if (!XdrvCall(FUNC_COMMAND)) {
if (!XsnsCall(FUNC_COMMAND)) {
type = nullptr; // Unknown command
command_unknown = true; // Unknown command
}
}
}
}
#else // USE_SCRIPT_SUB_COMMAND
if (!DecodeCommand(kTasmotaCommands, TasmotaCommand, kTasmotaSynonyms)) {
if (!XdrvCall(FUNC_COMMAND)) {
if (!XsnsCall(FUNC_COMMAND)) {
type = nullptr; // Unknown command
}
}
#ifdef USE_SCRIPT_SUB_COMMAND
}
#endif // USE_SCRIPT_SUB_COMMAND
} else { // type = nullptr
stemp1[0] = '\0';
type = (char*)stemp1;
command_unknown = true; // Unknown command
}
if (type == nullptr) {
if (command_unknown) {
TasmotaGlobal.blinks = 201;
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"%s%s" D_JSON_UNKNOWN "\"}"), type, (strlen(type))?" ":"");
snprintf_P(stemp1, sizeof(stemp1), PSTR(D_JSON_COMMAND));
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_UNKNOWN "\"}"));
type = (char*)stemp1;
}