Fix issue #306: Sending config msg works only with default topic

This commit is contained in:
sebastianheierhoff
2018-08-31 12:34:59 +02:00
committed by GitHub
parent ad43d61f28
commit c22f8b36ba
+3 -3
View File
@@ -355,7 +355,7 @@ class Controller {
}
handleMQTTMessageConfig(topic, message) {
const option = topic.split('/')[3];
const option = topic.split('/').slice(-1)[0];
if (option === 'permit_join') {
this.zigbee.permitJoin(message.toString().toLowerCase() === 'true');
@@ -459,8 +459,8 @@ class Controller {
}
handleMQTTMessageDevice(topic, message, withPrefix) {
const friendlyName = topic.split('/')[1];
const topicPrefix = withPrefix ? topic.split('/')[2] : '';
const friendlyName = topic.split('/').slice(-2)[0];
const topicPrefix = withPrefix ? topic.split('/').slice(-3)[0] : '';
// Map friendlyName to deviceID.
const deviceID = settings.getIDByFriendlyName(friendlyName);