homebridge-tuya-plus 3.3.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 +2 -1
- package/config.schema.json +23 -0
- package/index.js +9 -7
- 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/TuyaAccessory.js +251 -38
- package/lib/TuyaDiscovery.js +268 -165
- package/lib/ValveAccessory.js +60 -72
- package/lib/VerticalBlindsWithTilt.js +311 -0
- 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 +49 -0
- package/wiki/User-documented-device-config.md +27 -0
package/Readme.MD
CHANGED
|
@@ -43,7 +43,8 @@ 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
|
+
* Vertical Blinds<sup>[16](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#vertical-blinds-with-tilt)</sup>
|
|
47
48
|
|
|
48
49
|
Note: Motion, and other sensor types don't behave well with responce requests, so they will not be added.
|
|
49
50
|
|
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"]
|
|
@@ -78,6 +82,10 @@
|
|
|
78
82
|
"title": "Simple Blinds",
|
|
79
83
|
"enum": ["SimpleBlinds"]
|
|
80
84
|
},
|
|
85
|
+
{
|
|
86
|
+
"title": "Vertical Blinds with Tilt",
|
|
87
|
+
"enum": ["VerticalBlindsWithTilt"]
|
|
88
|
+
},
|
|
81
89
|
{
|
|
82
90
|
"title": "Smart Plug w/ White and Color Lights",
|
|
83
91
|
"enum": ["RGBTWOutlet"]
|
|
@@ -143,6 +151,13 @@
|
|
|
143
151
|
"functionBody": "return model.devices && model.devices[arrayIndices].type !== 'null';"
|
|
144
152
|
}
|
|
145
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
|
+
},
|
|
146
161
|
"voltsId": {
|
|
147
162
|
"type": "integer",
|
|
148
163
|
"placeholder": "9",
|
|
@@ -498,6 +513,14 @@
|
|
|
498
513
|
"functionBody": "return model.devices && model.devices[arrayIndices] && ['SimpleBlinds'].includes(model.devices[arrayIndices].type);"
|
|
499
514
|
}
|
|
500
515
|
},
|
|
516
|
+
"timeToClose": {
|
|
517
|
+
"type": "integer",
|
|
518
|
+
"placeholder": "30",
|
|
519
|
+
"description": "Time in seconds for blinds to fully open or close",
|
|
520
|
+
"condition": {
|
|
521
|
+
"functionBody": "return model.devices && model.devices[arrayIndices] && ['VerticalBlindsWithTilt'].includes(model.devices[arrayIndices].type);"
|
|
522
|
+
}
|
|
523
|
+
},
|
|
501
524
|
"dpLight": {
|
|
502
525
|
"type": "integer",
|
|
503
526
|
"placeholder": 1,
|
package/index.js
CHANGED
|
@@ -23,8 +23,9 @@ const SwitchAccessory = require('./lib/SwitchAccessory');
|
|
|
23
23
|
const ValveAccessory = require('./lib/ValveAccessory');
|
|
24
24
|
const OilDiffuserAccessory = require('./lib/OilDiffuserAccessory');
|
|
25
25
|
const DoorbellAccessory = require('./lib/DoorbellAccessory');
|
|
26
|
+
const VerticalBlindsWithTilt = require('./lib/VerticalBlindsWithTilt');
|
|
26
27
|
|
|
27
|
-
const PLUGIN_NAME = 'homebridge-tuya';
|
|
28
|
+
const PLUGIN_NAME = 'homebridge-tuya-plus';
|
|
28
29
|
const PLATFORM_NAME = 'TuyaLan';
|
|
29
30
|
const DEFAULT_DISCOVER_TIMEOUT = 60000;
|
|
30
31
|
|
|
@@ -50,15 +51,16 @@ const CLASS_DEF = {
|
|
|
50
51
|
fanlight: SimpleFanLightAccessory,
|
|
51
52
|
watervalve: ValveAccessory,
|
|
52
53
|
oildiffuser: OilDiffuserAccessory,
|
|
53
|
-
doorbell: DoorbellAccessory
|
|
54
|
+
doorbell: DoorbellAccessory,
|
|
55
|
+
verticalblindswithtilt: VerticalBlindsWithTilt
|
|
54
56
|
};
|
|
55
57
|
|
|
56
|
-
let Characteristic,
|
|
58
|
+
let Characteristic, Formats, Perms, Categories, PlatformAccessory, Service, AdaptiveLightingController, UUID;
|
|
57
59
|
|
|
58
60
|
module.exports = function(homebridge) {
|
|
59
61
|
({
|
|
60
62
|
platformAccessory: PlatformAccessory,
|
|
61
|
-
hap: {Characteristic,
|
|
63
|
+
hap: {Characteristic, Formats, Perms, Categories, Service, AdaptiveLightingController, uuid: UUID}
|
|
62
64
|
} = homebridge);
|
|
63
65
|
|
|
64
66
|
homebridge.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, TuyaLan, true);
|
|
@@ -69,7 +71,7 @@ class TuyaLan {
|
|
|
69
71
|
[this.log, this.config, this.api] = [...props];
|
|
70
72
|
|
|
71
73
|
this.cachedAccessories = new Map();
|
|
72
|
-
this.api.hap.EnergyCharacteristics = require('./lib/EnergyCharacteristics')(this.api.hap
|
|
74
|
+
this.api.hap.EnergyCharacteristics = require('./lib/EnergyCharacteristics')(this.api.hap);
|
|
73
75
|
|
|
74
76
|
if(!this.config || !this.config.devices) {
|
|
75
77
|
this.log("No devices found. Check that you have specified them in your config.json file.");
|
|
@@ -172,7 +174,7 @@ class TuyaLan {
|
|
|
172
174
|
if (!characteristic.props ||
|
|
173
175
|
!Array.isArray(characteristic.props.perms) ||
|
|
174
176
|
characteristic.props.perms.length !== 3 ||
|
|
175
|
-
!(characteristic.props.perms.includes(
|
|
177
|
+
!(characteristic.props.perms.includes(Perms.WRITE) && characteristic.props.perms.includes(Perms.NOTIFY))
|
|
176
178
|
) return;
|
|
177
179
|
|
|
178
180
|
this.log.info('Marked %s unreachable by faulting Service.%s.%s', accessory.displayName, service.displayName, characteristic.displayName);
|
|
@@ -234,7 +236,7 @@ class TuyaLan {
|
|
|
234
236
|
this.log.warn('Unregistering', homebridgeAccessory.displayName);
|
|
235
237
|
|
|
236
238
|
delete this.cachedAccessories[homebridgeAccessory.UUID];
|
|
237
|
-
this.api.unregisterPlatformAccessories(
|
|
239
|
+
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [homebridgeAccessory]);
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
removeAccessoryByUUID(uuid) {
|