From 3f535a46139e5ad45eee4abede1f22d460e3062a Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 30 Jan 2020 09:51:08 +0100 Subject: [PATCH] fix: Discovery when payload is set to 'Just Value' --- lib/Gateway.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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') } } }