node-red-contrib-homebridge-automation 0.1.12-beta.30 → 0.1.12-beta.31
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 +1 -1
- package/src/hbConfigNode.js +15 -2
package/package.json
CHANGED
package/src/hbConfigNode.js
CHANGED
|
@@ -58,7 +58,8 @@ class HBConfigNode {
|
|
|
58
58
|
this.hbDevices = await this.hapClient.getAllServices();
|
|
59
59
|
this.evDevices = this.toList({ perms: 'ev' });
|
|
60
60
|
this.ctDevices = this.toList({ perms: 'pw' });
|
|
61
|
-
console.log('
|
|
61
|
+
console.log('evDevices', this.evDevices);
|
|
62
|
+
console.log('ctDevices', this.ctDevices);
|
|
62
63
|
this.handleDuplicates(this.evDevices);
|
|
63
64
|
debug('Queue', this.reqisterQueue.getStats());
|
|
64
65
|
this.reqisterQueue.resume();
|
|
@@ -73,7 +74,7 @@ class HBConfigNode {
|
|
|
73
74
|
'Television', 'Temperature Sensor', 'Thermostat', 'Contact Sensor',
|
|
74
75
|
];
|
|
75
76
|
|
|
76
|
-
return this.hbDevices
|
|
77
|
+
return filterUnique(this.hbDevices)
|
|
77
78
|
.filter(service => supportedTypes.includes(service.humanType))
|
|
78
79
|
.map(service => ({
|
|
79
80
|
name: service.serviceName,
|
|
@@ -167,4 +168,16 @@ class HBConfigNode {
|
|
|
167
168
|
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
// Cameras have multiple AID's of 1....
|
|
172
|
+
const filterUnique = (data) => {
|
|
173
|
+
const seen = new Set();
|
|
174
|
+
return data.filter(item => {
|
|
175
|
+
const uniqueKey = `${item.aid}-${item.serviceName}-${item.instance.username}-${item.instance.port}`;
|
|
176
|
+
console.log(uniqueKey, seen.has(uniqueKey))
|
|
177
|
+
if (seen.has(uniqueKey)) return false;
|
|
178
|
+
seen.add(uniqueKey);
|
|
179
|
+
return true;
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
170
183
|
module.exports = HBConfigNode;
|