node-red-contrib-homebridge-automation 0.3.0-beta.2 → 0.3.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/hbConfigNode.js
CHANGED
|
@@ -60,7 +60,7 @@ class HBConfigNode {
|
|
|
60
60
|
fs.writeFileSync(storagePath, JSON.stringify(updatedDevices, null, 2));
|
|
61
61
|
} catch (e) {
|
|
62
62
|
this.error(`Error writing Homebridge endpoints to file: ${e.message}`);
|
|
63
|
-
}
|
|
63
|
+
}
|
|
64
64
|
}
|
|
65
65
|
// Fix broken uniqueId's from HAP-Client
|
|
66
66
|
updatedDevices.forEach((service) => {
|
|
@@ -136,10 +136,12 @@ class HBConfigNode {
|
|
|
136
136
|
async connectClientNodes() {
|
|
137
137
|
debug('connect %s nodes', Object.keys(this.clientNodes).length);
|
|
138
138
|
for (const [key, clientNode] of Object.entries(this.clientNodes)) {
|
|
139
|
-
// debug('_Register: %s type: %s', clientNode.type, clientNode.name, clientNode.instance);
|
|
140
|
-
const matchedDevice = this.hbDevices.find(service =>
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
// debug('_Register: %s type: "%s" "%s" "%s"', clientNode.type, clientNode.name, clientNode.instance, clientNode.device);
|
|
140
|
+
const matchedDevice = this.hbDevices.find(service => {
|
|
141
|
+
const friendlyName = (service.accessoryInformation.Name ? service.accessoryInformation.Name : service.serviceName);
|
|
142
|
+
const deviceIdentifier = `${service.instance.name}${service.instance.username}${service.accessoryInformation.Manufacturer}${friendlyName}${service.uuid.slice(0, 8)}`;
|
|
143
|
+
return clientNode.device === deviceIdentifier;
|
|
144
|
+
});
|
|
143
145
|
|
|
144
146
|
if (matchedDevice) {
|
|
145
147
|
clientNode.hbDevice = matchedDevice;
|
|
@@ -147,7 +149,7 @@ class HBConfigNode {
|
|
|
147
149
|
clientNode.emit('hbReady', matchedDevice);
|
|
148
150
|
debug('_Registered: %s type: %s', clientNode.type, matchedDevice.type, matchedDevice.serviceName);
|
|
149
151
|
} else {
|
|
150
|
-
this.error(`ERROR: Device registration failed '${clientNode.fullName}'`);
|
|
152
|
+
this.error(`ERROR: Device registration failed '${clientNode.fullName}' - '${clientNode.device}'`);
|
|
151
153
|
}
|
|
152
154
|
};
|
|
153
155
|
|