fix topic comparison

This commit is contained in:
2018-11-19 22:57:21 +01:00
parent 892a513e75
commit 031894a63e

View File

@@ -98,9 +98,9 @@ void MqttPlugin::downstreamHandler(char *topic, uint8_t *payload, unsigned int l
String topicStr = String(topic);
int topicRootLength = topicRoot.length();
if(topicStr.length() > topicRootLength){
int baseTopicLength = topicStr.substring(0, topicRootLength).length();
String localTopic = topicStr.substring(topicRootLength);
if(baseTopicLength == topicRootLength){
String baseTopic = topicStr.substring(0, topicRootLength);
if(baseTopic.compareTo(topicRoot) == 0){
String localTopic = topicStr.substring(topicRootLength);
String direction = localTopic.substring(0,4);
if(direction == "/in/" ){
String localSubTopic = localTopic.substring(direction.length());