Fix bug where messages sent to the group topic were incorrectly ignored. Fixes #5

This commit is contained in:
Adrian McEwen 2020-11-18 23:41:50 +00:00
parent 453cc0cc05
commit 78098e612d

View File

@ -68,7 +68,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
if (strncmp(topic, mqttDeviceTopic, topicPrefixLen) == 0) { if (strncmp(topic, mqttDeviceTopic, topicPrefixLen) == 0) {
topic += topicPrefixLen; topic += topicPrefixLen;
} else { } else {
size_t topic_prefix_len = strlen(mqttGroupTopic); topicPrefixLen = strlen(mqttGroupTopic);
if (strncmp(topic, mqttGroupTopic, topicPrefixLen) == 0) { if (strncmp(topic, mqttGroupTopic, topicPrefixLen) == 0) {
topic += topicPrefixLen; topic += topicPrefixLen;
} else { } else {