diff --git a/lib/Gateway.js b/lib/Gateway.js index a6f40469d5a..a9f1cf3bf05 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -642,8 +642,8 @@ Gateway.prototype.publishDiscovery = function (hassDevice, nodeId, deleteDevice, if (this.config.payloadType === 2) { // Payload is set to "Just Value" var p = hassDevice.discovery_payload for (const k in p) { - if (/_template\b/g.test(k)) { - p[k] = p[k].replace(/value_json.value/g, 'value') + if (typeof p[k] === 'string') { + p[k] = p[k].replace(/value_json\.value/g, 'value') } } }