homebridge-tuya-plus 3.4.0 → 3.5.0
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/Readme.MD +1 -1
- package/config.schema.json +11 -0
- package/index.js +6 -6
- package/lib/AirConditionerAccessory.js +362 -445
- package/lib/AirPurifierAccessory.js +150 -335
- package/lib/BaseAccessory.js +34 -0
- package/lib/ConvectorAccessory.js +250 -313
- package/lib/CustomMultiOutletAccessory.js +97 -111
- package/lib/DehumidifierAccessory.js +40 -115
- package/lib/EnergyCharacteristics.js +5 -5
- package/lib/GarageDoorAccessory.js +225 -307
- package/lib/MultiOutletAccessory.js +92 -106
- package/lib/OilDiffuserAccessory.js +379 -480
- package/lib/OutletAccessory.js +83 -83
- package/lib/RGBTWLightAccessory.js +219 -249
- package/lib/RGBTWOutletAccessory.js +270 -296
- package/lib/SimpleBlindsAccessory.js +56 -85
- package/lib/SimpleDimmer2Accessory.js +54 -54
- package/lib/SimpleDimmerAccessory.js +54 -54
- package/lib/SimpleFanAccessory.js +31 -67
- package/lib/SimpleFanLightAccessory.js +58 -117
- package/lib/SimpleHeaterAccessory.js +140 -166
- package/lib/SimpleLightAccessory.js +2 -2
- package/lib/SwitchAccessory.js +16 -30
- package/lib/TWLightAccessory.js +92 -94
- package/lib/ValveAccessory.js +60 -72
- package/lib/VerticalBlindsWithTilt.js +66 -186
- package/package.json +6 -5
- package/test/BaseAccessory.test.js +269 -0
- package/test/EnergyCharacteristics.test.js +74 -0
- package/test/GarageDoorAccessory.test.js +131 -0
- package/test/MultiOutletAccessory.test.js +86 -0
- package/test/RGBTWLightAccessory.test.js +143 -0
- package/test/support/mocks.js +163 -0
- package/wiki/Supported-Device-Types.md +19 -0
- package/wiki/User-documented-device-config.md +27 -0
package/Readme.MD
CHANGED
|
@@ -43,7 +43,7 @@ A community-maintained Homebridge plugin for controlling Tuya devices locally ov
|
|
|
43
43
|
* Color<sup>[12](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#white-and-color-light-bulbs)</sup> (Hue, Saturation, Adaptive Lighting)
|
|
44
44
|
* Oil Diffusers<sup>[13](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md)</sup>
|
|
45
45
|
* Outlets<sup>[14](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#outlets)</sup>
|
|
46
|
-
* Switches<sup>[15](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md)</sup>
|
|
46
|
+
* Switches<sup>[15](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#switch)</sup>
|
|
47
47
|
* Vertical Blinds<sup>[16](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#vertical-blinds-with-tilt)</sup>
|
|
48
48
|
|
|
49
49
|
Note: Motion, and other sensor types don't behave well with responce requests, so they will not be added.
|
package/config.schema.json
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"title": "Please select device type...",
|
|
31
31
|
"enum": ["null"]
|
|
32
32
|
},
|
|
33
|
+
{
|
|
34
|
+
"title": "Switch Gang / Basic Switch",
|
|
35
|
+
"enum": ["Switch"]
|
|
36
|
+
},
|
|
33
37
|
{
|
|
34
38
|
"title": "Smart Plug / Barely Smart Power Strip",
|
|
35
39
|
"enum": ["Outlet"]
|
|
@@ -147,6 +151,13 @@
|
|
|
147
151
|
"functionBody": "return model.devices && model.devices[arrayIndices].type !== 'null';"
|
|
148
152
|
}
|
|
149
153
|
},
|
|
154
|
+
"switchCount": {
|
|
155
|
+
"type": "integer",
|
|
156
|
+
"placeholder": "3",
|
|
157
|
+
"condition": {
|
|
158
|
+
"functionBody": "return model.devices && model.devices[arrayIndices] && ['Switch'].includes(model.devices[arrayIndices].type);"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
150
161
|
"voltsId": {
|
|
151
162
|
"type": "integer",
|
|
152
163
|
"placeholder": "9",
|
package/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const OilDiffuserAccessory = require('./lib/OilDiffuserAccessory');
|
|
|
25
25
|
const DoorbellAccessory = require('./lib/DoorbellAccessory');
|
|
26
26
|
const VerticalBlindsWithTilt = require('./lib/VerticalBlindsWithTilt');
|
|
27
27
|
|
|
28
|
-
const PLUGIN_NAME = 'homebridge-tuya';
|
|
28
|
+
const PLUGIN_NAME = 'homebridge-tuya-plus';
|
|
29
29
|
const PLATFORM_NAME = 'TuyaLan';
|
|
30
30
|
const DEFAULT_DISCOVER_TIMEOUT = 60000;
|
|
31
31
|
|
|
@@ -55,12 +55,12 @@ const CLASS_DEF = {
|
|
|
55
55
|
verticalblindswithtilt: VerticalBlindsWithTilt
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
let Characteristic,
|
|
58
|
+
let Characteristic, Formats, Perms, Categories, PlatformAccessory, Service, AdaptiveLightingController, UUID;
|
|
59
59
|
|
|
60
60
|
module.exports = function(homebridge) {
|
|
61
61
|
({
|
|
62
62
|
platformAccessory: PlatformAccessory,
|
|
63
|
-
hap: {Characteristic,
|
|
63
|
+
hap: {Characteristic, Formats, Perms, Categories, Service, AdaptiveLightingController, uuid: UUID}
|
|
64
64
|
} = homebridge);
|
|
65
65
|
|
|
66
66
|
homebridge.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, TuyaLan, true);
|
|
@@ -71,7 +71,7 @@ class TuyaLan {
|
|
|
71
71
|
[this.log, this.config, this.api] = [...props];
|
|
72
72
|
|
|
73
73
|
this.cachedAccessories = new Map();
|
|
74
|
-
this.api.hap.EnergyCharacteristics = require('./lib/EnergyCharacteristics')(this.api.hap
|
|
74
|
+
this.api.hap.EnergyCharacteristics = require('./lib/EnergyCharacteristics')(this.api.hap);
|
|
75
75
|
|
|
76
76
|
if(!this.config || !this.config.devices) {
|
|
77
77
|
this.log("No devices found. Check that you have specified them in your config.json file.");
|
|
@@ -174,7 +174,7 @@ class TuyaLan {
|
|
|
174
174
|
if (!characteristic.props ||
|
|
175
175
|
!Array.isArray(characteristic.props.perms) ||
|
|
176
176
|
characteristic.props.perms.length !== 3 ||
|
|
177
|
-
!(characteristic.props.perms.includes(
|
|
177
|
+
!(characteristic.props.perms.includes(Perms.WRITE) && characteristic.props.perms.includes(Perms.NOTIFY))
|
|
178
178
|
) return;
|
|
179
179
|
|
|
180
180
|
this.log.info('Marked %s unreachable by faulting Service.%s.%s', accessory.displayName, service.displayName, characteristic.displayName);
|
|
@@ -236,7 +236,7 @@ class TuyaLan {
|
|
|
236
236
|
this.log.warn('Unregistering', homebridgeAccessory.displayName);
|
|
237
237
|
|
|
238
238
|
delete this.cachedAccessories[homebridgeAccessory.UUID];
|
|
239
|
-
this.api.unregisterPlatformAccessories(
|
|
239
|
+
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [homebridgeAccessory]);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
removeAccessoryByUUID(uuid) {
|