eufy-security-client 3.6.0 → 3.7.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/.prettierignore/342/200/216 +8 -0
- package/.prettierrc +11 -0
- package/README.md +18 -0
- package/a.ts +61 -0
- package/build/error.js.map +1 -1
- package/build/eufysecurity.d.ts +1 -0
- package/build/eufysecurity.js +721 -224
- package/build/eufysecurity.js.map +1 -1
- package/build/http/api.d.ts +29 -0
- package/build/http/api.js +991 -701
- package/build/http/api.js.map +1 -1
- package/build/http/cache.js.map +1 -1
- package/build/http/const.d.ts +6 -1
- package/build/http/const.js +2044 -7536
- package/build/http/const.js.map +1 -1
- package/build/http/device.d.ts +4 -0
- package/build/http/device.js +1325 -440
- package/build/http/device.js.map +1 -1
- package/build/http/error.js.map +1 -1
- package/build/http/index.js.map +1 -1
- package/build/http/interfaces.d.ts +22 -15
- package/build/http/models.d.ts +2 -1
- package/build/http/parameter.js +74 -63
- package/build/http/parameter.js.map +1 -1
- package/build/http/station.d.ts +20 -2
- package/build/http/station.js +8639 -3566
- package/build/http/station.js.map +1 -1
- package/build/http/types.d.ts +12 -0
- package/build/http/types.js +297 -155
- package/build/http/types.js.map +1 -1
- package/build/http/utils.d.ts +16 -6
- package/build/http/utils.js +335 -208
- package/build/http/utils.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/interfaces.d.ts +4 -3
- package/build/logging.js +8 -13
- package/build/logging.js.map +1 -1
- package/build/mqtt/interface.d.ts +2 -2
- package/build/mqtt/service.js +12 -3
- package/build/mqtt/service.js.map +1 -1
- package/build/p2p/ble.js +7 -6
- package/build/p2p/ble.js.map +1 -1
- package/build/p2p/error.js.map +1 -1
- package/build/p2p/interfaces.d.ts +41 -6
- package/build/p2p/session.js +1484 -383
- package/build/p2p/session.js.map +1 -1
- package/build/p2p/talkback.js.map +1 -1
- package/build/p2p/types.js +36 -36
- package/build/p2p/types.js.map +1 -1
- package/build/p2p/utils.d.ts +10 -0
- package/build/p2p/utils.js +183 -90
- package/build/p2p/utils.js.map +1 -1
- package/build/push/client.js +15 -4
- package/build/push/client.js.map +1 -1
- package/build/push/error.js.map +1 -1
- package/build/push/interfaces.d.ts +8 -8
- package/build/push/models.js.map +1 -1
- package/build/push/parser.js +6 -2
- package/build/push/parser.js.map +1 -1
- package/build/push/service.js +214 -85
- package/build/push/service.js.map +1 -1
- package/build/push/types.js.map +1 -1
- package/build/push/utils.js.map +1 -1
- package/build/utils.js +7 -15
- package/build/utils.js.map +1 -1
- package/coverage/clover.xml +11133 -13648
- package/coverage/coverage-final.json +20 -30
- package/coverage/lcov-report/error.ts.html +3 -3
- package/coverage/lcov-report/index.html +50 -65
- package/coverage/lcov-report/logging.ts.html +598 -0
- package/coverage/lcov.info +21072 -25751
- package/dont-care.js +101 -0
- package/package.json +9 -5
- package/build/package.json +0 -81
package/dont-care.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const WebSocket = require('ws');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
|
|
4
|
+
const WS_URL = 'ws://192.168.50.9:3000';
|
|
5
|
+
|
|
6
|
+
const ws = new WebSocket(WS_URL);
|
|
7
|
+
let id = 0;
|
|
8
|
+
let videoChunks = [];
|
|
9
|
+
let outputPath = '';
|
|
10
|
+
|
|
11
|
+
const send = (cmd, params) => ws.send(JSON.stringify({ messageId: ++id, command: cmd, ...params }));
|
|
12
|
+
const formatDate = (d) => d.toISOString().slice(0, 10).replaceAll('-', '');
|
|
13
|
+
|
|
14
|
+
console.log('Connecting to', WS_URL);
|
|
15
|
+
|
|
16
|
+
ws.on('open', () => {
|
|
17
|
+
send('set_api_schema', { schemaVersion: 21 });
|
|
18
|
+
send('start_listening');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
ws.on('message', (data) => {
|
|
22
|
+
const msg = JSON.parse(data);
|
|
23
|
+
|
|
24
|
+
const stations = msg.result?.state?.stations;
|
|
25
|
+
if (stations?.length) {
|
|
26
|
+
console.log('Stations:', stations.join(', '));
|
|
27
|
+
const today = new Date(), tomorrow = new Date(today);
|
|
28
|
+
today.setDate(today.getDate() -1);
|
|
29
|
+
tomorrow.setDate(today.getDate() + 1);
|
|
30
|
+
stations.forEach(sn => {
|
|
31
|
+
if (sn === "T8030T2324021302") {
|
|
32
|
+
// if (sn === "T813452025312177") {
|
|
33
|
+
send('station.database_query_local', {
|
|
34
|
+
serialNumber: sn, serialNumbers: [],
|
|
35
|
+
startDate: formatDate(today), endDate: formatDate(tomorrow)
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
send('station.database_query_local', {
|
|
39
|
+
serialNumber: sn, serialNumbers: [sn],
|
|
40
|
+
startDate: formatDate(today), endDate: formatDate(tomorrow)
|
|
41
|
+
});
|
|
42
|
+
// send('station.get_commands', {
|
|
43
|
+
// serialNumber: sn
|
|
44
|
+
// });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const evt = msg.event?.event;
|
|
51
|
+
|
|
52
|
+
console.log(msg)
|
|
53
|
+
|
|
54
|
+
// if (evt === 'database count by date' && msg.event.data?.length) {
|
|
55
|
+
if (msg.messageId === 3) {
|
|
56
|
+
console.log("msg yess");
|
|
57
|
+
//console.log(msg.event.data)
|
|
58
|
+
//const r = msg.event.data[0];
|
|
59
|
+
//console.log(r)
|
|
60
|
+
//outputPath = './' + r.storage_path.split('/').pop().replace('.zxvideo', '.raw');
|
|
61
|
+
//console.log(`Found ${msg.event.data.length} events, downloading: ${r.storage_path}`);
|
|
62
|
+
|
|
63
|
+
//send('station.database_query_latest_info', { serialNumber: "T8030T2324021302" });
|
|
64
|
+
//station.database_query_latest_info
|
|
65
|
+
// send('device.start_download', { serialNumber: r.device_sn, path: r.storage_path, cipherId: r.cipher_id });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// if (evt === 'database query latest' && msg.event.data?.length) {
|
|
69
|
+
// console.log(msg.event.data);
|
|
70
|
+
// const r = msg.event.data[1];
|
|
71
|
+
// if (r.crop_local_path) {
|
|
72
|
+
// console.log("aaa");
|
|
73
|
+
// outputPath = './' + r.crop_local_path.split('/').pop().replace('.zxvideo', '.raw');
|
|
74
|
+
// console.log(outputPath);
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
//
|
|
80
|
+
// if (evt === 'download started') console.log('Download started...');
|
|
81
|
+
//
|
|
82
|
+
// if (evt === 'download video data' && msg.event.buffer?.data) {
|
|
83
|
+
// videoChunks.push(Buffer.from(msg.event.buffer.data));
|
|
84
|
+
// if (videoChunks.length % 100 === 0) process.stdout.write(` ${videoChunks.length} chunks\r`);
|
|
85
|
+
// }
|
|
86
|
+
//
|
|
87
|
+
// if (evt === 'download finished') {
|
|
88
|
+
// const buffer = Buffer.concat(videoChunks);
|
|
89
|
+
// fs.writeFileSync(outputPath, buffer);
|
|
90
|
+
// const mp4Path = outputPath.replace('.raw', '.mp4');
|
|
91
|
+
// console.log(`\nSaved ${buffer.length} bytes to ${outputPath}`);
|
|
92
|
+
// console.log(`Convert to mp4: ffmpeg -f h264 -i ${outputPath} -c:v copy -movflags +faststart ${mp4Path}`);
|
|
93
|
+
// ws.close();
|
|
94
|
+
// process.exit(0);
|
|
95
|
+
// }
|
|
96
|
+
|
|
97
|
+
if (msg.success === false) { console.log('ERROR:', msg.error); ws.close(); process.exit(1); }
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
ws.on('error', (e) => { console.error('Error:', e.message); process.exit(1); });
|
|
101
|
+
setTimeout(() => { console.log('Timeout'); ws.close(); process.exit(1); }, 120000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eufy-security-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Client to communicate with Eufy-Security devices",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bropat",
|
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
"build:ts": "tsc -p tsconfig.build.json && npm run copy-proto-build",
|
|
13
13
|
"copy-proto-build": "npx copyfiles -u 1 \"src/**/*.proto\" \"src/**/*.crt\" build",
|
|
14
14
|
"test": "jest --coverage",
|
|
15
|
+
"test:watch": "jest --watch",
|
|
15
16
|
"build": "npm run build:ts",
|
|
16
17
|
"watch:ts": "tsc -p tsconfig.build.json --watch",
|
|
17
18
|
"watch": "npm run watch:ts",
|
|
18
19
|
"lint": "eslint --ext .ts src",
|
|
19
|
-
"prepublishOnly": "tsc -p tsconfig.build.json && npm run copy-proto-build"
|
|
20
|
+
"prepublishOnly": "tsc -p tsconfig.build.json && npm run copy-proto-build",
|
|
21
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
22
|
+
"format:check": "prettier --check \"src/**/*.ts\""
|
|
20
23
|
},
|
|
21
24
|
"license": "MIT",
|
|
22
25
|
"keywords": [
|
|
@@ -42,18 +45,18 @@
|
|
|
42
45
|
"dependencies": {
|
|
43
46
|
"@cospired/i18n-iso-languages": "^4.2.0",
|
|
44
47
|
"crypto-js": "^4.2.0",
|
|
45
|
-
"date-and-time": "^4.
|
|
48
|
+
"date-and-time": "^4.2.0",
|
|
46
49
|
"fs-extra": "^11.3.3",
|
|
47
50
|
"got": "^14.4.2",
|
|
48
51
|
"i18n-iso-countries": "^7.12.0",
|
|
49
52
|
"image-type": "^5.2.0",
|
|
50
53
|
"long": "^5.2.3",
|
|
51
|
-
"mqtt": "^5.
|
|
54
|
+
"mqtt": "^5.15.0",
|
|
52
55
|
"node-rsa": "^1.1.1",
|
|
53
56
|
"node-schedule": "^2.1.1",
|
|
54
57
|
"p-throttle": "^8.1.0",
|
|
55
58
|
"protobufjs": "^8.0.0",
|
|
56
|
-
"qs": "^6.
|
|
59
|
+
"qs": "^6.14.2",
|
|
57
60
|
"sweet-collections": "^1.1.0",
|
|
58
61
|
"tiny-typed-emitter": "^2.1.0",
|
|
59
62
|
"typescript-logging": "^2.2.0",
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
"@typescript-eslint/parser": "^8.48.0 ",
|
|
71
74
|
"eslint": "^9.39.1",
|
|
72
75
|
"jest": "^29.7.0",
|
|
76
|
+
"prettier": "^3.8.1",
|
|
73
77
|
"ts-jest": "^29.4.6",
|
|
74
78
|
"typescript": "^5.9.3",
|
|
75
79
|
"typescript-eslint": "^8.49.0"
|
package/build/package.json
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eufy-security-client",
|
|
3
|
-
"version": "3.5.0",
|
|
4
|
-
"description": "Client to comunicate with Eufy-Security devices",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "bropat",
|
|
7
|
-
"email": "patrick.broetto@gmail.com"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/bropat/eufy-security-client",
|
|
10
|
-
"main": "build/index.js",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build:ts": "tsc -p tsconfig.build.json && npm run copy-proto-build",
|
|
13
|
-
"copy-proto-build": "npx copyfiles -u 1 \"src/**/*.proto\" \"src/**/*.crt\" build",
|
|
14
|
-
"test": "jest --coverage",
|
|
15
|
-
"build": "npm run build:ts",
|
|
16
|
-
"watch:ts": "tsc -p tsconfig.build.json --watch",
|
|
17
|
-
"watch": "npm run watch:ts",
|
|
18
|
-
"lint": "eslint --ext .ts src",
|
|
19
|
-
"prepublishOnly": "tsc -p tsconfig.build.json && npm run copy-proto-build"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"keywords": [
|
|
23
|
-
"eufy",
|
|
24
|
-
"eufycam",
|
|
25
|
-
"cam",
|
|
26
|
-
"cameras",
|
|
27
|
-
"security",
|
|
28
|
-
"eufy-security",
|
|
29
|
-
"doorbell",
|
|
30
|
-
"lock",
|
|
31
|
-
"keypad",
|
|
32
|
-
"smartlock",
|
|
33
|
-
"smartsafe"
|
|
34
|
-
],
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "https://github.com/bropat/eufy-security-client"
|
|
38
|
-
},
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=20.0.0"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@cospired/i18n-iso-languages": "^4.2.0",
|
|
44
|
-
"crypto-js": "^4.2.0",
|
|
45
|
-
"date-and-time": "^4.1.1",
|
|
46
|
-
"fs-extra": "^11.2.0",
|
|
47
|
-
"got": "^14.4.2",
|
|
48
|
-
"i18n-iso-countries": "^7.12.0",
|
|
49
|
-
"image-type": "^5.2.0",
|
|
50
|
-
"long": "^5.2.3",
|
|
51
|
-
"mqtt": "^5.10.1",
|
|
52
|
-
"node-rsa": "^1.1.1",
|
|
53
|
-
"node-schedule": "^2.1.1",
|
|
54
|
-
"p-throttle": "^8.1.0",
|
|
55
|
-
"protobufjs": "^7.4.0",
|
|
56
|
-
"qs": "^6.13.0",
|
|
57
|
-
"sweet-collections": "^1.1.0",
|
|
58
|
-
"tiny-typed-emitter": "^2.1.0",
|
|
59
|
-
"typescript-logging": "^2.2.0",
|
|
60
|
-
"typescript-logging-category-style": "^2.2.0"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@types/crypto-js": "^4.2.2",
|
|
64
|
-
"@types/jest": "^30.0.0",
|
|
65
|
-
"@types/node": "^20.16.10",
|
|
66
|
-
"@types/node-rsa": "^1.1.4",
|
|
67
|
-
"@types/node-schedule": "^2.1.7",
|
|
68
|
-
"@types/qs": "^6.9.16",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
70
|
-
"@typescript-eslint/parser": "^8.48.0 ",
|
|
71
|
-
"eslint": "^9.39.1",
|
|
72
|
-
"jest": "^30.2.0",
|
|
73
|
-
"ts-jest": "^29.4.6",
|
|
74
|
-
"typescript": "^5.9.3",
|
|
75
|
-
"typescript-eslint": "^8.49.0"
|
|
76
|
-
},
|
|
77
|
-
"bugs": {
|
|
78
|
-
"url": "https://github.com/bropat/eufy-security-client/issues"
|
|
79
|
-
},
|
|
80
|
-
"readmeFilename": "README.md"
|
|
81
|
-
}
|