Skip to content

Commit

Permalink
fix: Discovery when payload is set to 'Just Value'
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 30, 2020
1 parent 70c95c1 commit 3f535a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
}
Expand Down

0 comments on commit 3f535a4

Please sign in to comment.