Fix devices being undiscovered from Home Assistant when a non-standard Home Assistant discovery topic is used. #4480

This commit is contained in:
Koen Kanters 2020-09-28 19:43:04 +02:00
parent 4bb3ddcff2
commit 0beea18adb

View File

@ -5,7 +5,6 @@ const zigbee2mqttVersion = require('../../package.json').version;
const Extension = require('./extension');
const objectAssignDeep = require(`object-assign-deep`);
const stringify = require('json-stable-stringify-without-jsonify');
const discoveryRegex = new RegExp(`homeassistant/(.*)/(.*)/(.*)/config`);
const cfg = {
// Binary sensor
@ -2425,6 +2424,7 @@ class HomeAssistant extends Extension {
}
onMQTTMessage(topic, message) {
const discoveryRegex = new RegExp(`${this.discoveryTopic}/(.*)/(.*)/(.*)/config`);
const discoveryMatch = topic.match(discoveryRegex);
const isDeviceAutomation = discoveryMatch && discoveryMatch[1] === 'device_automation';
if (discoveryMatch) {