homebridge-tydom 0.22.0 → 0.22.1
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/lib/accessories/contactSensor.js +1 -1
- package/lib/accessories/garageDoorOpener.js +1 -1
- package/lib/accessories/lightbulb.js +4 -4
- package/lib/accessories/securitySystem.js +8 -8
- package/lib/accessories/securitySystemSensors.js +1 -1
- package/lib/accessories/services/switchableService.js +2 -2
- package/lib/accessories/temperatureSensor.js +1 -1
- package/lib/accessories/thermostat.js +10 -10
- package/lib/accessories/windowCovering.js +5 -5
- package/lib/controller.d.ts +3 -3
- package/lib/helpers/accessory.d.ts +4 -4
- package/lib/helpers/accessory.js +22 -22
- package/lib/helpers/index.js +5 -1
- package/lib/helpers/tydom.d.ts +3 -3
- package/lib/helpers/tydom.js +27 -27
- package/lib/helpers/webhook.d.ts +3 -3
- package/lib/platform.d.ts +1 -1
- package/lib/platform.js +1 -1
- package/lib/typings/index.js +5 -1
- package/lib/typings/tydom.d.ts +27 -27
- package/lib/utils/debug.d.ts +1 -1
- package/lib/utils/hash.d.ts +1 -1
- package/lib/utils/index.js +5 -1
- package/lib/utils/request.d.ts +2 -1
- package/package.json +21 -21
|
@@ -16,7 +16,7 @@ const setupContactSensor = (accessory, controller) => {
|
|
|
16
16
|
const service = (0, accessory_1.addAccessoryService)(accessory, hap_1.Service.ContactSensor, `${accessory.displayName}`, true);
|
|
17
17
|
service
|
|
18
18
|
.getCharacteristic(ContactSensorState)
|
|
19
|
-
.on("get" /* GET */, async (callback) => {
|
|
19
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
20
20
|
(0, debug_1.debugGet)(ContactSensorState, service);
|
|
21
21
|
try {
|
|
22
22
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -21,7 +21,7 @@ const setupGarageDoorOpener = (accessory, controller) => {
|
|
|
21
21
|
// .on(CharacteristicEventTypes.GET, async (callback: NodeCallback<CharacteristicValue>) => {
|
|
22
22
|
// callback(null, state.isOn);
|
|
23
23
|
// })
|
|
24
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
24
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
25
25
|
(0, debug_1.debugSet)(hap_1.Characteristic.On, service, value);
|
|
26
26
|
if (!value) {
|
|
27
27
|
callback();
|
|
@@ -42,7 +42,7 @@ const setupLightbulb = (accessory, controller) => {
|
|
|
42
42
|
}, 15, { leading: true, trailing: true });
|
|
43
43
|
service
|
|
44
44
|
.getCharacteristic(hap_1.Characteristic.On)
|
|
45
|
-
.on("get" /* GET */, async (callback) => {
|
|
45
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
46
46
|
(0, debug_1.debugGet)(On, service);
|
|
47
47
|
try {
|
|
48
48
|
const data = (await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId }));
|
|
@@ -55,7 +55,7 @@ const setupLightbulb = (accessory, controller) => {
|
|
|
55
55
|
callback(err);
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
58
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
59
59
|
(0, debug_1.debugSet)(On, service, value);
|
|
60
60
|
try {
|
|
61
61
|
const nextLevel = value ? state.latestBrightness || 100 : 0;
|
|
@@ -71,7 +71,7 @@ const setupLightbulb = (accessory, controller) => {
|
|
|
71
71
|
.getValue();
|
|
72
72
|
service
|
|
73
73
|
.getCharacteristic(hap_1.Characteristic.Brightness)
|
|
74
|
-
.on("get" /* GET */, async (callback) => {
|
|
74
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
75
75
|
(0, debug_1.debugGet)(Brightness, service);
|
|
76
76
|
try {
|
|
77
77
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -83,7 +83,7 @@ const setupLightbulb = (accessory, controller) => {
|
|
|
83
83
|
callback(err);
|
|
84
84
|
}
|
|
85
85
|
})
|
|
86
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
86
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
87
87
|
(0, debug_1.debugSet)(Brightness, service, value);
|
|
88
88
|
try {
|
|
89
89
|
const nextValue = value;
|
|
@@ -77,7 +77,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
77
77
|
service
|
|
78
78
|
.getCharacteristic(SecuritySystemCurrentState)
|
|
79
79
|
.setValue(SecuritySystemCurrentState.DISARMED) // Default to disarmed to prevent notifications
|
|
80
|
-
.on("get" /* GET */, async (callback) => {
|
|
80
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
81
81
|
(0, debug_1.debugGet)(SecuritySystemCurrentState, service);
|
|
82
82
|
try {
|
|
83
83
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -92,7 +92,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
92
92
|
.getValue();
|
|
93
93
|
service
|
|
94
94
|
.getCharacteristic(StatusTampered)
|
|
95
|
-
.on("get" /* GET */, async (callback) => {
|
|
95
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
96
96
|
(0, debug_1.debugGet)(StatusTampered, service);
|
|
97
97
|
try {
|
|
98
98
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -107,7 +107,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
107
107
|
.getValue();
|
|
108
108
|
service
|
|
109
109
|
.getCharacteristic(SecuritySystemTargetState)
|
|
110
|
-
.on("get" /* GET */, async (callback) => {
|
|
110
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
111
111
|
(0, debug_1.debugGet)(SecuritySystemTargetState, service);
|
|
112
112
|
try {
|
|
113
113
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -119,7 +119,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
119
119
|
callback(err);
|
|
120
120
|
}
|
|
121
121
|
})
|
|
122
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
122
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
123
123
|
(0, debug_1.debugSet)(SecuritySystemTargetState, service, value);
|
|
124
124
|
if (!pin) {
|
|
125
125
|
callback();
|
|
@@ -164,7 +164,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
164
164
|
service.addLinkedService(systOpenIssueService);
|
|
165
165
|
systOpenIssueService
|
|
166
166
|
.getCharacteristic(ContactSensorState)
|
|
167
|
-
.on("get" /* GET */, async (callback) => {
|
|
167
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
168
168
|
(0, debug_1.debugGet)(ContactSensorState, systOpenIssueService);
|
|
169
169
|
try {
|
|
170
170
|
const data = (await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId }));
|
|
@@ -186,7 +186,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
186
186
|
service.addLinkedService(alarmSOSService);
|
|
187
187
|
alarmSOSService
|
|
188
188
|
.getCharacteristic(ContactSensorState)
|
|
189
|
-
.on("get" /* GET */, async (callback) => {
|
|
189
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
190
190
|
(0, debug_1.debugGet)(ContactSensorState, alarmSOSService);
|
|
191
191
|
try {
|
|
192
192
|
const data = (await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId }));
|
|
@@ -224,7 +224,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
224
224
|
service.addLinkedService(zoneService);
|
|
225
225
|
zoneService
|
|
226
226
|
.getCharacteristic(On)
|
|
227
|
-
.on("get" /* GET */, async (callback) => {
|
|
227
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
228
228
|
(0, debug_1.debugGet)(On, zoneService);
|
|
229
229
|
try {
|
|
230
230
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -237,7 +237,7 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
237
237
|
callback(err);
|
|
238
238
|
}
|
|
239
239
|
})
|
|
240
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
240
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
241
241
|
(0, debug_1.debugSet)(On, zoneService, value);
|
|
242
242
|
if (!pin) {
|
|
243
243
|
callback();
|
|
@@ -41,7 +41,7 @@ const setupSecuritySystemSensors = async (accessory, controller) => {
|
|
|
41
41
|
contactSensorService
|
|
42
42
|
.getCharacteristic(ContactSensorState)
|
|
43
43
|
.setValue(initialOpenedIssues[productId] ? 1 : 0)
|
|
44
|
-
.on("get" /* GET */, async (callback) => {
|
|
44
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
45
45
|
(0, debug_1.debugGet)(ContactSensorState, contactSensorService);
|
|
46
46
|
try {
|
|
47
47
|
const openedIssues = getOpenedIssues(await (0, tydom_1.runTydomDeviceCommand)(client, 'histo', {
|
|
@@ -13,7 +13,7 @@ const addAccessorySwitchableService = (accessory, controller, serviceClass) => {
|
|
|
13
13
|
const service = (0, accessory_1.addAccessoryService)(accessory, serviceClass, `${accessory.displayName}`, true);
|
|
14
14
|
service
|
|
15
15
|
.getCharacteristic(On)
|
|
16
|
-
.on("get" /* GET */, async (callback) => {
|
|
16
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
17
17
|
(0, debug_1.debugGet)(On, service);
|
|
18
18
|
try {
|
|
19
19
|
const data = (await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId }));
|
|
@@ -26,7 +26,7 @@ const addAccessorySwitchableService = (accessory, controller, serviceClass) => {
|
|
|
26
26
|
callback(err);
|
|
27
27
|
}
|
|
28
28
|
})
|
|
29
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
29
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
30
30
|
(0, debug_1.debugSet)(On, service, value);
|
|
31
31
|
try {
|
|
32
32
|
const tydomValue = value ? 100 : 0;
|
|
@@ -19,7 +19,7 @@ const setupTemperatureSensor = (accessory, controller) => {
|
|
|
19
19
|
.setProps({
|
|
20
20
|
minValue: -100
|
|
21
21
|
})
|
|
22
|
-
.on("get" /* GET */, async (callback) => {
|
|
22
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
23
23
|
(0, debug_1.debugGet)(CurrentTemperature, service);
|
|
24
24
|
try {
|
|
25
25
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -23,7 +23,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
23
23
|
service
|
|
24
24
|
.getCharacteristic(CurrentHeatingCoolingState)
|
|
25
25
|
.setProps({ validValues: [0, 1] }) // [OFF, HEAT, COOL]
|
|
26
|
-
.on("get" /* GET */, async (callback) => {
|
|
26
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
27
27
|
(0, debug_1.debugGet)(CurrentHeatingCoolingState, service);
|
|
28
28
|
try {
|
|
29
29
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -44,7 +44,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
44
44
|
service
|
|
45
45
|
.getCharacteristic(TargetHeatingCoolingState)
|
|
46
46
|
.setProps({ validValues: [0, 1] }) // [OFF, HEAT, COOL, AUTO]
|
|
47
|
-
.on("get" /* GET */, async (callback) => {
|
|
47
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
48
48
|
(0, debug_1.debugGet)(TargetHeatingCoolingState, service);
|
|
49
49
|
try {
|
|
50
50
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -60,7 +60,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
60
60
|
callback(err);
|
|
61
61
|
}
|
|
62
62
|
})
|
|
63
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
63
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
64
64
|
(0, debug_1.debugSet)(TargetHeatingCoolingState, service, value);
|
|
65
65
|
try {
|
|
66
66
|
const shouldHeat = [TargetHeatingCoolingState.HEAT, TargetHeatingCoolingState.AUTO].includes(value);
|
|
@@ -84,7 +84,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
84
84
|
});
|
|
85
85
|
service
|
|
86
86
|
.getCharacteristic(CurrentTemperature)
|
|
87
|
-
.on("get" /* GET */, async (callback) => {
|
|
87
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
88
88
|
(0, debug_1.debugGet)(CurrentTemperature, service);
|
|
89
89
|
try {
|
|
90
90
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -99,7 +99,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
99
99
|
.getValue();
|
|
100
100
|
service
|
|
101
101
|
.getCharacteristic(TargetTemperature)
|
|
102
|
-
.on("get" /* GET */, async (callback) => {
|
|
102
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
103
103
|
(0, debug_1.debugGet)(TargetTemperature, service);
|
|
104
104
|
try {
|
|
105
105
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -111,7 +111,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
111
111
|
callback(err);
|
|
112
112
|
}
|
|
113
113
|
})
|
|
114
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
114
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
115
115
|
try {
|
|
116
116
|
(0, debug_1.debugSet)(TargetTemperature, service, value);
|
|
117
117
|
await client.put(`/devices/${deviceId}/endpoints/${endpointId}/data`, [
|
|
@@ -142,7 +142,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
142
142
|
service.addLinkedService(absenceModeService);
|
|
143
143
|
absenceModeService
|
|
144
144
|
.getCharacteristic(On)
|
|
145
|
-
.on("get" /* GET */, async (callback) => {
|
|
145
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
146
146
|
(0, debug_1.debugGet)(On, absenceModeService);
|
|
147
147
|
try {
|
|
148
148
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -157,7 +157,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
157
157
|
callback(err);
|
|
158
158
|
}
|
|
159
159
|
})
|
|
160
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
160
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
161
161
|
(0, debug_1.debugSet)(On, absenceModeService, value);
|
|
162
162
|
try {
|
|
163
163
|
const tydomValue = value ? 'ANTI_FROST' : 'NORMAL';
|
|
@@ -189,7 +189,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
189
189
|
service.addLinkedService(thermicLevelService);
|
|
190
190
|
thermicLevelService
|
|
191
191
|
.getCharacteristic(On)
|
|
192
|
-
.on("get" /* GET */, async (callback) => {
|
|
192
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
193
193
|
(0, debug_1.debugGet)(On, thermicLevelService);
|
|
194
194
|
try {
|
|
195
195
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -202,7 +202,7 @@ const setupThermostat = (accessory, controller) => {
|
|
|
202
202
|
callback(err);
|
|
203
203
|
}
|
|
204
204
|
})
|
|
205
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
205
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
206
206
|
(0, debug_1.debugSet)(On, thermicLevelService, value);
|
|
207
207
|
try {
|
|
208
208
|
const tydomValue = value ? thermicLevelValue : 'NORMAL';
|
|
@@ -36,7 +36,7 @@ const setupWindowCovering = (accessory, controller) => {
|
|
|
36
36
|
}, 250, { leading: true, trailing: true });
|
|
37
37
|
service
|
|
38
38
|
.getCharacteristic(PositionState)
|
|
39
|
-
.on("get" /* GET */, async (callback) => {
|
|
39
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
40
40
|
(0, debug_1.debugGet)(PositionState, service);
|
|
41
41
|
try {
|
|
42
42
|
// @NOTE Tydom does not track the current position
|
|
@@ -51,7 +51,7 @@ const setupWindowCovering = (accessory, controller) => {
|
|
|
51
51
|
.getValue();
|
|
52
52
|
service
|
|
53
53
|
.getCharacteristic(HoldPosition)
|
|
54
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
54
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
55
55
|
(0, debug_1.debugSet)(HoldPosition, service, value);
|
|
56
56
|
if (!value) {
|
|
57
57
|
// @NOTE asked to not hold position
|
|
@@ -71,7 +71,7 @@ const setupWindowCovering = (accessory, controller) => {
|
|
|
71
71
|
.getValue();
|
|
72
72
|
service
|
|
73
73
|
.getCharacteristic(CurrentPosition)
|
|
74
|
-
.on("get" /* GET */, async (callback) => {
|
|
74
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
75
75
|
(0, debug_1.debugGet)(CurrentPosition, service);
|
|
76
76
|
try {
|
|
77
77
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -87,7 +87,7 @@ const setupWindowCovering = (accessory, controller) => {
|
|
|
87
87
|
.getValue();
|
|
88
88
|
service
|
|
89
89
|
.getCharacteristic(TargetPosition)
|
|
90
|
-
.on("get" /* GET */, async (callback) => {
|
|
90
|
+
.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
91
91
|
(0, debug_1.debugGet)(TargetPosition, service);
|
|
92
92
|
try {
|
|
93
93
|
const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
@@ -100,7 +100,7 @@ const setupWindowCovering = (accessory, controller) => {
|
|
|
100
100
|
callback(err);
|
|
101
101
|
}
|
|
102
102
|
})
|
|
103
|
-
.on("set" /* SET */, async (value, callback) => {
|
|
103
|
+
.on("set" /* CharacteristicEventTypes.SET */, async (value, callback) => {
|
|
104
104
|
(0, debug_1.debugSet)(TargetPosition, service, value);
|
|
105
105
|
try {
|
|
106
106
|
const nextValue = value;
|
package/lib/controller.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { TydomHttpMessage, TydomResponse } from 'tydom-client/lib/utils/tydom';
|
|
|
6
6
|
import { TydomPlatformConfig } from './platform';
|
|
7
7
|
import { TydomAccessoryUpdateType } from './helpers';
|
|
8
8
|
import { TydomAccessoryContext, TydomConfigResponse, TydomGroupsResponse, TydomMetaResponse } from './typings/tydom';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type ControllerDevicePayload = TydomAccessoryContext;
|
|
10
|
+
export type ControllerUpdatePayload = {
|
|
11
11
|
type: TydomAccessoryUpdateType;
|
|
12
12
|
category: Categories;
|
|
13
13
|
updates: Record<string, unknown>[];
|
|
14
14
|
context: TydomAccessoryContext;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type ControllerNotificationPayload = {
|
|
17
17
|
level: string;
|
|
18
18
|
message: string;
|
|
19
19
|
};
|
|
@@ -2,15 +2,15 @@ import type { PlatformAccessory, Service, WithUUID } from 'homebridge';
|
|
|
2
2
|
import TydomController from '../controller';
|
|
3
3
|
import { TydomAccessoryContext } from '../typings/tydom';
|
|
4
4
|
export declare const SECURITY_SYSTEM_SENSORS: number;
|
|
5
|
-
export
|
|
5
|
+
export type ServiceClass = WithUUID<typeof Service>;
|
|
6
6
|
export declare const getAccessoryService: (accessory: PlatformAccessory, ServiceClass: ServiceClass) => Service;
|
|
7
7
|
export declare const getAccessoryServiceWithSubtype: (accessory: PlatformAccessory, ServiceClass: ServiceClass, subtype: string) => Service;
|
|
8
8
|
export declare const addAccessoryService: (accessory: PlatformAccessory, service: ServiceClass, name: string, removeExisting?: boolean) => Service;
|
|
9
9
|
export declare const addAccessoryServiceWithSubtype: (accessory: PlatformAccessory, service: ServiceClass, name: string, subtype: string, removeExisting?: boolean) => Service;
|
|
10
|
-
|
|
10
|
+
type TydomAccessorySetup = (accessory: PlatformAccessory, controller: TydomController) => void | Promise<void>;
|
|
11
11
|
export declare const getTydomAccessorySetup: (accessory: PlatformAccessory) => TydomAccessorySetup;
|
|
12
|
-
export
|
|
13
|
-
|
|
12
|
+
export type TydomAccessoryUpdateType = 'data' | 'cdata';
|
|
13
|
+
type TydomAccessoryUpdate = (accessory: PlatformAccessory, controller: TydomController, updates: Record<string, unknown>[], type: TydomAccessoryUpdateType) => void | Promise<void>;
|
|
14
14
|
export declare const getTydomAccessoryDataUpdate: (accessory: PlatformAccessory) => TydomAccessoryUpdate;
|
|
15
15
|
export declare const setupAccessoryInformationService: (accessory: PlatformAccessory, _controller: TydomController) => void;
|
|
16
16
|
export declare const setupAccessoryIdentifyHandler: (accessory: PlatformAccessory, _controller: TydomController) => void;
|
package/lib/helpers/accessory.js
CHANGED
|
@@ -13,7 +13,7 @@ const windowCovering_1 = require("../accessories/windowCovering");
|
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
14
|
const hap_1 = require("../config/hap");
|
|
15
15
|
const outlet_1 = require("../accessories/outlet");
|
|
16
|
-
exports.SECURITY_SYSTEM_SENSORS = parseInt(`${11 /* SECURITY_SYSTEM */}0`);
|
|
16
|
+
exports.SECURITY_SYSTEM_SENSORS = parseInt(`${11 /* Categories.SECURITY_SYSTEM */}0`);
|
|
17
17
|
const getAccessoryService = (accessory, ServiceClass) => {
|
|
18
18
|
const service = accessory.getService(ServiceClass);
|
|
19
19
|
(0, utils_1.assert)(service, `Unexpected missing service "${ServiceClass.name}" in accessory`);
|
|
@@ -51,24 +51,24 @@ exports.addAccessoryServiceWithSubtype = addAccessoryServiceWithSubtype;
|
|
|
51
51
|
const getTydomAccessorySetup = (accessory) => {
|
|
52
52
|
const { category } = accessory;
|
|
53
53
|
switch (category) {
|
|
54
|
-
case 5 /* LIGHTBULB */:
|
|
54
|
+
case 5 /* Categories.LIGHTBULB */:
|
|
55
55
|
return lightbulb_1.setupLightbulb;
|
|
56
|
-
case 7 /* OUTLET */:
|
|
56
|
+
case 7 /* Categories.OUTLET */:
|
|
57
57
|
return outlet_1.setupOutlet;
|
|
58
|
-
case 9 /* THERMOSTAT */:
|
|
58
|
+
case 9 /* Categories.THERMOSTAT */:
|
|
59
59
|
return thermostat_1.setupThermostat;
|
|
60
|
-
case 3 /* FAN */:
|
|
60
|
+
case 3 /* Categories.FAN */:
|
|
61
61
|
return fan_1.setupFan;
|
|
62
|
-
case 4 /* GARAGE_DOOR_OPENER */:
|
|
62
|
+
case 4 /* Categories.GARAGE_DOOR_OPENER */:
|
|
63
63
|
return garageDoorOpener_1.setupGarageDoorOpener;
|
|
64
|
-
case 14 /* WINDOW_COVERING */:
|
|
64
|
+
case 14 /* Categories.WINDOW_COVERING */:
|
|
65
65
|
return windowCovering_1.setupWindowCovering;
|
|
66
|
-
case 11 /* SECURITY_SYSTEM */:
|
|
66
|
+
case 11 /* Categories.SECURITY_SYSTEM */:
|
|
67
67
|
return securitySystem_1.setupSecuritySystem;
|
|
68
|
-
case 10 /* SENSOR */:
|
|
68
|
+
case 10 /* Categories.SENSOR */:
|
|
69
69
|
return temperatureSensor_1.setupTemperatureSensor;
|
|
70
|
-
case 13 /* WINDOW */:
|
|
71
|
-
case 12 /* DOOR */:
|
|
70
|
+
case 13 /* Categories.WINDOW */:
|
|
71
|
+
case 12 /* Categories.DOOR */:
|
|
72
72
|
return contactSensor_1.setupContactSensor;
|
|
73
73
|
case exports.SECURITY_SYSTEM_SENSORS:
|
|
74
74
|
return securitySystemSensors_1.setupSecuritySystemSensors;
|
|
@@ -80,26 +80,26 @@ exports.getTydomAccessorySetup = getTydomAccessorySetup;
|
|
|
80
80
|
const getTydomAccessoryDataUpdate = (accessory) => {
|
|
81
81
|
const { category } = accessory;
|
|
82
82
|
switch (category) {
|
|
83
|
-
case 5 /* LIGHTBULB */:
|
|
83
|
+
case 5 /* Categories.LIGHTBULB */:
|
|
84
84
|
return lightbulb_1.updateLightbulb;
|
|
85
|
-
case 7 /* OUTLET */:
|
|
85
|
+
case 7 /* Categories.OUTLET */:
|
|
86
86
|
return outlet_1.updateOutlet;
|
|
87
|
-
case 9 /* THERMOSTAT */:
|
|
87
|
+
case 9 /* Categories.THERMOSTAT */:
|
|
88
88
|
return thermostat_1.updateThermostat;
|
|
89
|
-
case 3 /* FAN */:
|
|
89
|
+
case 3 /* Categories.FAN */:
|
|
90
90
|
return fan_1.updateFan;
|
|
91
|
-
case 4 /* GARAGE_DOOR_OPENER */:
|
|
91
|
+
case 4 /* Categories.GARAGE_DOOR_OPENER */:
|
|
92
92
|
return () => {
|
|
93
93
|
// no-op
|
|
94
94
|
};
|
|
95
|
-
case 14 /* WINDOW_COVERING */:
|
|
95
|
+
case 14 /* Categories.WINDOW_COVERING */:
|
|
96
96
|
return windowCovering_1.updateWindowCovering;
|
|
97
|
-
case 11 /* SECURITY_SYSTEM */:
|
|
97
|
+
case 11 /* Categories.SECURITY_SYSTEM */:
|
|
98
98
|
return securitySystem_1.updateSecuritySystem;
|
|
99
|
-
case 10 /* SENSOR */:
|
|
99
|
+
case 10 /* Categories.SENSOR */:
|
|
100
100
|
return temperatureSensor_1.updateTemperatureSensor;
|
|
101
|
-
case 13 /* WINDOW */:
|
|
102
|
-
case 12 /* DOOR */:
|
|
101
|
+
case 13 /* Categories.WINDOW */:
|
|
102
|
+
case 12 /* Categories.DOOR */:
|
|
103
103
|
return contactSensor_1.updateContactSensor;
|
|
104
104
|
case exports.SECURITY_SYSTEM_SENSORS:
|
|
105
105
|
return securitySystemSensors_1.updateSecuritySystemSensors;
|
|
@@ -124,7 +124,7 @@ exports.setupAccessoryInformationService = setupAccessoryInformationService;
|
|
|
124
124
|
const setupAccessoryIdentifyHandler = (accessory, _controller) => {
|
|
125
125
|
const { displayName: name, UUID: id } = accessory;
|
|
126
126
|
// listen for the "identify" event for this Accessory
|
|
127
|
-
accessory.on("identify" /* IDENTIFY */, ( /* paired: boolean, callback: VoidCallback */) => {
|
|
127
|
+
accessory.on("identify" /* AccessoryEventTypes.IDENTIFY */, ( /* paired: boolean, callback: VoidCallback */) => {
|
|
128
128
|
// debug({id, type: 'AccessoryEventTypes.IDENTIFY', paired});
|
|
129
129
|
(0, utils_1.debug)(`New identify request for device named="${name}" with id="${id}"`);
|
|
130
130
|
// callback();
|
package/lib/helpers/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/helpers/tydom.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { PlatformAccessory } from 'homebridge';
|
|
|
2
2
|
import TydomClient from 'tydom-client';
|
|
3
3
|
import { Categories } from '../config/hap';
|
|
4
4
|
import { AnyTydomDataValue, TydomConfigEndpoint, TydomEndpointData, TydomGroupsResponse, TydomMetaElement, TydomMetaEndpoint, TydomMetaResponse } from '../typings';
|
|
5
|
-
export
|
|
5
|
+
export type GetTydomDeviceDataOptions = {
|
|
6
6
|
deviceId: number;
|
|
7
7
|
endpointId: number;
|
|
8
8
|
accessory?: PlatformAccessory;
|
|
9
9
|
};
|
|
10
10
|
export declare const getTydomDeviceData: <T extends TydomEndpointData = TydomEndpointData>(client: TydomClient, { deviceId, endpointId }: GetTydomDeviceDataOptions) => Promise<T>;
|
|
11
|
-
export
|
|
11
|
+
export type RunTydomDeviceCommandOptions = {
|
|
12
12
|
deviceId: number;
|
|
13
13
|
endpointId: number;
|
|
14
14
|
searchParams?: Record<string, string>;
|
|
@@ -18,7 +18,7 @@ export declare const getTydomDataPropValue: <V extends AnyTydomDataValue = AnyTy
|
|
|
18
18
|
export declare const getEndpointDetailsFromMeta: ({ id_endpoint: endpointId, id_device: deviceId }: TydomConfigEndpoint, meta: TydomMetaResponse) => TydomMetaEndpoint;
|
|
19
19
|
export declare const getEndpointGroupIdFromGroups: ({ id_endpoint: endpointId, id_device: deviceId }: TydomConfigEndpoint, groups: TydomGroupsResponse) => number | null;
|
|
20
20
|
export declare const getEndpointSignatureFromMetadata: (metadata: TydomMetaElement[]) => string;
|
|
21
|
-
|
|
21
|
+
type ResolveEndpointCategoryOptions = {
|
|
22
22
|
firstUsage: string;
|
|
23
23
|
metadata: TydomMetaElement[];
|
|
24
24
|
};
|
package/lib/helpers/tydom.js
CHANGED
|
@@ -73,35 +73,35 @@ const getEndpointSignatureFromMetadata = (metadata) => metadata
|
|
|
73
73
|
.join('|');
|
|
74
74
|
exports.getEndpointSignatureFromMetadata = getEndpointSignatureFromMetadata;
|
|
75
75
|
const LEGACY_SUPPORTED_CATEGORIES_MAP = {
|
|
76
|
-
alarm: 11 /* SECURITY_SYSTEM */,
|
|
77
|
-
awning: 14 /* WINDOW_COVERING */,
|
|
78
|
-
belmDoor: 12 /* DOOR */,
|
|
79
|
-
gate: 4 /* GARAGE_DOOR_OPENER */,
|
|
80
|
-
garage_door: 4 /* GARAGE_DOOR_OPENER */,
|
|
81
|
-
hvac: 9 /* THERMOSTAT */,
|
|
82
|
-
light: 5 /* LIGHTBULB */,
|
|
83
|
-
shutter: 14 /* WINDOW_COVERING */,
|
|
84
|
-
window: 13 /* WINDOW */,
|
|
85
|
-
plug: 7 /* OUTLET */
|
|
76
|
+
alarm: 11 /* Categories.SECURITY_SYSTEM */,
|
|
77
|
+
awning: 14 /* Categories.WINDOW_COVERING */,
|
|
78
|
+
belmDoor: 12 /* Categories.DOOR */,
|
|
79
|
+
gate: 4 /* Categories.GARAGE_DOOR_OPENER */,
|
|
80
|
+
garage_door: 4 /* Categories.GARAGE_DOOR_OPENER */,
|
|
81
|
+
hvac: 9 /* Categories.THERMOSTAT */,
|
|
82
|
+
light: 5 /* Categories.LIGHTBULB */,
|
|
83
|
+
shutter: 14 /* Categories.WINDOW_COVERING */,
|
|
84
|
+
window: 13 /* Categories.WINDOW */,
|
|
85
|
+
plug: 7 /* Categories.OUTLET */
|
|
86
86
|
};
|
|
87
87
|
const ENDPOINTS_SIGNATURES_CATEGORIES = {
|
|
88
|
-
'alarm:0c6e1d33808fa50a0a921502f80d36430dfaeda5abfed2467f9f2b07821e4842': 11 /* SECURITY_SYSTEM */,
|
|
89
|
-
'alarm:aad768ee0367013a974276117fd5ed4834cc26e4d31acc88d35134731331b0e7': 11 /* SECURITY_SYSTEM */,
|
|
90
|
-
'alarm:6e33f7ee5e62b58f4e888c91a13fd9b9d868f3751cead5ea1252578ba86523a5': 11 /* SECURITY_SYSTEM */,
|
|
91
|
-
'awning:48f43ebab20eba438fa9cc2b6ce44311d3cfb01c5be84bf17599d9c152c348d3': 14 /* WINDOW_COVERING */,
|
|
92
|
-
'belmDoor:fb935867933d89b3058f09384f76fd63f3defb18cfb3172f60fa9f4f237f748b': 12 /* DOOR */,
|
|
93
|
-
'conso:16804a9994bce28275150db329a9c0b931ef7f20608c1a3d2ff248f58569f0d3': 10 /* SENSOR */,
|
|
94
|
-
'gate:83b0912c6fe14622219522922ea0347dcbf86bf9cfd3346a2eca8eac70ca8260': 4 /* GARAGE_DOOR_OPENER */,
|
|
95
|
-
'garage_door:83b0912c6fe14622219522922ea0347dcbf86bf9cfd3346a2eca8eac70ca8260': 4 /* GARAGE_DOOR_OPENER */,
|
|
96
|
-
'hvac:1bab47d1dd7e898b5dc2e9867b14dfb8bc9272c4cb0b5d1221da962d43a6ffb4': 9 /* THERMOSTAT */,
|
|
97
|
-
'hvac:17f933bec8ed29f9b2a2cd5280fb5b64806cf8a1c064c83950e350f491d7cb9f': 9 /* THERMOSTAT */,
|
|
98
|
-
'light:449e2a60377094cde10224cee91d378fb0ae373ae6ceea0ac2cbc1ed011bffa7': 5 /* LIGHTBULB */,
|
|
99
|
-
'light:fce45085835f4f2790ea3b17d208b5ace34935444d2535e75ba3f0a2ce86de5f': 5 /* LIGHTBULB */,
|
|
100
|
-
'shutter:c3fe8e2afa864e1a7a5c6676b4287a7b2f2a886a466baec3df8a1ec4f898ad6c': 14 /* WINDOW_COVERING */,
|
|
101
|
-
'window:fb935867933d89b3058f09384f76fd63f3defb18cfb3172f60fa9f4f237f748b': 13 /* WINDOW */,
|
|
102
|
-
'others:449e2a60377094cde10224cee91d378fb0ae373ae6ceea0ac2cbc1ed011bffa7': 5 /* LIGHTBULB */,
|
|
103
|
-
'hvac:16804a9994bce28275150db329a9c0b931ef7f20608c1a3d2ff248f58569f0d3': 10 /* SENSOR */,
|
|
104
|
-
'plug:2534c497ff8fb013a88da28d341adff5bc0ba77e1fc8ea8dcb8b8f1c9d62ce19':
|
|
88
|
+
'alarm:0c6e1d33808fa50a0a921502f80d36430dfaeda5abfed2467f9f2b07821e4842': 11 /* Categories.SECURITY_SYSTEM */,
|
|
89
|
+
'alarm:aad768ee0367013a974276117fd5ed4834cc26e4d31acc88d35134731331b0e7': 11 /* Categories.SECURITY_SYSTEM */,
|
|
90
|
+
'alarm:6e33f7ee5e62b58f4e888c91a13fd9b9d868f3751cead5ea1252578ba86523a5': 11 /* Categories.SECURITY_SYSTEM */,
|
|
91
|
+
'awning:48f43ebab20eba438fa9cc2b6ce44311d3cfb01c5be84bf17599d9c152c348d3': 14 /* Categories.WINDOW_COVERING */,
|
|
92
|
+
'belmDoor:fb935867933d89b3058f09384f76fd63f3defb18cfb3172f60fa9f4f237f748b': 12 /* Categories.DOOR */,
|
|
93
|
+
'conso:16804a9994bce28275150db329a9c0b931ef7f20608c1a3d2ff248f58569f0d3': 10 /* Categories.SENSOR */,
|
|
94
|
+
'gate:83b0912c6fe14622219522922ea0347dcbf86bf9cfd3346a2eca8eac70ca8260': 4 /* Categories.GARAGE_DOOR_OPENER */,
|
|
95
|
+
'garage_door:83b0912c6fe14622219522922ea0347dcbf86bf9cfd3346a2eca8eac70ca8260': 4 /* Categories.GARAGE_DOOR_OPENER */,
|
|
96
|
+
'hvac:1bab47d1dd7e898b5dc2e9867b14dfb8bc9272c4cb0b5d1221da962d43a6ffb4': 9 /* Categories.THERMOSTAT */,
|
|
97
|
+
'hvac:17f933bec8ed29f9b2a2cd5280fb5b64806cf8a1c064c83950e350f491d7cb9f': 9 /* Categories.THERMOSTAT */,
|
|
98
|
+
'light:449e2a60377094cde10224cee91d378fb0ae373ae6ceea0ac2cbc1ed011bffa7': 5 /* Categories.LIGHTBULB */,
|
|
99
|
+
'light:fce45085835f4f2790ea3b17d208b5ace34935444d2535e75ba3f0a2ce86de5f': 5 /* Categories.LIGHTBULB */,
|
|
100
|
+
'shutter:c3fe8e2afa864e1a7a5c6676b4287a7b2f2a886a466baec3df8a1ec4f898ad6c': 14 /* Categories.WINDOW_COVERING */,
|
|
101
|
+
'window:fb935867933d89b3058f09384f76fd63f3defb18cfb3172f60fa9f4f237f748b': 13 /* Categories.WINDOW */,
|
|
102
|
+
'others:449e2a60377094cde10224cee91d378fb0ae373ae6ceea0ac2cbc1ed011bffa7': 5 /* Categories.LIGHTBULB */,
|
|
103
|
+
'hvac:16804a9994bce28275150db329a9c0b931ef7f20608c1a3d2ff248f58569f0d3': 10 /* Categories.SENSOR */,
|
|
104
|
+
'plug:2534c497ff8fb013a88da28d341adff5bc0ba77e1fc8ea8dcb8b8f1c9d62ce19': 7 /* Categories.OUTLET */ // @Neo33ASM (Easy Plug)
|
|
105
105
|
};
|
|
106
106
|
const resolveEndpointCategory = ({ firstUsage, metadata }) => {
|
|
107
107
|
// Compute device signature
|
package/lib/helpers/webhook.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Webhook = {
|
|
2
2
|
url: string;
|
|
3
3
|
type: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type WebhookPayload = {
|
|
6
6
|
message: string;
|
|
7
7
|
level?: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type DiscordPayload = {
|
|
10
10
|
content: string;
|
|
11
11
|
username?: string;
|
|
12
12
|
avatar_url?: string;
|
package/lib/platform.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Categories } from './config/hap';
|
|
|
3
3
|
import TydomController, { ControllerDevicePayload, ControllerNotificationPayload, ControllerUpdatePayload } from './controller';
|
|
4
4
|
import { Webhook } from './helpers';
|
|
5
5
|
import { TydomAccessoryContext } from './typings/tydom';
|
|
6
|
-
export
|
|
6
|
+
export type TydomPlatformConfig = PlatformConfig & {
|
|
7
7
|
hostname: string;
|
|
8
8
|
username: string;
|
|
9
9
|
password: string;
|
package/lib/platform.js
CHANGED
|
@@ -93,7 +93,7 @@ class TydomPlatform {
|
|
|
93
93
|
async createAccessory(name, id, category, context) {
|
|
94
94
|
const { platformAccessory: PlatformAccessory } = this.api;
|
|
95
95
|
const { group } = context;
|
|
96
|
-
const accessoryName = category === 13 /* WINDOW */ && group ? group.name || name : name;
|
|
96
|
+
const accessoryName = category === 13 /* Categories.WINDOW */ && group ? group.name || name : name;
|
|
97
97
|
this.log.info(`Creating accessory named="${accessoryName}" with id="${id}"`);
|
|
98
98
|
const accessory = new PlatformAccessory(accessoryName, id, category);
|
|
99
99
|
Object.assign(accessory.context, context);
|
package/lib/typings/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/typings/tydom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Categories } from '../config/hap';
|
|
2
|
-
export
|
|
2
|
+
export type TydomAccessoryContext<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
3
|
name: string;
|
|
4
4
|
category: Categories;
|
|
5
5
|
metadata: TydomMetaElement[];
|
|
@@ -13,8 +13,8 @@ export declare type TydomAccessoryContext<T extends Record<string, unknown> = Re
|
|
|
13
13
|
group?: TydomConfigGroup;
|
|
14
14
|
state: T;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
16
|
+
export type TydomAccessoryUpdateContext = Pick<TydomAccessoryContext, 'category' | 'deviceId' | 'endpointId' | 'accessoryId'>;
|
|
17
|
+
export type TydomConfigEndpoint = {
|
|
18
18
|
id_endpoint: number;
|
|
19
19
|
id_device: number;
|
|
20
20
|
picto: string;
|
|
@@ -22,18 +22,18 @@ export declare type TydomConfigEndpoint = {
|
|
|
22
22
|
first_usage: string;
|
|
23
23
|
last_usage: string;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type TydomConfigGroup = {
|
|
26
26
|
picto: string;
|
|
27
27
|
name: string;
|
|
28
28
|
group_all: boolean;
|
|
29
29
|
usage: string;
|
|
30
30
|
id: number;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type TydomConfigResponse = {
|
|
33
33
|
endpoints: TydomConfigEndpoint[];
|
|
34
34
|
groups: TydomConfigGroup[];
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type TydomGroupsResponse = {
|
|
37
37
|
groups: Array<{
|
|
38
38
|
id: number;
|
|
39
39
|
devices: Array<{
|
|
@@ -44,7 +44,7 @@ export declare type TydomGroupsResponse = {
|
|
|
44
44
|
}>;
|
|
45
45
|
}>;
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type TydomMetaElement = {
|
|
48
48
|
enum_values?: string[];
|
|
49
49
|
max?: number;
|
|
50
50
|
min?: number;
|
|
@@ -54,30 +54,30 @@ export declare type TydomMetaElement = {
|
|
|
54
54
|
type: 'boolean' | 'string' | 'numeric';
|
|
55
55
|
unit?: 'boolean' | '%';
|
|
56
56
|
};
|
|
57
|
-
export
|
|
57
|
+
export type TydomMetaEndpoint = {
|
|
58
58
|
id: number;
|
|
59
59
|
error: number;
|
|
60
60
|
metadata: TydomMetaElement[];
|
|
61
61
|
};
|
|
62
|
-
export
|
|
62
|
+
export type TydomMetaResponse = Array<{
|
|
63
63
|
id: number;
|
|
64
64
|
endpoints: TydomMetaEndpoint[];
|
|
65
65
|
}>;
|
|
66
|
-
export
|
|
67
|
-
export
|
|
66
|
+
export type AnyTydomDataValue = string | number | boolean;
|
|
67
|
+
export type TydomDataElement<K = string, V = AnyTydomDataValue> = {
|
|
68
68
|
name: K;
|
|
69
69
|
validity: 'expired' | 'upToDate';
|
|
70
70
|
value: V;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
72
|
+
export type TydomEndpointDataResponse = {
|
|
73
73
|
error: number;
|
|
74
74
|
data: TydomDataElement[];
|
|
75
75
|
};
|
|
76
|
-
export
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
export
|
|
80
|
-
export
|
|
76
|
+
export type TydomEndpointData = TydomDataElement[];
|
|
77
|
+
export type TydomDeviceThermostatAuthorization = 'STOP' | 'HEATING';
|
|
78
|
+
export type TydomDeviceThermostatHvacMode = 'NORMAL' | 'STOP' | 'ANTI_FROST';
|
|
79
|
+
export type TydomDeviceThermostatThermicLevel = 'ECO' | 'MODERATO' | 'MEDIO' | 'COMFORT' | 'STOP' | 'ANTI_FROST';
|
|
80
|
+
export type TydomDeviceThermostatData = [
|
|
81
81
|
TydomDataElement<'authorization', TydomDeviceThermostatAuthorization>,
|
|
82
82
|
TydomDataElement<'setpoint', number>,
|
|
83
83
|
TydomDataElement<'thermicLevel', TydomDeviceThermostatThermicLevel>,
|
|
@@ -97,7 +97,7 @@ export declare type TydomDeviceThermostatData = [
|
|
|
97
97
|
TydomDataElement<'tempSensorOpenCirc', boolean>,
|
|
98
98
|
TydomDataElement<'boostOn', boolean>
|
|
99
99
|
];
|
|
100
|
-
export
|
|
100
|
+
export type TydomDeviceShutterData = [
|
|
101
101
|
TydomDataElement<'battDefect', boolean>,
|
|
102
102
|
TydomDataElement<'intrusion', boolean>,
|
|
103
103
|
TydomDataElement<'obstacleDefect', boolean>,
|
|
@@ -105,10 +105,10 @@ export declare type TydomDeviceShutterData = [
|
|
|
105
105
|
TydomDataElement<'position', number>,
|
|
106
106
|
TydomDataElement<'thermicDefect', boolean>
|
|
107
107
|
];
|
|
108
|
-
export
|
|
109
|
-
export
|
|
110
|
-
export
|
|
111
|
-
export
|
|
108
|
+
export type TydomDeviceSecuritySystemAlarmState = 'OFF' | 'DELAYED' | 'ON' | 'QUIET';
|
|
109
|
+
export type TydomDeviceSecuritySystemAlarmMode = 'OFF' | 'ON' | 'TEST' | 'ZONE' | 'MAINTENANCE';
|
|
110
|
+
export type TydomDeviceSecuritySystemZoneState = 'UNUSED' | 'ON' | 'OFF';
|
|
111
|
+
export type TydomDeviceSecuritySystemData = [
|
|
112
112
|
TydomDataElement<'alarmState', 'OFF' | 'DELAYED' | 'ON' | 'QUIET'>,
|
|
113
113
|
TydomDataElement<'alarmMode', TydomDeviceSecuritySystemAlarmMode>,
|
|
114
114
|
TydomDataElement<'alarmTechnical', boolean>,
|
|
@@ -144,7 +144,7 @@ export declare type TydomDeviceSecuritySystemData = [
|
|
|
144
144
|
TydomDataElement<'irv3State', 'AVAILABLE' | 'UNAVAILABLE' | 'LOCKED'>,
|
|
145
145
|
TydomDataElement<'irv4State', 'AVAILABLE' | 'UNAVAILABLE' | 'LOCKED'>
|
|
146
146
|
];
|
|
147
|
-
export
|
|
147
|
+
export type TydomDeviceDataUpdateBody = {
|
|
148
148
|
id: number;
|
|
149
149
|
endpoints: {
|
|
150
150
|
id: number;
|
|
@@ -153,7 +153,7 @@ export declare type TydomDeviceDataUpdateBody = {
|
|
|
153
153
|
cdata: Record<string, unknown>[];
|
|
154
154
|
}[];
|
|
155
155
|
}[];
|
|
156
|
-
export
|
|
156
|
+
export type SecuritySystemProduct = {
|
|
157
157
|
typeShort: string;
|
|
158
158
|
typeLong: string;
|
|
159
159
|
id: number;
|
|
@@ -161,7 +161,7 @@ export declare type SecuritySystemProduct = {
|
|
|
161
161
|
nameCustom?: string;
|
|
162
162
|
number?: number;
|
|
163
163
|
};
|
|
164
|
-
export
|
|
164
|
+
export type SecuritySystemLabelCommandResult = {
|
|
165
165
|
zones: {
|
|
166
166
|
id: number;
|
|
167
167
|
nameStd?: string;
|
|
@@ -169,13 +169,13 @@ export declare type SecuritySystemLabelCommandResult = {
|
|
|
169
169
|
}[];
|
|
170
170
|
products: SecuritySystemProduct[];
|
|
171
171
|
};
|
|
172
|
-
export
|
|
172
|
+
export type SecuritySystemHistoOpenIssuesCommandResult = {
|
|
173
173
|
step: number;
|
|
174
174
|
nbElemTot: number;
|
|
175
175
|
index: number;
|
|
176
176
|
product?: SecuritySystemProduct;
|
|
177
177
|
};
|
|
178
|
-
export
|
|
178
|
+
export type SecuritySystemAlarmEvent = {
|
|
179
179
|
name: 'arret' | 'preAlarm' | 'arretZone' | 'marcheZone' | 'marcheTotale' | 'refusMiseEnMarche' | 'preavisMarcheAuto' | 'alarmIntrusion' | 'passageEnMaintenance';
|
|
180
180
|
date: string;
|
|
181
181
|
zones: Array<{
|
package/lib/utils/debug.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import createDebug from 'debug';
|
|
2
2
|
import { Characteristic } from '../config/hap';
|
|
3
3
|
import type { PlatformAccessory, Service } from 'homebridge';
|
|
4
|
-
|
|
4
|
+
type IdentifiableAccessoryObject = PlatformAccessory | Service;
|
|
5
5
|
export declare const debug: createDebug.Debugger;
|
|
6
6
|
export declare const enableDebug: () => void;
|
|
7
7
|
export declare const dir: (...args: unknown[]) => void;
|
package/lib/utils/hash.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
|
-
export declare const decode: (string?: string
|
|
2
|
+
export declare const decode: (string?: string) => string;
|
|
3
3
|
export declare const sha256: (data: crypto.BinaryLike) => Promise<string>;
|
|
4
4
|
export declare const sha256Sync: (data: crypto.BinaryLike) => string;
|
package/lib/utils/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/utils/request.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { IncomingMessage } from 'http';
|
|
3
4
|
import { RequestOptions } from 'https';
|
|
4
|
-
export
|
|
5
|
+
export type PostJsonOptions = Omit<RequestOptions, 'hostname' | 'path'> & {
|
|
5
6
|
url: string;
|
|
6
7
|
json?: Record<string, unknown>;
|
|
7
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-tydom",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Homebridge plugin to manage Tydom devices by Delta Dore",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -28,34 +28,34 @@
|
|
|
28
28
|
"prettycheck": "prettier --check src/",
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"test": "npm run lint && npm run prettycheck && npm run typecheck",
|
|
31
|
-
"
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"chalk": "^4.
|
|
35
|
-
"debug": "^4.3.
|
|
34
|
+
"chalk": "^4.0.0",
|
|
35
|
+
"debug": "^4.3.4",
|
|
36
36
|
"fakegato-history": "^0.6.3",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"source-map-support": "^0.5.21",
|
|
39
39
|
"tydom-client": "^0.13.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tsconfig/node10": "^1.0.
|
|
42
|
+
"@tsconfig/node10": "^1.0.9",
|
|
43
43
|
"@types/debug": "^4.1.7",
|
|
44
|
-
"@types/jest": "^
|
|
45
|
-
"@types/lodash": "^4.14.
|
|
46
|
-
"@types/node": "^
|
|
47
|
-
"@types/node-persist": "^3.1.
|
|
48
|
-
"@types/ws": "^8.
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
50
|
-
"@typescript-eslint/parser": "^5.
|
|
51
|
-
"eslint": "^8.
|
|
52
|
-
"eslint-config-prettier": "^8.
|
|
53
|
-
"eslint-plugin-prettier": "^4.
|
|
54
|
-
"homebridge": "^1.
|
|
55
|
-
"jest": "^
|
|
56
|
-
"nock": "^13.2.
|
|
57
|
-
"prettier": "^2.
|
|
58
|
-
"ts-node": "^10.
|
|
59
|
-
"typescript": "^4.
|
|
44
|
+
"@types/jest": "^29.2.3",
|
|
45
|
+
"@types/lodash": "^4.14.190",
|
|
46
|
+
"@types/node": "^18.11.9",
|
|
47
|
+
"@types/node-persist": "^3.1.3",
|
|
48
|
+
"@types/ws": "^8.5.3",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
|
50
|
+
"@typescript-eslint/parser": "^5.44.0",
|
|
51
|
+
"eslint": "^8.28.0",
|
|
52
|
+
"eslint-config-prettier": "^8.5.0",
|
|
53
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
54
|
+
"homebridge": "^1.5.1",
|
|
55
|
+
"jest": "^29.3.1",
|
|
56
|
+
"nock": "^13.2.9",
|
|
57
|
+
"prettier": "^2.8.0",
|
|
58
|
+
"ts-node": "^10.9.1",
|
|
59
|
+
"typescript": "^4.9.3"
|
|
60
60
|
}
|
|
61
61
|
}
|