Enable group status messages

Add status message to former declined group commands (#5145)
This commit is contained in:
Theo Arends 2019-02-09 13:37:27 +01:00
parent ab11096f3a
commit 3a59084377
3 changed files with 9 additions and 8 deletions

View File

@ -2,6 +2,7 @@
* Change image name BE_MINIMAL to FIRMWARE_MINIMAL (#5106)
* Change image names USE_xyz to FIRMWARE_xyz (#5106)
* Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131)
* Add status message to former declined group commands (#5145)
*
* 6.4.1.14 20190203
* Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name

View File

@ -1126,8 +1126,8 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_ASTERIX, command, index);
}
}
else if ((CMND_HOSTNAME == command_code) && !grpflg) {
if ((data_len > 0) && (data_len < sizeof(Settings.hostname))) {
else if (CMND_HOSTNAME == command_code) {
if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.hostname))) {
strlcpy(Settings.hostname, (SC_DEFAULT == Shortcut(dataBuf)) ? WIFI_HOSTNAME : dataBuf, sizeof(Settings.hostname));
if (strstr(Settings.hostname,"%")) {
strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname));

View File

@ -694,8 +694,8 @@ bool MqttCommand(void)
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, fingerprint);
}
#endif
else if ((CMND_MQTTCLIENT == command_code) && !grpflg) {
if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_client))) {
else if (CMND_MQTTCLIENT == command_code) {
if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.mqtt_client))) {
strlcpy(Settings.mqtt_client, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_CLIENT_ID : dataBuf, sizeof(Settings.mqtt_client));
restart_flag = 2;
}
@ -766,8 +766,8 @@ bool MqttCommand(void)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_grptopic);
}
else if ((CMND_TOPIC == command_code) && !grpflg) {
if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_topic))) {
else if (CMND_TOPIC == command_code) {
if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.mqtt_topic))) {
MakeValidMqtt(0, dataBuf);
if (!strcmp(dataBuf, mqtt_client)) SetShortcut(dataBuf, SC_DEFAULT);
strlcpy(stemp1, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_TOPIC : dataBuf, sizeof(stemp1));
@ -780,8 +780,8 @@ bool MqttCommand(void)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_topic);
}
else if ((CMND_BUTTONTOPIC == command_code) && !grpflg) {
if ((data_len > 0) && (data_len < sizeof(Settings.button_topic))) {
else if (CMND_BUTTONTOPIC == command_code) {
if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.button_topic))) {
MakeValidMqtt(0, dataBuf);
if (!strcmp(dataBuf, mqtt_client)) SetShortcut(dataBuf, SC_DEFAULT);
switch (Shortcut(dataBuf)) {