From 2b9125134039ff94b8ea5eae98159c2fe0e9934b Mon Sep 17 00:00:00 2001 From: "V. Aret" Date: Sun, 20 Dec 2020 22:52:34 +0100 Subject: [PATCH 1/3] Fix issue with notification naming, by using propertyKey --- lib/Gateway.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Gateway.js b/lib/Gateway.js index 4926b5493f3..24c017f902b 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -568,7 +568,6 @@ function deviceInfo (node, nodeName) { function getDiscoveryTopic (hassDevice, nodeName) { return `${hassDevice.type}/${nodeName}/${hassDevice.object_id}/config` } - /** * Calculate the correct template string to use for modes templates * based on gateway settings and mapped mode values @@ -1471,7 +1470,11 @@ Gateway.prototype.discoverValue = function (node, vId) { // https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/commandclass/NotificationCC.ts // https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/notifications.json cfg = copy(hassCfg.sensor_generic) - cfg.object_id = 'notification_' + valueId.property + if (valueId.propertyKey) { + cfg.object_id = 'notification_' + valueId.property + '_' + valueId.propertyKey + } else { + cfg.object_id = 'notification_' + valueId.property + } cfg.discovery_payload.icon = 'mdi:alarm-light' break case CommandClasses['Multilevel Sensor']: From de9b4e73d97d06700a87a51a9ad6046f4f0bfbe2 Mon Sep 17 00:00:00 2001 From: "V. Aret" Date: Sun, 20 Dec 2020 22:53:33 +0100 Subject: [PATCH 2/3] lint fixes --- lib/Gateway.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Gateway.js b/lib/Gateway.js index 24c017f902b..5f8d94890d0 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -1471,7 +1471,8 @@ Gateway.prototype.discoverValue = function (node, vId) { // https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/notifications.json cfg = copy(hassCfg.sensor_generic) if (valueId.propertyKey) { - cfg.object_id = 'notification_' + valueId.property + '_' + valueId.propertyKey + cfg.object_id = + 'notification_' + valueId.property + '_' + valueId.propertyKey } else { cfg.object_id = 'notification_' + valueId.property } From ea92a8bcb762f383c8ab0ad519c94be6cf7baaf9 Mon Sep 17 00:00:00 2001 From: "V. Aret" Date: Sun, 20 Dec 2020 23:01:44 +0100 Subject: [PATCH 3/3] replace on duplication valueId.property with valueId.endpoint --- lib/Gateway.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Gateway.js b/lib/Gateway.js index 5f8d94890d0..28495fffd5a 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -1605,7 +1605,7 @@ Gateway.prototype.discoverValue = function (node, vId) { // Check if another value already exists and add the index to object_id to make it unique if (node.hassDevices[cfg.type + '_' + cfg.object_id]) { - cfg.object_id += '_' + valueId.property + cfg.object_id += '_' + valueId.endpoint } // Set a friendly name for this component