eufy-security-client 2.2.2 → 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 +26 -0
- package/build/eufysecurity.d.ts +6 -0
- package/build/eufysecurity.js +72 -6
- package/build/eufysecurity.js.map +1 -1
- package/build/http/api.js +76 -37
- package/build/http/api.js.map +1 -1
- package/build/http/const.d.ts +3 -0
- package/build/http/const.js +8546 -0
- package/build/http/const.js.map +1 -0
- 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/error.d.ts +12 -0
- package/build/http/error.js +33 -1
- package/build/http/error.js.map +1 -1
- package/build/http/interfaces.d.ts +8 -2
- package/build/http/parameter.js +6 -1
- package/build/http/parameter.js.map +1 -1
- package/build/http/station.d.ts +2 -0
- package/build/http/station.js +252 -10
- package/build/http/station.js.map +1 -1
- package/build/http/types.d.ts +40 -4
- package/build/http/types.js +319 -48
- package/build/http/types.js.map +1 -1
- package/build/http/utils.d.ts +1 -1
- package/build/http/utils.js +42 -3045
- package/build/http/utils.js.map +1 -1
- package/build/interfaces.d.ts +7 -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 +54 -21
- 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/README.md
CHANGED
|
@@ -80,6 +80,32 @@ Please use GitHub issues for this.
|
|
|
80
80
|
|
|
81
81
|
## Changelog
|
|
82
82
|
|
|
83
|
+
### 2.3.0 (2022-11-26)
|
|
84
|
+
|
|
85
|
+
* (bropat) Added support for Wired Doorbell (T8200X)
|
|
86
|
+
* (bropat) Added new property `snoozeStartTime`, `snoozeHomebase`, `snoozeChime` and `snoozeMotion` to supported devices
|
|
87
|
+
* (bropat) Added debug information for analysed audio and video codecs at start of livestream
|
|
88
|
+
* (bropat/martijnpoppen) Added new command `stationChime` for supported stations
|
|
89
|
+
* (bropat) Implemented fallback for configured empty string for setting `trustedDeviceName`
|
|
90
|
+
* (bropat) Implemented missing Homebase 3 notification events
|
|
91
|
+
* (bropat) Fixed unknown video codec issue
|
|
92
|
+
* (bropat) Fixed issue #240
|
|
93
|
+
* (smitty078) Fixed issue #251
|
|
94
|
+
* (thieren) Fixed issue #256 (#255)
|
|
95
|
+
* (tyware) Fixed issue #257
|
|
96
|
+
* (bropat) Fixed issue #258
|
|
97
|
+
* (PhilippEngler) Change DeviceChargingStatusProperty value for eufyCam 3c (#254)
|
|
98
|
+
* (PhilippEngler) Fixed doubled property labels (#253)
|
|
99
|
+
* (martijnpoppen) FIX: keypad wifiSignalLevel property error (#245)
|
|
100
|
+
* (martijnpoppen) FIX: issue when params are not available for rawDevice/rawStation (#246)
|
|
101
|
+
|
|
102
|
+
### 2.2.3 (2022-11-12)
|
|
103
|
+
|
|
104
|
+
* (bropat) Added Station alarm properties
|
|
105
|
+
* (bropat) Added `connection error` event to HTTPApi and EufySecurity
|
|
106
|
+
* (bropat) Changed default value of `trustedDeviceName`
|
|
107
|
+
* (martijnpoppen) NEW: HB3 Vehicle Detection (#241)
|
|
108
|
+
|
|
83
109
|
### 2.2.2 (2022-11-06)
|
|
84
110
|
|
|
85
111
|
* (bropat) Fixed issue identifying alarm delay
|
package/build/eufysecurity.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
|
|
|
68
68
|
private updateDeviceProperties;
|
|
69
69
|
private onAPIClose;
|
|
70
70
|
private onAPIConnect;
|
|
71
|
+
private onAPIConnectionError;
|
|
71
72
|
startStationLivestream(deviceSN: string): Promise<void>;
|
|
72
73
|
startCloudLivestream(deviceSN: string): Promise<void>;
|
|
73
74
|
stopStationLivestream(deviceSN: string): Promise<void>;
|
|
@@ -110,6 +111,7 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
|
|
|
110
111
|
private onDeviceCryingDetected;
|
|
111
112
|
private onDeviceSoundDetected;
|
|
112
113
|
private onDevicePetDetected;
|
|
114
|
+
private onDeviceVehicleDetected;
|
|
113
115
|
private onDeviceMotionDetected;
|
|
114
116
|
private onDevicePersonDetected;
|
|
115
117
|
private onDeviceRings;
|
|
@@ -126,6 +128,10 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
|
|
|
126
128
|
private onDeviceLongTimeNotClose;
|
|
127
129
|
private onDeviceLowBattery;
|
|
128
130
|
private onDeviceJammed;
|
|
131
|
+
private onDeviceStrangerPersonDetected;
|
|
132
|
+
private onDeviceDogDetected;
|
|
133
|
+
private onDeviceDogLickDetected;
|
|
134
|
+
private onDeviceDogPoopDetected;
|
|
129
135
|
private onDeviceReady;
|
|
130
136
|
private onStationRuntimeState;
|
|
131
137
|
private onStationChargingState;
|
package/build/eufysecurity.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.EufySecurity = void 0;
|
|
4
27
|
const tiny_typed_emitter_1 = require("tiny-typed-emitter");
|
|
5
28
|
const ts_log_1 = require("ts-log");
|
|
6
|
-
const fse = require("fs-extra");
|
|
7
|
-
const path = require("path");
|
|
29
|
+
const fse = __importStar(require("fs-extra"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
8
31
|
const api_1 = require("./http/api");
|
|
9
32
|
const station_1 = require("./http/station");
|
|
10
33
|
const types_1 = require("./http/types");
|
|
@@ -17,6 +40,8 @@ const _1 = require(".");
|
|
|
17
40
|
const error_2 = require("./http/error");
|
|
18
41
|
const types_3 = require("./push/types");
|
|
19
42
|
const service_2 = require("./mqtt/service");
|
|
43
|
+
const const_1 = require("./http/const");
|
|
44
|
+
const utils_2 = require("./http/utils");
|
|
20
45
|
class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
21
46
|
constructor(config, log = ts_log_1.dummyLogger) {
|
|
22
47
|
super();
|
|
@@ -61,9 +86,6 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
61
86
|
if (this.config.language === undefined) {
|
|
62
87
|
this.config.language = "en";
|
|
63
88
|
}
|
|
64
|
-
if (this.config.trustedDeviceName === undefined) {
|
|
65
|
-
this.config.trustedDeviceName = "eufyclient";
|
|
66
|
-
}
|
|
67
89
|
if (this.config.eventDurationSeconds === undefined) {
|
|
68
90
|
this.config.eventDurationSeconds = 10;
|
|
69
91
|
}
|
|
@@ -110,6 +132,16 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
110
132
|
catch (error) {
|
|
111
133
|
this.log.error("Handling update - Error:", error);
|
|
112
134
|
}
|
|
135
|
+
if (this.config.trustedDeviceName === undefined || this.config.trustedDeviceName === "") {
|
|
136
|
+
if (this.persistentData.fallbackTrustedDeviceName !== undefined) {
|
|
137
|
+
this.config.trustedDeviceName = this.persistentData.fallbackTrustedDeviceName;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const rnd = (0, utils_2.randomNumber)(0, const_1.PhoneModels.length);
|
|
141
|
+
this.persistentData.fallbackTrustedDeviceName = const_1.PhoneModels[rnd];
|
|
142
|
+
this.config.trustedDeviceName = this.persistentData.fallbackTrustedDeviceName;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
113
145
|
this.api = await api_1.HTTPApi.initialize(this.config.country, this.config.username, this.config.password, this.log, this.persistentData.httpApi);
|
|
114
146
|
this.api.setLanguage(this.config.language);
|
|
115
147
|
this.api.setPhoneModel(this.config.trustedDeviceName);
|
|
@@ -121,6 +153,7 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
121
153
|
this.api.on("captcha request", (id, captcha) => this.onCaptchaRequest(id, captcha));
|
|
122
154
|
this.api.on("auth token invalidated", () => this.onAuthTokenInvalidated());
|
|
123
155
|
this.api.on("tfa request", () => this.onTfaRequest());
|
|
156
|
+
this.api.on("connection error", (error) => this.onAPIConnectionError(error));
|
|
124
157
|
if (this.persistentData.login_hash && this.persistentData.login_hash != "") {
|
|
125
158
|
this.log.debug("Load previous login_hash:", this.persistentData.login_hash);
|
|
126
159
|
if ((0, utils_1.md5)(`${this.config.username}:${this.config.password}`) != this.persistentData.login_hash) {
|
|
@@ -496,6 +529,7 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
496
529
|
device.on("crying detected", (device, state) => this.onDeviceCryingDetected(device, state));
|
|
497
530
|
device.on("sound detected", (device, state) => this.onDeviceSoundDetected(device, state));
|
|
498
531
|
device.on("pet detected", (device, state) => this.onDevicePetDetected(device, state));
|
|
532
|
+
device.on("vehicle detected", (device, state) => this.onDeviceVehicleDetected(device, state));
|
|
499
533
|
device.on("motion detected", (device, state) => this.onDeviceMotionDetected(device, state));
|
|
500
534
|
device.on("person detected", (device, state, person) => this.onDevicePersonDetected(device, state, person));
|
|
501
535
|
device.on("rings", (device, state) => this.onDeviceRings(device, state));
|
|
@@ -513,6 +547,10 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
513
547
|
device.on("long time not close", (device, state) => this.onDeviceLongTimeNotClose(device, state));
|
|
514
548
|
device.on("low battery", (device, state) => this.onDeviceLowBattery(device, state));
|
|
515
549
|
device.on("jammed", (device, state) => this.onDeviceJammed(device, state));
|
|
550
|
+
device.on("stranger person detected", (device, state) => this.onDeviceStrangerPersonDetected(device, state));
|
|
551
|
+
device.on("dog detected", (device, state) => this.onDeviceDogDetected(device, state));
|
|
552
|
+
device.on("dog lick detected", (device, state) => this.onDeviceDogLickDetected(device, state));
|
|
553
|
+
device.on("dog poop detected", (device, state) => this.onDeviceDogPoopDetected(device, state));
|
|
516
554
|
this.addDevice(device);
|
|
517
555
|
}
|
|
518
556
|
catch (error) {
|
|
@@ -658,6 +696,9 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
658
696
|
this.log.warn("No login data recevied to initialize MQTT connection...");
|
|
659
697
|
}
|
|
660
698
|
}
|
|
699
|
+
onAPIConnectionError(error) {
|
|
700
|
+
this.emit("connection error", error);
|
|
701
|
+
}
|
|
661
702
|
async startStationLivestream(deviceSN) {
|
|
662
703
|
const device = await this.getDevice(deviceSN);
|
|
663
704
|
const station = await this.getStation(device.getStationSerial());
|
|
@@ -1452,7 +1493,7 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1452
1493
|
device.updateProperty(types_1.PropertyName.DeviceSnoozeTime, snoozeTime);
|
|
1453
1494
|
}
|
|
1454
1495
|
this.api.refreshAllData().then(() => {
|
|
1455
|
-
const snoozeStartTime = device.getPropertyValue(types_1.PropertyName.
|
|
1496
|
+
const snoozeStartTime = device.getPropertyValue(types_1.PropertyName.DeviceSnoozeStartTime);
|
|
1456
1497
|
const currentTime = Math.trunc(new Date().getTime() / 1000);
|
|
1457
1498
|
let timeoutMS;
|
|
1458
1499
|
if (snoozeStartTime !== undefined && snoozeStartTime !== 0) {
|
|
@@ -1464,6 +1505,16 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1464
1505
|
this.deviceSnoozeTimeout[device.getSerial()] = setTimeout(() => {
|
|
1465
1506
|
device.updateProperty(types_1.PropertyName.DeviceSnooze, false);
|
|
1466
1507
|
device.updateProperty(types_1.PropertyName.DeviceSnoozeTime, 0);
|
|
1508
|
+
device.updateProperty(types_1.PropertyName.DeviceSnoozeStartTime, 0);
|
|
1509
|
+
if (device.hasProperty(types_1.PropertyName.DeviceSnoozeHomebase)) {
|
|
1510
|
+
device.updateProperty(types_1.PropertyName.DeviceSnoozeHomebase, false);
|
|
1511
|
+
}
|
|
1512
|
+
if (device.hasProperty(types_1.PropertyName.DeviceSnoozeMotion)) {
|
|
1513
|
+
device.updateProperty(types_1.PropertyName.DeviceSnoozeMotion, false);
|
|
1514
|
+
}
|
|
1515
|
+
if (device.hasProperty(types_1.PropertyName.DeviceSnoozeChime)) {
|
|
1516
|
+
device.updateProperty(types_1.PropertyName.DeviceSnoozeChime, false);
|
|
1517
|
+
}
|
|
1467
1518
|
delete this.deviceSnoozeTimeout[device.getSerial()];
|
|
1468
1519
|
}, timeoutMS);
|
|
1469
1520
|
}).catch(error => {
|
|
@@ -1632,6 +1683,9 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1632
1683
|
onDevicePetDetected(device, state) {
|
|
1633
1684
|
this.emit("device pet detected", device, state);
|
|
1634
1685
|
}
|
|
1686
|
+
onDeviceVehicleDetected(device, state) {
|
|
1687
|
+
this.emit("device vehicle detected", device, state);
|
|
1688
|
+
}
|
|
1635
1689
|
onDeviceMotionDetected(device, state) {
|
|
1636
1690
|
this.emit("device motion detected", device, state);
|
|
1637
1691
|
}
|
|
@@ -1680,6 +1734,18 @@ class EufySecurity extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
1680
1734
|
onDeviceJammed(device, state) {
|
|
1681
1735
|
this.emit("device jammed", device, state);
|
|
1682
1736
|
}
|
|
1737
|
+
onDeviceStrangerPersonDetected(device, state) {
|
|
1738
|
+
this.emit("device stranger person detected", device, state);
|
|
1739
|
+
}
|
|
1740
|
+
onDeviceDogDetected(device, state) {
|
|
1741
|
+
this.emit("device dog detected", device, state);
|
|
1742
|
+
}
|
|
1743
|
+
onDeviceDogLickDetected(device, state) {
|
|
1744
|
+
this.emit("device dog lick detected", device, state);
|
|
1745
|
+
}
|
|
1746
|
+
onDeviceDogPoopDetected(device, state) {
|
|
1747
|
+
this.emit("device dog poop detected", device, state);
|
|
1748
|
+
}
|
|
1683
1749
|
onDeviceReady(device) {
|
|
1684
1750
|
try {
|
|
1685
1751
|
if (device.getPropertyValue(types_1.PropertyName.DeviceRTSPStream) !== undefined && device.getPropertyValue(types_1.PropertyName.DeviceRTSPStream) === true) {
|