fix topic comparison

This commit is contained in:
2018-11-19 22:38:56 +01:00
parent 943b116a77
commit 892a513e75
5 changed files with 46 additions and 21 deletions

View File

@@ -98,8 +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(localTopic.length() > 4){
if(baseTopicLength == topicRootLength){
String direction = localTopic.substring(0,4);
if(direction == "/in/" ){
String localSubTopic = localTopic.substring(direction.length());