homebridge-tydom 0.23.13 → 0.23.14
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.
|
@@ -69,6 +69,23 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
69
69
|
}
|
|
70
70
|
let zones = [];
|
|
71
71
|
const initialData = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
|
|
72
|
+
const setTydomZones = async (zones, value) => {
|
|
73
|
+
if (!isLegacy) {
|
|
74
|
+
return await client.put(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=zoneCmd`, {
|
|
75
|
+
value,
|
|
76
|
+
pwd: pin,
|
|
77
|
+
zones
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
for (const zone in zones) {
|
|
82
|
+
await client.put(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=partCmd`, {
|
|
83
|
+
value,
|
|
84
|
+
part: zone
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
72
89
|
if (!isLegacy) {
|
|
73
90
|
try {
|
|
74
91
|
const labelResults = await client.command(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=label`);
|
|
@@ -174,24 +191,10 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
174
191
|
}
|
|
175
192
|
// Zones ON/OFF
|
|
176
193
|
if ([SecuritySystemTargetState.STAY_ARM, SecuritySystemTargetState.NIGHT_ARM].includes(value)) {
|
|
177
|
-
const tydomValue = value === SecuritySystemTargetState.DISARM ? 'OFF' : 'ON';
|
|
178
194
|
const targetZones = value === SecuritySystemTargetState.STAY_ARM ? aliases.stay : aliases.night;
|
|
195
|
+
const tydomValue = value === SecuritySystemTargetState.DISARM ? 'OFF' : 'ON';
|
|
179
196
|
if (Array.isArray(targetZones) && targetZones.length > 0) {
|
|
180
|
-
|
|
181
|
-
await client.put(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=zoneCmd`, {
|
|
182
|
-
value: tydomValue,
|
|
183
|
-
pwd: pin,
|
|
184
|
-
zones: targetZones
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
for (const zone in targetZones) {
|
|
189
|
-
await client.put(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=partCmd`, {
|
|
190
|
-
value: tydomValue,
|
|
191
|
-
part: zone
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
}
|
|
197
|
+
await setTydomZones(targetZones, tydomValue);
|
|
195
198
|
}
|
|
196
199
|
(0, debug_1.debugSetResult)(SecuritySystemTargetState, service, value, tydomValue);
|
|
197
200
|
callback();
|
|
@@ -287,12 +290,9 @@ const setupSecuritySystem = async (accessory, controller) => {
|
|
|
287
290
|
callback();
|
|
288
291
|
return;
|
|
289
292
|
}
|
|
293
|
+
const targetZones = [zoneIndex];
|
|
290
294
|
const tydomValue = value ? 'ON' : 'OFF';
|
|
291
|
-
await
|
|
292
|
-
value: tydomValue,
|
|
293
|
-
pwd: pin,
|
|
294
|
-
zones: [zoneIndex]
|
|
295
|
-
});
|
|
295
|
+
await setTydomZones(targetZones, tydomValue);
|
|
296
296
|
(0, debug_1.debugSetResult)(On, zoneService, value, tydomValue);
|
|
297
297
|
callback();
|
|
298
298
|
});
|