From 9bf911371eeca4bfc829c0d65026d104c9871480 Mon Sep 17 00:00:00 2001 From: Northern Man Date: Tue, 29 Oct 2019 21:37:34 -0400 Subject: [PATCH 1/3] Fix for #170 This change will cause all end users devices to go "not responding" and you must unpair and repair in the Home app to resolve. You will lose all your room settings and automations with this fix. --- lib/HAPBridgeNode.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/HAPBridgeNode.js b/lib/HAPBridgeNode.js index 76a998b5..d0d33d98 100644 --- a/lib/HAPBridgeNode.js +++ b/lib/HAPBridgeNode.js @@ -156,7 +156,7 @@ module.exports = function(RED) { } function macify(nodeId) { - const noDecimalStr = nodeId.replace('.', '') - const paddedStr = noDecimalStr.padStart(16, '0') - return paddedStr.match(/.{1,2}/g).join(':') + const noDecimalStr = nodeId.replace(".", ""); + const paddedStr = noDecimalStr.padEnd(16, "0"); + return paddedStr.match(/.{1,2}/g).join(":").substr(0, 17); } From 7587b5db54571db3f5c4b9f4c939efa19eaa960a Mon Sep 17 00:00:00 2001 From: Northern Man Date: Sat, 2 Nov 2019 14:54:20 -0400 Subject: [PATCH 2/3] Style tweaks --- lib/HAPBridgeNode.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/HAPBridgeNode.js b/lib/HAPBridgeNode.js index d0d33d98..aa293927 100644 --- a/lib/HAPBridgeNode.js +++ b/lib/HAPBridgeNode.js @@ -156,7 +156,7 @@ module.exports = function(RED) { } function macify(nodeId) { - const noDecimalStr = nodeId.replace(".", ""); - const paddedStr = noDecimalStr.padEnd(16, "0"); - return paddedStr.match(/.{1,2}/g).join(":").substr(0, 17); + const noDecimalStr = nodeId.replace('.', ''); + const paddedStr = noDecimalStr.padEnd(12, '0"); + return paddedStr.match(/.{1,2}/g).join(':').substr(0, 17); } From 141f734b073173c3bf3bd14a45a9a50fd1e1c4a6 Mon Sep 17 00:00:00 2001 From: Northern Man Date: Sun, 3 Nov 2019 20:50:32 -0500 Subject: [PATCH 3/3] Tested - Goops --- lib/HAPBridgeNode.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/HAPBridgeNode.js b/lib/HAPBridgeNode.js index aa293927..89a75a8d 100644 --- a/lib/HAPBridgeNode.js +++ b/lib/HAPBridgeNode.js @@ -22,7 +22,7 @@ module.exports = function(RED) { this.allowInsecureRequest = config.allowInsecureRequest !== undefined ? config.allowInsecureRequest : false this.allowMessagePassthrough = config.allowMessagePassthrough !== undefined ? config.allowMessagePassthrough : false - + this.manufacturer = config.manufacturer this.serialNo = config.serialNo this.model = config.model @@ -156,7 +156,7 @@ module.exports = function(RED) { } function macify(nodeId) { - const noDecimalStr = nodeId.replace('.', ''); - const paddedStr = noDecimalStr.padEnd(12, '0"); - return paddedStr.match(/.{1,2}/g).join(':').substr(0, 17); + const noDecimalStr = nodeId.replace('.', '') + const paddedStr = noDecimalStr.padEnd(12, '0') + return paddedStr.match(/.{1,2}/g).join(':').substr(0, 17).toUpperCase() }