eufy-security-client 2.2.3 → 2.3.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 +19 -0
- package/build/eufysecurity.d.ts +4 -0
- package/build/eufysecurity.js +53 -4
- package/build/eufysecurity.js.map +1 -1
- package/build/http/api.js +30 -4
- package/build/http/api.js.map +1 -1
- package/build/http/device.d.ts +2 -1
- package/build/http/device.js +108 -43
- package/build/http/device.js.map +1 -1
- package/build/http/interfaces.d.ts +6 -2
- package/build/http/station.d.ts +1 -0
- package/build/http/station.js +101 -10
- package/build/http/station.js.map +1 -1
- package/build/http/types.d.ts +18 -3
- package/build/http/types.js +166 -47
- package/build/http/types.js.map +1 -1
- package/build/http/utils.js +35 -23
- package/build/http/utils.js.map +1 -1
- package/build/interfaces.d.ts +4 -0
- package/build/mqtt/service.js +26 -3
- package/build/mqtt/service.js.map +1 -1
- package/build/p2p/session.d.ts +3 -0
- package/build/p2p/session.js +53 -18
- package/build/p2p/session.js.map +1 -1
- package/build/p2p/types.d.ts +1 -0
- package/build/p2p/types.js +1 -0
- package/build/p2p/types.js.map +1 -1
- package/build/p2p/utils.d.ts +2 -1
- package/build/p2p/utils.js +47 -9
- package/build/p2p/utils.js.map +1 -1
- package/build/push/client.js +26 -3
- package/build/push/client.js.map +1 -1
- package/build/push/parser.js +24 -1
- package/build/push/parser.js.map +1 -1
- package/build/push/service.js +32 -3
- package/build/push/service.js.map +1 -1
- package/build/push/utils.js +24 -1
- package/build/push/utils.js.map +1 -1
- package/build/utils.js +24 -1
- package/build/utils.js.map +1 -1
- package/package.json +7 -6
package/build/http/station.js
CHANGED
|
@@ -103,7 +103,7 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
103
103
|
this.updateProperty(property.name, property.default);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
if (!cloudOnlyProperties) {
|
|
106
|
+
if (!cloudOnlyProperties && this.rawStation.params) {
|
|
107
107
|
this.rawStation.params.forEach(param => {
|
|
108
108
|
this.updateRawProperty(param.param_type, param.param_value);
|
|
109
109
|
});
|
|
@@ -1041,7 +1041,7 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1041
1041
|
const property = device.getPropertyMetadata(propertyData.name);
|
|
1042
1042
|
(0, utils_3.validValue)(property, value);
|
|
1043
1043
|
this.log.debug(`Sending motion detection command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
|
|
1044
|
-
if (device.isIndoorCamera() || (device.isFloodLight() && device.getDeviceType() !== types_1.DeviceType.FLOODLIGHT) || device.isFloodLightT8420X()) {
|
|
1044
|
+
if (device.isIndoorCamera() || (device.isFloodLight() && device.getDeviceType() !== types_1.DeviceType.FLOODLIGHT) || device.isFloodLightT8420X() || device.isWiredDoorbellT8200X()) {
|
|
1045
1045
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
1046
1046
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
1047
1047
|
value: JSON.stringify({
|
|
@@ -1354,7 +1354,7 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1354
1354
|
property: propertyData
|
|
1355
1355
|
});
|
|
1356
1356
|
}
|
|
1357
|
-
else if (device.isSoloCameras()) {
|
|
1357
|
+
else if (device.isSoloCameras() || device.isWiredDoorbellT8200X()) {
|
|
1358
1358
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
1359
1359
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
1360
1360
|
value: JSON.stringify({
|
|
@@ -1549,6 +1549,20 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1549
1549
|
property: propertyData
|
|
1550
1550
|
});
|
|
1551
1551
|
}
|
|
1552
|
+
else if (device.isWiredDoorbellT8200X()) {
|
|
1553
|
+
await this.p2pSession.sendCommandWithStringPayload({
|
|
1554
|
+
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
1555
|
+
value: JSON.stringify({
|
|
1556
|
+
"commandType": types_2.CommandType.CMD_SET_DETECT_TYPE,
|
|
1557
|
+
"data": {
|
|
1558
|
+
"value": value,
|
|
1559
|
+
}
|
|
1560
|
+
}),
|
|
1561
|
+
channel: device.getChannel()
|
|
1562
|
+
}, {
|
|
1563
|
+
property: propertyData
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1552
1566
|
else {
|
|
1553
1567
|
throw new error_1.NotSupportedError(`This functionality is not implemented or supported by ${device.getSerial()}`);
|
|
1554
1568
|
}
|
|
@@ -1797,6 +1811,20 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1797
1811
|
property: propertyData
|
|
1798
1812
|
});
|
|
1799
1813
|
}
|
|
1814
|
+
else if (device.isWiredDoorbellT8200X()) {
|
|
1815
|
+
await this.p2pSession.sendCommandWithStringPayload({
|
|
1816
|
+
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
1817
|
+
value: JSON.stringify({
|
|
1818
|
+
"commandType": types_2.CommandType.CMD_INDOOR_SET_RECORD_AUDIO_ENABLE,
|
|
1819
|
+
"data": {
|
|
1820
|
+
"enable": value === true ? 1 : 0,
|
|
1821
|
+
}
|
|
1822
|
+
}),
|
|
1823
|
+
channel: device.getChannel()
|
|
1824
|
+
}, {
|
|
1825
|
+
property: propertyData
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1800
1828
|
else if (device.isWiredDoorbell()) {
|
|
1801
1829
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
1802
1830
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
@@ -1888,6 +1916,20 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1888
1916
|
property: propertyData
|
|
1889
1917
|
});
|
|
1890
1918
|
}
|
|
1919
|
+
else if (device.isWiredDoorbellT8200X()) {
|
|
1920
|
+
await this.p2pSession.sendCommandWithStringPayload({
|
|
1921
|
+
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
1922
|
+
value: JSON.stringify({
|
|
1923
|
+
"commandType": types_2.CommandType.CMD_T8200X_SET_RINGTONE_VOLUME,
|
|
1924
|
+
"data": {
|
|
1925
|
+
"status": value,
|
|
1926
|
+
}
|
|
1927
|
+
}),
|
|
1928
|
+
channel: device.getChannel()
|
|
1929
|
+
}, {
|
|
1930
|
+
property: propertyData
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1891
1933
|
else if (device.isWiredDoorbell()) {
|
|
1892
1934
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
1893
1935
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
@@ -2081,6 +2123,20 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
2081
2123
|
property: propertyData
|
|
2082
2124
|
});
|
|
2083
2125
|
}
|
|
2126
|
+
else if (device.isWiredDoorbellT8200X()) {
|
|
2127
|
+
await this.p2pSession.sendCommandWithStringPayload({
|
|
2128
|
+
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
2129
|
+
value: JSON.stringify({
|
|
2130
|
+
"commandType": types_2.CommandType.CMD_INDOOR_PUSH_NOTIFY_TYPE,
|
|
2131
|
+
"data": {
|
|
2132
|
+
"value": value,
|
|
2133
|
+
}
|
|
2134
|
+
}),
|
|
2135
|
+
channel: device.getChannel()
|
|
2136
|
+
}, {
|
|
2137
|
+
property: propertyData
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2084
2140
|
else if (device.isBatteryDoorbell() || device.isWiredDoorbellDual()) {
|
|
2085
2141
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
2086
2142
|
commandType: types_2.CommandType.CMD_SET_PAYLOAD,
|
|
@@ -3303,7 +3359,7 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
3303
3359
|
const property = device.getPropertyMetadata(propertyData.name);
|
|
3304
3360
|
(0, utils_3.validValue)(property, value);
|
|
3305
3361
|
let param_value = value === true ? 0 : 1;
|
|
3306
|
-
if ((device.isIndoorCamera() && !device.isIndoorCamMini()) || device.isWiredDoorbell() || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8422 || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8424 || device.isFloodLightT8420X())
|
|
3362
|
+
if ((device.isIndoorCamera() && !device.isIndoorCamMini()) || (device.isWiredDoorbell() && !device.isWiredDoorbellT8200X()) || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8422 || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8424 || device.isFloodLightT8420X())
|
|
3307
3363
|
param_value = value === true ? 1 : 0;
|
|
3308
3364
|
this.log.debug(`Sending enable device command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
|
|
3309
3365
|
if (device.isIndoorCamMini()) {
|
|
@@ -3441,8 +3497,8 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
3441
3497
|
}
|
|
3442
3498
|
this.log.debug(`Sending start livestream command to station ${this.getSerial()} for device ${device.getSerial()}`);
|
|
3443
3499
|
const rsa_key = this.p2pSession.getRSAPrivateKey();
|
|
3444
|
-
if (device.isSoloCameras() || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8423) {
|
|
3445
|
-
this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD (
|
|
3500
|
+
if (device.isSoloCameras() || device.getDeviceType() === types_1.DeviceType.FLOODLIGHT_CAMERA_8423 || device.isWiredDoorbellT8200X()) {
|
|
3501
|
+
this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD (1) for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
|
|
3446
3502
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
3447
3503
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
3448
3504
|
value: JSON.stringify({
|
|
@@ -3459,7 +3515,7 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
3459
3515
|
});
|
|
3460
3516
|
}
|
|
3461
3517
|
else if (device.isWiredDoorbell() || (device.isFloodLight() && device.getDeviceType() !== types_1.DeviceType.FLOODLIGHT) || device.isIndoorCamera() || (device.getSerial().startsWith("T8420") && (0, utils_1.isGreaterEqualMinVersion)("2.0.4.8", this.getSoftwareVersion()))) {
|
|
3462
|
-
this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
|
|
3518
|
+
this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD (2) for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
|
|
3463
3519
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
3464
3520
|
commandType: types_2.CommandType.CMD_DOORBELL_SET_PAYLOAD,
|
|
3465
3521
|
value: JSON.stringify({
|
|
@@ -6059,15 +6115,14 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
6059
6115
|
}
|
|
6060
6116
|
this.log.debug(`Sending snooze command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
|
|
6061
6117
|
if (device.isDoorbell()) {
|
|
6062
|
-
//TODO: To test if it works
|
|
6063
6118
|
await this.p2pSession.sendCommandWithStringPayload({
|
|
6064
6119
|
commandType: types_2.CommandType.CMD_SET_SNOOZE_MODE,
|
|
6065
6120
|
value: JSON.stringify({
|
|
6066
6121
|
"account_id": this.rawStation.member.admin_user_id,
|
|
6067
6122
|
"snooze_time": value.snooze_time,
|
|
6068
|
-
|
|
6123
|
+
"startTime": `${Math.trunc(new Date().getTime() / 1000)}`,
|
|
6069
6124
|
"chime_onoff": value.snooze_chime !== undefined && value.snooze_chime ? 1 : 0,
|
|
6070
|
-
"
|
|
6125
|
+
"motion_notify_onoff": value.snooze_motion !== undefined && value.snooze_motion ? 1 : 0,
|
|
6071
6126
|
"homebase_onoff": value.snooze_homebase !== undefined && value.snooze_homebase ? 1 : 0,
|
|
6072
6127
|
}),
|
|
6073
6128
|
channel: device.getChannel()
|
|
@@ -6632,6 +6687,42 @@ class Station extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
6632
6687
|
throw new error_1.NotSupportedError(`This functionality is not implemented or supported by ${device.getSerial()}`);
|
|
6633
6688
|
}
|
|
6634
6689
|
}
|
|
6690
|
+
async chimeHombase(value) {
|
|
6691
|
+
const commandData = {
|
|
6692
|
+
name: types_1.CommandName.StationChime,
|
|
6693
|
+
value: value
|
|
6694
|
+
};
|
|
6695
|
+
if (!this.hasCommand(commandData.name)) {
|
|
6696
|
+
throw new error_1.NotSupportedError(`This functionality is not implemented or supported by ${this.getSerial()}`);
|
|
6697
|
+
}
|
|
6698
|
+
if (this.rawStation.devices !== undefined) {
|
|
6699
|
+
this.rawStation.devices.forEach((device) => {
|
|
6700
|
+
if (device_1.Device.isDoorbell(device.device_type)) {
|
|
6701
|
+
throw new error_1.NotSupportedError(`This functionality is only supported on stations without registered Doorbells on it (${this.getSerial()})`);
|
|
6702
|
+
}
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6705
|
+
this.log.debug(`Sending homebase chime command to station ${this.getSerial()} with value: ${value}`);
|
|
6706
|
+
if (this.isStation()) {
|
|
6707
|
+
await this.p2pSession.sendCommandWithStringPayload({
|
|
6708
|
+
commandType: types_2.CommandType.CMD_SET_PAYLOAD,
|
|
6709
|
+
value: JSON.stringify({
|
|
6710
|
+
"account_id": this.rawStation.member.admin_user_id,
|
|
6711
|
+
"cmd": types_2.CommandType.CMD_BAT_DOORBELL_DINGDONG_R,
|
|
6712
|
+
"mValue3": 0,
|
|
6713
|
+
"payload": {
|
|
6714
|
+
"dingdong_ringtone": value,
|
|
6715
|
+
}
|
|
6716
|
+
}),
|
|
6717
|
+
channel: 0
|
|
6718
|
+
}, {
|
|
6719
|
+
command: commandData
|
|
6720
|
+
});
|
|
6721
|
+
}
|
|
6722
|
+
else {
|
|
6723
|
+
throw new error_1.NotSupportedError(`This functionality is not implemented or supported by ${this.getSerial()}`);
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6635
6726
|
}
|
|
6636
6727
|
exports.Station = Station;
|
|
6637
6728
|
Station.CHANNEL = 255;
|