homebridge-tuya-plus 3.5.0 → 3.5.2
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/index.js
CHANGED
|
@@ -27,6 +27,10 @@ const VerticalBlindsWithTilt = require('./lib/VerticalBlindsWithTilt');
|
|
|
27
27
|
|
|
28
28
|
const PLUGIN_NAME = 'homebridge-tuya-plus';
|
|
29
29
|
const PLATFORM_NAME = 'TuyaLan';
|
|
30
|
+
// Seed used to derive accessory UUIDs. Must remain 'homebridge-tuya' so that
|
|
31
|
+
// devices already paired with HomeKit keep their existing identity (names,
|
|
32
|
+
// rooms, automations).
|
|
33
|
+
const UUID_SEED = 'homebridge-tuya';
|
|
30
34
|
const DEFAULT_DISCOVER_TIMEOUT = 60000;
|
|
31
35
|
|
|
32
36
|
const CLASS_DEF = {
|
|
@@ -78,7 +82,7 @@ class TuyaLan {
|
|
|
78
82
|
return false;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
this._expectedUUIDs = this.config.devices.map(device => UUID.generate(
|
|
85
|
+
this._expectedUUIDs = this.config.devices.map(device => UUID.generate(UUID_SEED +(device.fake ? ':fake:' : ':') + device.id));
|
|
82
86
|
|
|
83
87
|
this.api.on('didFinishLaunching', () => {
|
|
84
88
|
this.discoverDevices();
|
|
@@ -122,7 +126,7 @@ class TuyaLan {
|
|
|
122
126
|
const device = new TuyaAccessory({
|
|
123
127
|
...devices[config.id], ...config,
|
|
124
128
|
log: this.log,
|
|
125
|
-
UUID: UUID.generate(
|
|
129
|
+
UUID: UUID.generate(UUID_SEED + ':' + config.id),
|
|
126
130
|
connect: false
|
|
127
131
|
});
|
|
128
132
|
this.addAccessory(device);
|
|
@@ -133,7 +137,7 @@ class TuyaLan {
|
|
|
133
137
|
this.addAccessory(new TuyaAccessory({
|
|
134
138
|
...config,
|
|
135
139
|
log: this.log,
|
|
136
|
-
UUID: UUID.generate(
|
|
140
|
+
UUID: UUID.generate(UUID_SEED + ':fake:' + config.id),
|
|
137
141
|
connect: false
|
|
138
142
|
}));
|
|
139
143
|
});
|
|
@@ -149,7 +153,7 @@ class TuyaLan {
|
|
|
149
153
|
const device = new TuyaAccessory({
|
|
150
154
|
...devices[deviceId],
|
|
151
155
|
log: this.log,
|
|
152
|
-
UUID: UUID.generate(
|
|
156
|
+
UUID: UUID.generate(UUID_SEED + ':' + deviceId),
|
|
153
157
|
connect: false
|
|
154
158
|
});
|
|
155
159
|
this.addAccessory(device);
|
|
@@ -30,7 +30,7 @@ class CustomMultiOutletAccessory extends BaseAccessory {
|
|
|
30
30
|
throw new Error('The outlet definition #${i} is missing or is malformed: ' + outlet);
|
|
31
31
|
|
|
32
32
|
const name = ((outlet.name || '').trim() || 'Unnamed') + ' - ' + this.device.context.name;
|
|
33
|
-
let service = this.accessory.getServiceById(Service.Outlet
|
|
33
|
+
let service = this.accessory.getServiceById(Service.Outlet, 'outlet ' + outlet.dp);
|
|
34
34
|
if (service) this._checkServiceName(service, name);
|
|
35
35
|
else service = this.accessory.addService(Service.Outlet, name, 'outlet ' + outlet.dp);
|
|
36
36
|
|
|
@@ -24,7 +24,7 @@ class MultiOutletAccessory extends BaseAccessory {
|
|
|
24
24
|
const outletCount = parseInt(this.device.context.outletCount) || 1;
|
|
25
25
|
const _validServices = [];
|
|
26
26
|
for (let i = 0; i++ < outletCount;) {
|
|
27
|
-
let service = this.accessory.getServiceById(Service.Outlet
|
|
27
|
+
let service = this.accessory.getServiceById(Service.Outlet, 'outlet ' + i);
|
|
28
28
|
if (service) this._checkServiceName(service, this.device.context.name + ' ' + i);
|
|
29
29
|
else service = this.accessory.addService(Service.Outlet, this.device.context.name + ' ' + i, 'outlet ' + i);
|
|
30
30
|
|
|
@@ -34,12 +34,12 @@ class OilDiffuserAccessory extends BaseAccessory {
|
|
|
34
34
|
const {Service} = this.hap;
|
|
35
35
|
|
|
36
36
|
const humidifierName = this.device.context.name;
|
|
37
|
-
let humidifierService = this.accessory.getServiceById(Service.HumidifierDehumidifier
|
|
37
|
+
let humidifierService = this.accessory.getServiceById(Service.HumidifierDehumidifier, 'humidifier');
|
|
38
38
|
if (humidifierService) this._checkServiceName(humidifierService, humidifierName);
|
|
39
39
|
else humidifierService = this.accessory.addService(Service.HumidifierDehumidifier, humidifierName, 'humidifier');
|
|
40
40
|
|
|
41
41
|
const lightName = this.device.context.name + ' Light';
|
|
42
|
-
let lightService = this.accessory.getServiceById(Service.Lightbulb
|
|
42
|
+
let lightService = this.accessory.getServiceById(Service.Lightbulb, 'lightbulb');
|
|
43
43
|
if (lightService) this._checkServiceName(lightService, lightName);
|
|
44
44
|
else lightService = this.accessory.addService(Service.Lightbulb, lightName, 'lightbulb');
|
|
45
45
|
|
|
@@ -55,8 +55,8 @@ class OilDiffuserAccessory extends BaseAccessory {
|
|
|
55
55
|
|
|
56
56
|
const {Service, AdaptiveLightingController, Characteristic} = this.hap;
|
|
57
57
|
|
|
58
|
-
const humidifierService = this.accessory.getServiceById(Service.HumidifierDehumidifier
|
|
59
|
-
const lightService = this.accessory.getServiceById(Service.Lightbulb
|
|
58
|
+
const humidifierService = this.accessory.getServiceById(Service.HumidifierDehumidifier, 'humidifier');
|
|
59
|
+
const lightService = this.accessory.getServiceById(Service.Lightbulb, 'lightbulb');
|
|
60
60
|
|
|
61
61
|
this.dpLight = this._getCustomDP(this.device.context.dpLight) || '5';
|
|
62
62
|
this.dpMode = this._getCustomDP(this.device.context.dpMode) || '6';
|
|
@@ -22,12 +22,12 @@ class RGBTWOutletAccessory extends BaseAccessory {
|
|
|
22
22
|
const {Service} = this.hap;
|
|
23
23
|
|
|
24
24
|
const outletName = 'Outlet - ' + this.device.context.name;
|
|
25
|
-
let outletService = this.accessory.getServiceById(Service.Outlet
|
|
25
|
+
let outletService = this.accessory.getServiceById(Service.Outlet, 'outlet');
|
|
26
26
|
if (outletService) this._checkServiceName(outletService, outletName);
|
|
27
27
|
else outletService = this.accessory.addService(Service.Outlet, outletName, 'outlet');
|
|
28
28
|
|
|
29
29
|
const lightName = 'RGBTWLight - ' + this.device.context.name;
|
|
30
|
-
let lightService = this.accessory.getServiceById(Service.Lightbulb
|
|
30
|
+
let lightService = this.accessory.getServiceById(Service.Lightbulb, 'lightbulb');
|
|
31
31
|
if (lightService) this._checkServiceName(lightService, lightName);
|
|
32
32
|
else lightService = this.accessory.addService(Service.Lightbulb, lightName, 'lightbulb');
|
|
33
33
|
|
|
@@ -43,8 +43,8 @@ class RGBTWOutletAccessory extends BaseAccessory {
|
|
|
43
43
|
|
|
44
44
|
const {Service, Characteristic, EnergyCharacteristics} = this.hap;
|
|
45
45
|
|
|
46
|
-
const outletService = this.accessory.getServiceById(Service.Outlet
|
|
47
|
-
const lightService = this.accessory.getServiceById(Service.Lightbulb
|
|
46
|
+
const outletService = this.accessory.getServiceById(Service.Outlet, 'outlet');
|
|
47
|
+
const lightService = this.accessory.getServiceById(Service.Lightbulb, 'lightbulb');
|
|
48
48
|
|
|
49
49
|
this.dpLight = this._getCustomDP(this.device.context.dpLight) || '1';
|
|
50
50
|
this.dpMode = this._getCustomDP(this.device.context.dpMode) || '2';
|
package/lib/SwitchAccessory.js
CHANGED
|
@@ -24,7 +24,7 @@ class SwitchAccessory extends BaseAccessory {
|
|
|
24
24
|
const switchCount = parseInt(this.device.context.switchCount) || 1;
|
|
25
25
|
const _validServices = [];
|
|
26
26
|
for (let i = 0; i++ < switchCount;) {
|
|
27
|
-
let service = this.accessory.getServiceById(Service.Switch
|
|
27
|
+
let service = this.accessory.getServiceById(Service.Switch, 'switch ' + i);
|
|
28
28
|
if (service) this._checkServiceName(service, this.device.context.name + ' ' + i);
|
|
29
29
|
else service = this.accessory.addService(Service.Switch, this.device.context.name + ' ' + i, 'switch ' + i);
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-tuya-plus",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "A community-maintained Homebridge plugin for controlling Tuya devices locally over LAN. Includes new features, fixes, and updated device support.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|