diff --git a/README.md b/README.md
index c0118688..1baee443 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,12 @@ Please use GitHub issues for this.
## Changelog
+### 2.8.1 (2023-08-31)
+
+* (bropat) Automatic detection of supported P2P encryption (none, type1, type2)
+* (bropat) Fixed regression introduced with activating p2p encryption for all devices (some older devices do not support it!)
+* (bropat) Updated versions of the package dependencies
+
### 2.8.0 (2023-08-20)
* (bropat) Implemented p2p data encryption for all supported commands
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index 99bee90f..18401f02 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,6 +1,6 @@
![logo](_media/eufy-security-client.png)
-# eufy-security-client 2.8.0
+# eufy-security-client 2.8.1
> This shared library allows to control [Eufy security devices](https://us.eufylife.com/collections/security) by connecting to the Eufy cloud servers and local/remote stations over p2p
diff --git a/docs/supported_devices.md b/docs/supported_devices.md
index b200076c..add30f56 100644
--- a/docs/supported_devices.md
+++ b/docs/supported_devices.md
@@ -24,7 +24,7 @@
| ![T8420X image](_media/floodlight_small.jpg) | Floodlight Camera (T8420X) | :heavy_check_mark: | Firmware: 2.0.6.1 (20220824) |
| ![T8422 image](_media/floodlight_small.jpg) | Floodlight Cam (T8422) | :heavy_check_mark: | |
| ![T8423 image](_media/floodlight2pro_small.jpg) | Floodlight Cam 2 Pro (T8423) | :heavy_check_mark: | Firmware: 1.0.7.4 (20211219) |
-| ![T8424 image](_media/floodlight2_small.jpg) | Floodlight Cam 2 (T8424) | :heavy_check_mark: | |
+| ![T8424 image](_media/floodlight2_small.jpg) | Floodlight Cam 2 (T8424) | :heavy_check_mark: | Firmware: 2.0.8.8 (20230807) |
| ![T84A1 image](_media/walllight_s100_small.jpg) | Wired Wall Light Cam S100 (T84A1) | :heavy_check_mark: | Firmware: 1.0.8.2 (20230521) |
| ![T8200 image](_media/wireddoorbell2k_small.jpg) | Wired Doorbell 2k (T8200) | :heavy_check_mark: | |
| ![T8200X image](_media/wireddoorbell2k_small.jpg) | Wired Doorbell 2k (T8200X) | :heavy_check_mark: | Firmware: 2.0.6.0 (20220826) |
diff --git a/package-lock.json b/package-lock.json
index 412e473a..134a38b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "eufy-security-client",
- "version": "2.8.0",
+ "version": "2.8.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "eufy-security-client",
- "version": "2.8.0",
+ "version": "2.8.1",
"license": "MIT",
"dependencies": {
"@cospired/i18n-iso-languages": "^4.1.0",
@@ -17,11 +17,11 @@
"i18n-iso-countries": "^7.6.0",
"image-type": "^4.1.0",
"long": "^5.2.3",
- "mqtt": "^5.0.3",
+ "mqtt": "^5.0.4",
"node-rsa": "^1.1.1",
"node-schedule": "^2.1.1",
"p-throttle": "^4.1.1",
- "protobufjs": "^7.2.4",
+ "protobufjs": "^7.2.5",
"qs": "^6.11.2",
"sweet-collections": "^1.1.0",
"tiny-typed-emitter": "^2.1.0",
@@ -30,14 +30,14 @@
"devDependencies": {
"@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^11.0.1",
- "@types/node": "^16.18.41",
+ "@types/node": "^16.18.46",
"@types/node-rsa": "^1.1.1",
"@types/node-schedule": "^2.1.0",
"@types/qs": "^6.9.7",
- "@typescript-eslint/eslint-plugin": "^6.4.0",
- "@typescript-eslint/parser": "^6.4.0",
- "eslint": "^8.47.0",
- "typescript": "^5.1.6"
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
+ "@typescript-eslint/parser": "^6.5.0",
+ "eslint": "^8.48.0",
+ "typescript": "^5.2.2"
},
"engines": {
"node": ">=16.9.0"
@@ -108,9 +108,9 @@
}
},
"node_modules/@eslint/js": {
- "version": "8.47.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz",
- "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==",
+ "version": "8.48.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
+ "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -321,9 +321,9 @@
}
},
"node_modules/@types/node": {
- "version": "16.18.41",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.41.tgz",
- "integrity": "sha512-YZJjn+Aaw0xihnpdImxI22jqGbp0DCgTFKRycygjGx/Y27NnWFJa5FJ7P+MRT3u07dogEeMVh70pWpbIQollTA=="
+ "version": "16.18.46",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.46.tgz",
+ "integrity": "sha512-Mnq3O9Xz52exs3mlxMcQuA7/9VFe/dXcrgAyfjLkABIqxXKOgBRjyazTxUbjsxDa4BP7hhPliyjVTP9RDP14xg=="
},
"node_modules/@types/node-rsa": {
"version": "1.1.1",
@@ -349,6 +349,20 @@
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"dev": true
},
+ "node_modules/@types/readable-stream": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.2.tgz",
+ "integrity": "sha512-hhzOsMEISZ+mX1l+01F0duYt9wHEbCGmjARed0PcQoVS5zAdu7u5YbWYuNGhw09M1MgGr3kfsto+ut/MnAdKqA==",
+ "dependencies": {
+ "@types/node": "*",
+ "safe-buffer": "~5.1.1"
+ }
+ },
+ "node_modules/@types/readable-stream/node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
"node_modules/@types/responselike": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
@@ -358,22 +372,30 @@
}
},
"node_modules/@types/semver": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
- "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
+ "version": "7.5.1",
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz",
+ "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==",
"dev": true
},
+ "node_modules/@types/ws": {
+ "version": "8.5.5",
+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz",
+ "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.4.0.tgz",
- "integrity": "sha512-62o2Hmc7Gs3p8SLfbXcipjWAa6qk2wZGChXG2JbBtYpwSRmti/9KHLqfbLs9uDigOexG+3PaQ9G2g3201FWLKg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz",
+ "integrity": "sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/type-utils": "6.4.0",
- "@typescript-eslint/utils": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/type-utils": "6.5.0",
+ "@typescript-eslint/utils": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@@ -399,15 +421,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.4.0.tgz",
- "integrity": "sha512-I1Ah1irl033uxjxO9Xql7+biL3YD7w9IU8zF+xlzD/YxY6a4b7DYA08PXUUCbm2sEljwJF6ERFy2kTGAGcNilg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.5.0.tgz",
+ "integrity": "sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/typescript-estree": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4"
},
"engines": {
@@ -427,13 +449,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.4.0.tgz",
- "integrity": "sha512-TUS7vaKkPWDVvl7GDNHFQMsMruD+zhkd3SdVW0d7b+7Zo+bd/hXJQ8nsiUZMi1jloWo6c9qt3B7Sqo+flC1nig==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz",
+ "integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0"
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -444,13 +466,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.4.0.tgz",
- "integrity": "sha512-TvqrUFFyGY0cX3WgDHcdl2/mMCWCDv/0thTtx/ODMY1QhEiyFtv/OlLaNIiYLwRpAxAtOLOY9SUf1H3Q3dlwAg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz",
+ "integrity": "sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==",
"dev": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "6.4.0",
- "@typescript-eslint/utils": "6.4.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
+ "@typescript-eslint/utils": "6.5.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
@@ -471,9 +493,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.4.0.tgz",
- "integrity": "sha512-+FV9kVFrS7w78YtzkIsNSoYsnOtrYVnKWSTVXoL1761CsCRv5wpDOINgsXpxD67YCLZtVQekDDyaxfjVWUJmmg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.5.0.tgz",
+ "integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -484,13 +506,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.4.0.tgz",
- "integrity": "sha512-iDPJArf/K2sxvjOR6skeUCNgHR/tCQXBsa+ee1/clRKr3olZjZ/dSkXPZjG6YkPtnW6p5D1egeEPMCW6Gn4yLA==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz",
+ "integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -511,17 +533,17 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.4.0.tgz",
- "integrity": "sha512-BvvwryBQpECPGo8PwF/y/q+yacg8Hn/2XS+DqL/oRsOPK+RPt29h5Ui5dqOKHDlbXrAeHUTnyG3wZA0KTDxRZw==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.5.0.tgz",
+ "integrity": "sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/typescript-estree": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
"semver": "^7.5.4"
},
"engines": {
@@ -536,12 +558,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.4.0.tgz",
- "integrity": "sha512-yJSfyT+uJm+JRDWYRYdCm2i+pmvXJSMtPR9Cq5/XQs4QIgNoLcoRtDdzsLbLsFM/c6um6ohQkg/MLxWvoIndJA==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz",
+ "integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.4.0",
+ "@typescript-eslint/types": "6.5.0",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
@@ -1021,15 +1043,15 @@
}
},
"node_modules/eslint": {
- "version": "8.47.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz",
- "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==",
+ "version": "8.48.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
+ "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
- "@eslint/js": "^8.47.0",
+ "@eslint/js": "8.48.0",
"@humanwhocodes/config-array": "^0.11.10",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -1857,10 +1879,12 @@
}
},
"node_modules/mqtt": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.0.3.tgz",
- "integrity": "sha512-XyCzdCNFm4XXBUV7HQPd1qXYdu7GC/H+wXr+RfaztwZ72/c3sD8yRivOBdh8iKWHc+EGawSeDIvXCnvEykcJVA==",
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.0.4.tgz",
+ "integrity": "sha512-Ao+DA4QYzIFXTQPIF0WKJfeHM2BV0kbP1xt/POPyJY2dQ02dscUJonh94NG9/aw0Fbk2L8Ex0YxobDSKUyQvcQ==",
"dependencies": {
+ "@types/readable-stream": "^4.0.1",
+ "@types/ws": "^8.5.5",
"commist": "^3.2.0",
"concat-stream": "^2.0.0",
"debug": "^4.3.4",
@@ -2135,9 +2159,9 @@
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"node_modules/protobufjs": {
- "version": "7.2.4",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz",
- "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==",
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
"hasInstallScript": true,
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
@@ -2521,9 +2545,9 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"node_modules/typescript": {
- "version": "5.1.6",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+ "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -2659,9 +2683,9 @@
}
},
"@eslint/js": {
- "version": "8.47.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.47.0.tgz",
- "integrity": "sha512-P6omY1zv5MItm93kLM8s2vr1HICJH8v0dvddDhysbIuZ+vcjOHg5Zbkf1mTkcmi2JA9oBG2anOkRnW8WJTS8Og==",
+ "version": "8.48.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
+ "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
"dev": true
},
"@humanwhocodes/config-array": {
@@ -2841,9 +2865,9 @@
}
},
"@types/node": {
- "version": "16.18.41",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.41.tgz",
- "integrity": "sha512-YZJjn+Aaw0xihnpdImxI22jqGbp0DCgTFKRycygjGx/Y27NnWFJa5FJ7P+MRT3u07dogEeMVh70pWpbIQollTA=="
+ "version": "16.18.46",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.46.tgz",
+ "integrity": "sha512-Mnq3O9Xz52exs3mlxMcQuA7/9VFe/dXcrgAyfjLkABIqxXKOgBRjyazTxUbjsxDa4BP7hhPliyjVTP9RDP14xg=="
},
"@types/node-rsa": {
"version": "1.1.1",
@@ -2869,6 +2893,22 @@
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"dev": true
},
+ "@types/readable-stream": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.2.tgz",
+ "integrity": "sha512-hhzOsMEISZ+mX1l+01F0duYt9wHEbCGmjARed0PcQoVS5zAdu7u5YbWYuNGhw09M1MgGr3kfsto+ut/MnAdKqA==",
+ "requires": {
+ "@types/node": "*",
+ "safe-buffer": "~5.1.1"
+ },
+ "dependencies": {
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ }
+ }
+ },
"@types/responselike": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
@@ -2878,22 +2918,30 @@
}
},
"@types/semver": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
- "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
+ "version": "7.5.1",
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz",
+ "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==",
"dev": true
},
+ "@types/ws": {
+ "version": "8.5.5",
+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz",
+ "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@typescript-eslint/eslint-plugin": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.4.0.tgz",
- "integrity": "sha512-62o2Hmc7Gs3p8SLfbXcipjWAa6qk2wZGChXG2JbBtYpwSRmti/9KHLqfbLs9uDigOexG+3PaQ9G2g3201FWLKg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz",
+ "integrity": "sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==",
"dev": true,
"requires": {
"@eslint-community/regexpp": "^4.5.1",
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/type-utils": "6.4.0",
- "@typescript-eslint/utils": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/type-utils": "6.5.0",
+ "@typescript-eslint/utils": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@@ -2903,54 +2951,54 @@
}
},
"@typescript-eslint/parser": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.4.0.tgz",
- "integrity": "sha512-I1Ah1irl033uxjxO9Xql7+biL3YD7w9IU8zF+xlzD/YxY6a4b7DYA08PXUUCbm2sEljwJF6ERFy2kTGAGcNilg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.5.0.tgz",
+ "integrity": "sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/typescript-estree": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4"
}
},
"@typescript-eslint/scope-manager": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.4.0.tgz",
- "integrity": "sha512-TUS7vaKkPWDVvl7GDNHFQMsMruD+zhkd3SdVW0d7b+7Zo+bd/hXJQ8nsiUZMi1jloWo6c9qt3B7Sqo+flC1nig==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz",
+ "integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0"
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0"
}
},
"@typescript-eslint/type-utils": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.4.0.tgz",
- "integrity": "sha512-TvqrUFFyGY0cX3WgDHcdl2/mMCWCDv/0thTtx/ODMY1QhEiyFtv/OlLaNIiYLwRpAxAtOLOY9SUf1H3Q3dlwAg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz",
+ "integrity": "sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==",
"dev": true,
"requires": {
- "@typescript-eslint/typescript-estree": "6.4.0",
- "@typescript-eslint/utils": "6.4.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
+ "@typescript-eslint/utils": "6.5.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
}
},
"@typescript-eslint/types": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.4.0.tgz",
- "integrity": "sha512-+FV9kVFrS7w78YtzkIsNSoYsnOtrYVnKWSTVXoL1761CsCRv5wpDOINgsXpxD67YCLZtVQekDDyaxfjVWUJmmg==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.5.0.tgz",
+ "integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.4.0.tgz",
- "integrity": "sha512-iDPJArf/K2sxvjOR6skeUCNgHR/tCQXBsa+ee1/clRKr3olZjZ/dSkXPZjG6YkPtnW6p5D1egeEPMCW6Gn4yLA==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz",
+ "integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/visitor-keys": "6.4.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/visitor-keys": "6.5.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -2959,27 +3007,27 @@
}
},
"@typescript-eslint/utils": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.4.0.tgz",
- "integrity": "sha512-BvvwryBQpECPGo8PwF/y/q+yacg8Hn/2XS+DqL/oRsOPK+RPt29h5Ui5dqOKHDlbXrAeHUTnyG3wZA0KTDxRZw==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.5.0.tgz",
+ "integrity": "sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.4.0",
- "@typescript-eslint/types": "6.4.0",
- "@typescript-eslint/typescript-estree": "6.4.0",
+ "@typescript-eslint/scope-manager": "6.5.0",
+ "@typescript-eslint/types": "6.5.0",
+ "@typescript-eslint/typescript-estree": "6.5.0",
"semver": "^7.5.4"
}
},
"@typescript-eslint/visitor-keys": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.4.0.tgz",
- "integrity": "sha512-yJSfyT+uJm+JRDWYRYdCm2i+pmvXJSMtPR9Cq5/XQs4QIgNoLcoRtDdzsLbLsFM/c6um6ohQkg/MLxWvoIndJA==",
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz",
+ "integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.4.0",
+ "@typescript-eslint/types": "6.5.0",
"eslint-visitor-keys": "^3.4.1"
}
},
@@ -3324,15 +3372,15 @@
"dev": true
},
"eslint": {
- "version": "8.47.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.47.0.tgz",
- "integrity": "sha512-spUQWrdPt+pRVP1TTJLmfRNJJHHZryFmptzcafwSvHsceV81djHOdnEeDmkdotZyLNjDhrOasNK8nikkoG1O8Q==",
+ "version": "8.48.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
+ "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
- "@eslint/js": "^8.47.0",
+ "@eslint/js": "8.48.0",
"@humanwhocodes/config-array": "^0.11.10",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -3948,10 +3996,12 @@
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
},
"mqtt": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.0.3.tgz",
- "integrity": "sha512-XyCzdCNFm4XXBUV7HQPd1qXYdu7GC/H+wXr+RfaztwZ72/c3sD8yRivOBdh8iKWHc+EGawSeDIvXCnvEykcJVA==",
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-5.0.4.tgz",
+ "integrity": "sha512-Ao+DA4QYzIFXTQPIF0WKJfeHM2BV0kbP1xt/POPyJY2dQ02dscUJonh94NG9/aw0Fbk2L8Ex0YxobDSKUyQvcQ==",
"requires": {
+ "@types/readable-stream": "^4.0.1",
+ "@types/ws": "^8.5.5",
"commist": "^3.2.0",
"concat-stream": "^2.0.0",
"debug": "^4.3.4",
@@ -4151,9 +4201,9 @@
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"protobufjs": {
- "version": "7.2.4",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz",
- "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==",
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
"requires": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
@@ -4416,9 +4466,9 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"typescript": {
- "version": "5.1.6",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
- "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+ "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true
},
"universalify": {
diff --git a/package.json b/package.json
index 0fdc65b4..ecca83b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "eufy-security-client",
- "version": "2.8.0",
+ "version": "2.8.1",
"description": "Client to comunicate with Eufy-Security devices",
"author": {
"name": "bropat",
@@ -42,7 +42,7 @@
"dependencies": {
"got": "^11.8.6",
"long": "^5.2.3",
- "protobufjs": "^7.2.4",
+ "protobufjs": "^7.2.5",
"qs": "^6.11.2",
"node-rsa": "^1.1.1",
"crypto-js": "^4.1.1",
@@ -52,23 +52,23 @@
"@cospired/i18n-iso-languages": "^4.1.0",
"fs-extra": "^11.1.1",
"sweet-collections": "^1.1.0",
- "mqtt": "^5.0.3",
+ "mqtt": "^5.0.4",
"node-schedule": "^2.1.1",
"p-throttle": "^4.1.1",
"image-type": "^4.1.0",
"date-and-time": "^3.0.2"
},
"devDependencies": {
- "@types/node": "^16.18.41",
+ "@types/node": "^16.18.46",
"@types/qs": "^6.9.7",
"@types/node-rsa": "^1.1.1",
"@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^11.0.1",
"@types/node-schedule": "^2.1.0",
- "@typescript-eslint/eslint-plugin": "^6.4.0",
- "@typescript-eslint/parser": "^6.4.0",
- "eslint": "^8.47.0",
- "typescript": "^5.1.6"
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
+ "@typescript-eslint/parser": "^6.5.0",
+ "eslint": "^8.48.0",
+ "typescript": "^5.2.2"
},
"bugs": {
"url": "https://github.com/bropat/eufy-security-client/issues"
diff --git a/src/eufysecurity.ts b/src/eufysecurity.ts
index d3131fd0..6f385a6c 100644
--- a/src/eufysecurity.ts
+++ b/src/eufysecurity.ts
@@ -18,7 +18,7 @@ import { BatteryDoorbellCamera, Camera, Device, EntrySensor, FloodlightCamera, G
import { AlarmEvent, ChargingType, CommandType, DatabaseReturnCode, P2PConnectionType, SmartSafeAlarm911Event, SmartSafeShakeAlarmEvent, TFCardStatus } from "./p2p/types";
import { DatabaseCountByDate, DatabaseQueryLatestInfo, DatabaseQueryLocal, StreamMetadata, DatabaseQueryLatestInfoLocal, DatabaseQueryLatestInfoCloud, RGBColor, DynamicLighting } from "./p2p/interfaces";
import { CommandResult } from "./p2p/models";
-import { generateSerialnumber, generateUDID, handleUpdate, md5, parseValue, removeLastChar, waitForEvent } from "./utils";
+import { generateSerialnumber, generateUDID, getError, handleUpdate, md5, parseValue, removeLastChar, waitForEvent } from "./utils";
import { DeviceNotFoundError, StationNotFoundError, ReadOnlyPropertyError, NotSupportedError, AddUserError, DeleteUserError, UpdateUserUsernameError, UpdateUserPasscodeError, UpdateUserScheduleError, ensureError } from "./error";
import { libVersion } from ".";
import { InvalidPropertyError } from "./http/error";
@@ -126,7 +126,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.debug("No stored data from last exit found", error);
+ this.log.debug("No stored data from last exit found", { error: getError(error) });
}
try {
@@ -143,7 +143,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch(err) {
const error = ensureError(err);
- this.log.error("Handling update - Error", error);
+ this.log.error("Handling update - Error", { error: getError(error) });
}
if (this.config.trustedDeviceName === undefined || this.config.trustedDeviceName === "") {
@@ -171,7 +171,7 @@ export class EufySecurity extends TypedEmitter {
this.api.on("connection error", (error: Error) => this.onAPIConnectionError(error));
if (this.persistentData.login_hash && this.persistentData.login_hash != "") {
- this.log.debug("Load previous login_hash:", this.persistentData.login_hash);
+ this.log.debug("Load previous login_hash", { login_hash: this.persistentData.login_hash });
if (md5(`${this.config.username}:${this.config.password}`) != this.persistentData.login_hash) {
this.log.info("Authentication properties changed, invalidate saved cloud token.");
this.persistentData.cloud_token = "";
@@ -189,7 +189,7 @@ export class EufySecurity extends TypedEmitter {
this.persistentData.httpApi = undefined;
}
if (this.persistentData.cloud_token && this.persistentData.cloud_token != "" && this.persistentData.cloud_token_expiration) {
- this.log.debug("Load previous token:", { token: this.persistentData.cloud_token, tokenExpiration: this.persistentData.cloud_token_expiration });
+ this.log.debug("Load previous token", { token: this.persistentData.cloud_token, tokenExpiration: this.persistentData.cloud_token_expiration });
this.api.setToken(this.persistentData.cloud_token);
this.api.setTokenExpiration(new Date(this.persistentData.cloud_token_expiration));
}
@@ -201,12 +201,12 @@ export class EufySecurity extends TypedEmitter {
}
if (!this.persistentData.openudid || this.persistentData.openudid == "") {
this.persistentData.openudid = generateUDID();
- this.log.debug("Generated new openudid:", this.persistentData.openudid);
+ this.log.debug("Generated new openudid", { openudid: this.persistentData.openudid });
}
this.api.setOpenUDID(this.persistentData.openudid);
if (!this.persistentData.serial_number || this.persistentData.serial_number == "") {
this.persistentData.serial_number = generateSerialnumber(12);
- this.log.debug("Generated new serial_number:", this.persistentData.serial_number);
+ this.log.debug("Generated new serial_number", { serialnumber: this.persistentData.serial_number });
}
this.api.setSerialNumber(this.persistentData.serial_number);
@@ -253,7 +253,7 @@ export class EufySecurity extends TypedEmitter {
const error = ensureError(err);
if (error instanceof DeviceNotFoundError) {
} else {
- this.log.error("Lock MQTT Message Error", error);
+ this.log.error("Lock MQTT Message Error", { error: getError(error) });
}
}).finally(() => {
this.emit("mqtt lock message", message);
@@ -312,7 +312,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("getStorageInfo Error", error);
+ this.log.error("getStorageInfo Error", { error: getError(error), stationSN: stationSerial });
}
}
@@ -430,13 +430,13 @@ export class EufySecurity extends TypedEmitter {
}
private handleHouses(houses: Houses): void {
- this.log.debug("Got houses:", houses);
+ this.log.debug("Got houses", { houses: houses });
//TODO: Finish implementation
this.houses = houses;
}
private handleHubs(hubs: Hubs): void {
- this.log.debug("Got hubs:", hubs);
+ this.log.debug("Got hubs", { hubs: hubs });
const stationsSNs: string[] = Object.keys(this.stations);
const newStationsSNs = Object.keys(hubs);
const promises: Array> = [];
@@ -500,7 +500,7 @@ export class EufySecurity extends TypedEmitter {
station.initialize();
} catch (err) {
const error = ensureError(err);
- this.log.error("HandleHubs Error", error);
+ this.log.error("HandleHubs Error", { error: getError(error), stationSN: station.getSerial() });
}
return station;
}));
@@ -520,7 +520,7 @@ export class EufySecurity extends TypedEmitter {
this.removeStation(station);
}).catch((err) => {
const error = ensureError(err);
- this.log.error("Error removing station", error);
+ this.log.error("Error removing station", { error: getError(error), stationSN: stationSN });
});
}
}
@@ -531,7 +531,7 @@ export class EufySecurity extends TypedEmitter {
if (Station.isStation(station.getDeviceType()) || (Device.isCamera(station.getDeviceType()) && !Device.isWiredDoorbell(station.getDeviceType()) || Device.isSmartSafe(station.getDeviceType()))) {
station.getCameraInfo().catch(err => {
const error = ensureError(err);
- this.log.error(`Error during station ${station.getSerial()} p2p data refreshing`, error);
+ this.log.error(`Error during station p2p data refreshing`, { error: getError(error), stationSN: station.getSerial() });
});
if (this.refreshEufySecurityP2PTimeout[station.getSerial()] !== undefined) {
clearTimeout(this.refreshEufySecurityP2PTimeout[station.getSerial()]);
@@ -541,7 +541,7 @@ export class EufySecurity extends TypedEmitter {
this.refreshEufySecurityP2PTimeout[station.getSerial()] = setTimeout(() => {
station.getCameraInfo().catch(err => {
const error = ensureError(err);
- this.log.error(`Error during station ${station.getSerial()} p2p data refreshing`, error);
+ this.log.error(`Error during scheduled station p2p data refreshing`, { error: getError(error), stationSN: station.getSerial() });
});
}, this.P2P_REFRESH_INTERVAL_MIN * 60 * 1000);
//}
@@ -562,13 +562,13 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station ${station.getSerial()} - Error`, error);
+ this.log.error(`Station close Error`, { error: getError(error), stationSN: station.getSerial() });
});
}
}
private handleDevices(devices: FullDevices): void {
- this.log.debug("Got devices:", devices);
+ this.log.debug("Got devices", { devices: devices });
const deviceSNs: string[] = Object.keys(this.devices);
const newDeviceSNs = Object.keys(devices);
const promises: Array> = [];
@@ -644,7 +644,7 @@ export class EufySecurity extends TypedEmitter {
device.initialize();
} catch (err) {
const error = ensureError(err);
- this.log.error("HandleDevices Error", error);
+ this.log.error("HandleDevices Error", { error: getError(error), deviceSN: device.getSerial() });
}
return device;
}));
@@ -659,7 +659,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error("Error trying to connect to station afte device loaded", error);
+ this.log.error("Error trying to connect to station afte device loaded", { error: getError(error), deviceSN: device.getSerial() });
});
});
this.loadingEmitter.emit("devices loaded");
@@ -675,7 +675,7 @@ export class EufySecurity extends TypedEmitter {
this.removeDevice(device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error("Error removing device", error);
+ this.log.error("Error removing device", { error: getError(error), deviceSN: deviceSN });
});
}
}
@@ -685,12 +685,12 @@ export class EufySecurity extends TypedEmitter {
if (this.config.acceptInvitations) {
await this.processInvitations().catch(err => {
const error = ensureError(err);
- this.log.error("Error in processing invitations", error);
+ this.log.error("Error in processing invitations", { error: getError(error) });
});
}
await this.api.refreshAllData().catch(err => {
const error = ensureError(err);
- this.log.error("Error during API data refreshing", error);
+ this.log.error("Error during API data refreshing", { error: getError(error) });
});
if (this.refreshEufySecurityCloudTimeout !== undefined)
clearTimeout(this.refreshEufySecurityCloudTimeout);
@@ -771,7 +771,7 @@ export class EufySecurity extends TypedEmitter {
})
.catch((err) => {
const error = ensureError(err);
- this.log.error("Connect Error", error);
+ this.log.error("Connect Error", { error: getError(error), options: options });
});
}
@@ -784,7 +784,7 @@ export class EufySecurity extends TypedEmitter {
device.updateRawProperties(values);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Update device ${deviceSN} properties error`, error);
+ this.log.error("Update device properties error", { error: getError(error), deviceSN: deviceSN, values: values });
});
}
@@ -924,7 +924,7 @@ export class EufySecurity extends TypedEmitter {
fse.writeFileSync(this.persistentFile, JSON.stringify(this.persistentData));
} catch (err) {
const error = ensureError(err);
- this.log.error("WritePersistentData Error", error);
+ this.log.error("WritePersistentData Error", { error: getError(error) });
}
}
@@ -971,7 +971,7 @@ export class EufySecurity extends TypedEmitter {
const invites = await this.api.getInvites().catch(err => {
const error = ensureError(err);
- this.log.error("processInvitations - getInvites - Error", error);
+ this.log.error("Error getting invites from cloud", { error: getError(error) });
return error;
});
if (Object.keys(invites).length > 0) {
@@ -992,7 +992,7 @@ export class EufySecurity extends TypedEmitter {
if (confirmInvites.length > 0) {
const result = await this.api.confirmInvites(confirmInvites).catch(err => {
const error = ensureError(err);
- this.log.error("processInvitations - confirmInvites - Error", error);
+ this.log.error("Error in confirmation of invitations", { error: getError(error), confirmInvites: confirmInvites });
return error;
});
if (result) {
@@ -1004,18 +1004,18 @@ export class EufySecurity extends TypedEmitter {
const houseInvites = await this.api.getHouseInviteList().catch(err => {
const error = ensureError(err);
- this.log.error("processInvitations - getHouseInviteList - Error", error);
+ this.log.error("Error getting house invites from cloud", { error: getError(error) });
return error;
});
if (Object.keys(houseInvites).length > 0) {
for(const invite of Object.values(houseInvites) as HouseInviteListResponse[]) {
const result = await this.api.confirmHouseInvite(invite.house_id, invite.id).catch(err => {
const error = ensureError(err);
- this.log.error("processInvitations - confirmHouseInvite - Error", error);
+ this.log.error("Error in confirmation of house invitations", { error: getError(error) });
return error;
});
if (result) {
- this.log.info(`Accepted received house invitation from ${invite.action_user_email}`, invite);
+ this.log.info(`Accepted received house invitation from ${invite.action_user_email}`, { invite: invite });
refreshCloud = true;
}
}
@@ -1028,7 +1028,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("push message", message);
try {
- this.log.debug("Received push message", message);
+ this.log.debug("Received push message", { message: message });
try {
if ((message.type === ServerPushEvent.INVITE_DEVICE || message.type === ServerPushEvent.HOUSE_INVITE) && this.config.acceptInvitations) {
if (this.isConnected())
@@ -1036,7 +1036,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Error processing server push notification for device invitation`, error);
+ this.log.error(`Error processing server push notification for device invitation`, { error: getError(error), message: message });
}
try {
if (message.type === ServerPushEvent.REMOVE_DEVICE || message.type === ServerPushEvent.REMOVE_HOMEBASE || message.type === ServerPushEvent.HOUSE_REMOVE) {
@@ -1045,7 +1045,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Error processing server push notification for device/station/house removal`, error);
+ this.log.error(`Error processing server push notification for device/station/house removal`, { error: getError(error), message: message });
}
this.getStations().then((stations: Station[]) => {
stations.forEach(station => {
@@ -1053,12 +1053,12 @@ export class EufySecurity extends TypedEmitter {
station.processPushNotification(message);
} catch (err) {
const error = ensureError(err);
- this.log.error(`Error processing push notification for station ${station.getSerial()}`, error);
+ this.log.error(`Error processing push notification for station`, { error: getError(error), stationSN: station.getSerial(), message: message });
}
});
}).catch((err) => {
const error = ensureError(err);
- this.log.error("Process push notification for stations", error);
+ this.log.error("Process push notification for stations", { error: getError(error), message: message });
});
this.getDevices().then((devices: Device[]) => {
devices.forEach(device => {
@@ -1066,16 +1066,16 @@ export class EufySecurity extends TypedEmitter {
device.processPushNotification(message, this.config.eventDurationSeconds);
} catch (err) {
const error = ensureError(err);
- this.log.error(`Error processing push notification for device ${device.getSerial()}`, error);
+ this.log.error(`Error processing push notification for device`, { error: getError(error), deviceSN: device.getSerial(), message: message });
}
});
}).catch((err) => {
const error = ensureError(err);
- this.log.error("Process push notification for devices", error);
+ this.log.error("Process push notification for devices", { error: getError(error), message: message });
});
} catch (err) {
const error = ensureError(err);
- this.log.error("OnPushMessage Generic Error", error);
+ this.log.error("OnPushMessage Generic Error", { error: getError(error), message: message });
}
}
@@ -1656,7 +1656,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station livestream start", station, device, metadata, videostream, audiostream);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station start livestream error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station start livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, metadata: metadata });
});
}
@@ -1665,19 +1665,19 @@ export class EufySecurity extends TypedEmitter {
this.emit("station livestream stop", station, device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station stop livestream error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station stop livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
- private onErrorStationLivestream(station: Station, channel:number, _error: Error): void {
+ private onErrorStationLivestream(station: Station, channel:number, origError: Error): void {
this.getStationDevice(station.getSerial(), channel).then((device: Device) => {
station.stopLivestream(device).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station livestream error (station: ${station.getSerial()} channel: ${channel} error: ${_error}})`, error);
+ this.log.error(`Station stop livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, origError: getError(origError) });
});
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station livestream error (station: ${station.getSerial()} channel: ${channel} error: ${_error}})`, error);
+ this.log.error(`Station livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, origError: getError(origError) });
});
}
@@ -1686,7 +1686,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station rtsp livestream start", station, device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station start rtsp livestream error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station start rtsp livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
@@ -1695,7 +1695,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station rtsp livestream stop", station, device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station stop rtsp livestream error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station stop rtsp livestream error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
@@ -1704,7 +1704,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station download start", station, device, metadata, videoStream, audioStream);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station start download error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station start download error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, metadata: metadata });
});
}
@@ -1713,7 +1713,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station download finish", station, device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station finish download error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station finish download error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
@@ -1725,7 +1725,7 @@ export class EufySecurity extends TypedEmitter {
result.customData.onSuccess();
} catch (err) {
const error = ensureError(err);
- this.log.error(`Station command result (station: ${station.getSerial()}) - onSuccess callback error`, error);
+ this.log.error(`Station command result - onSuccess callback error`, { error: getError(error), stationSN: station.getSerial(), result: result });
}
}
this.getStationDevice(station.getSerial(), result.channel).then((device: Device) => {
@@ -1774,7 +1774,7 @@ export class EufySecurity extends TypedEmitter {
}, timeoutMS);
}).catch(err => {
const error = ensureError(err);
- this.log.error("Error during API data refreshing", error);
+ this.log.error("Error during API data refreshing", { error: getError(error) });
});
}
}).catch((err) => {
@@ -1784,7 +1784,7 @@ export class EufySecurity extends TypedEmitter {
station.updateProperty(result.customData.property.name, result.customData.property.value);
}
} else {
- this.log.error(`Station command result error (station: ${station.getSerial()})`, error);
+ this.log.error(`Station command result error`, { error: getError(error), stationSN: station.getSerial(), result: result });
}
});
if (station.isIntegratedDevice() && result.command_type === CommandType.CMD_SET_ARMING && station.isConnected() && station.getDeviceType() !== DeviceType.DOORBELL) {
@@ -1796,7 +1796,7 @@ export class EufySecurity extends TypedEmitter {
result.customData.onFailure();
} catch (err) {
const error = ensureError(err);
- this.log.error(`Station command result (station: ${station.getSerial()}) - onFailure callback error`, error);
+ this.log.error(`Station command result - onFailure callback error`, { error: getError(error), stationSN: station.getSerial(), result: result });
}
}
}
@@ -1882,7 +1882,7 @@ export class EufySecurity extends TypedEmitter {
station.updateProperty(result.customData.property.name, result.customData.property.value);
}
} else {
- this.log.error(`Station secondary command result error (station: ${station.getSerial()})`, error);
+ this.log.error(`Station secondary command result error`, { error: getError(error), stationSN: station.getSerial(), result: result });
}
});
}
@@ -1894,7 +1894,7 @@ export class EufySecurity extends TypedEmitter {
device.setCustomPropertyValue(PropertyName.DeviceRTSPStreamUrl, value);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station rtsp url error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station rtsp url error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, url: value });
});
}
@@ -1942,7 +1942,7 @@ export class EufySecurity extends TypedEmitter {
station.setRTSPStream(device, true);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Device property changed error (device: ${device.getSerial()} name: ${name}) - station enable rtsp (station: ${device.getStationSerial()})`, error);
+ this.log.error(`Device property changed error - station enable rtsp`, { error: getError(error), deviceSN: device.getSerial(), stationSN: device.getStationSerial(), propertyName: name, propertyValue: value, ready: ready });
});
} else if (name === PropertyName.DeviceRTSPStream && (value as boolean) === false) {
device.setCustomPropertyValue(PropertyName.DeviceRTSPStreamUrl, "");
@@ -1953,12 +1953,12 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Device property changed error (device: ${device.getSerial()} name: ${name}) - station download image (station: ${device.getStationSerial()} image_path: ${value})`, error);
+ this.log.error(`Device property changed error - station download image`, { error: getError(error), deviceSN: device.getSerial(), stationSN: device.getStationSerial(), propertyName: name, propertyValue: value, ready: ready });
});
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Device property changed error (device: ${device.getSerial()} name: ${name})`, error);
+ this.log.error(`Device property changed error`, { error: getError(error), deviceSN: device.getSerial(), stationSN: device.getStationSerial(), propertyName: name, propertyValue: value, ready: ready });
}
}
@@ -2069,12 +2069,12 @@ export class EufySecurity extends TypedEmitter {
station.setRTSPStream(device, true);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Device ready error (device: ${device.getSerial()}) - station enable rtsp (station: ${device.getStationSerial()})`, error);
+ this.log.error(`Device ready error - station enable rtsp`, { error: getError(error), deviceSN: device.getSerial(), stationSN: device.getStationSerial() });
});
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Device ready error (device: ${device.getSerial()})`, error);
+ this.log.error(`Device ready error`, { error: getError(error), deviceSN: device.getSerial(), stationSN: device.getStationSerial() });
}
}
@@ -2090,7 +2090,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station runtime state error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station runtime state error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, batteryLevel: batteryLevel, temperature: temperature });
});
}
@@ -2107,7 +2107,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station charging state error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station charging state error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, chargeType: ChargingType[chargeType], batteryLevel: batteryLevel });
});
}
@@ -2119,7 +2119,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station wifi rssi error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station wifi rssi error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, rssi: rssi });
});
}
@@ -2135,7 +2135,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station floodlight manual switch error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station floodlight manual switch error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, enabled: enabled });
});
}
@@ -2154,7 +2154,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("station talkback start", station, device, talkbackStream);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station talkback start error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station talkback start error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
@@ -2163,16 +2163,16 @@ export class EufySecurity extends TypedEmitter {
this.emit("station talkback stop", station, device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station talkback stop error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station talkback stop error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
- private onStationTalkbackError(station: Station, channel:number, _error: Error): void {
+ private onStationTalkbackError(station: Station, channel:number, origError: Error): void {
this.getStationDevice(station.getSerial(), channel).then((device: Device) => {
station.stopTalkback(device);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station talkback error (station: ${station.getSerial()} channel: ${channel} error: ${_error}})`, error);
+ this.log.error(`Station talkback error`, { error: getError(error), stationSN: station.getSerial(), channel: channel, origError: getError(origError) });
});
}
@@ -2218,7 +2218,7 @@ export class EufySecurity extends TypedEmitter {
(device as SmartSafe).shakeEvent(event, this.config.eventDurationSeconds);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationShakeAlarm device ${deviceSN} error`, error);
+ this.log.error(`onStationDeviceShakeAlarm error`, { error: getError(error), deviceSN: deviceSN, event: SmartSafeShakeAlarmEvent[event] });
});
}
@@ -2228,7 +2228,7 @@ export class EufySecurity extends TypedEmitter {
(device as SmartSafe).alarm911Event(event, this.config.eventDurationSeconds);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStation911Alarm device ${deviceSN} error`, error);
+ this.log.error(`onStationDevice911Alarm error`, { error: getError(error), deviceSN: deviceSN, event: SmartSafeAlarm911Event[event] });
});
}
@@ -2238,7 +2238,7 @@ export class EufySecurity extends TypedEmitter {
(device as SmartSafe).jammedEvent(this.config.eventDurationSeconds);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationDeviceJammed device ${deviceSN} error`, error);
+ this.log.error(`onStationDeviceJammed error`, { error: getError(error), deviceSN: deviceSN });
});
}
@@ -2248,7 +2248,7 @@ export class EufySecurity extends TypedEmitter {
(device as SmartSafe).lowBatteryEvent(this.config.eventDurationSeconds);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationDeviceLowBattery device ${deviceSN} error`, error);
+ this.log.error(`onStationDeviceLowBattery error`, { error: getError(error), deviceSN: deviceSN });
});
}
@@ -2258,7 +2258,7 @@ export class EufySecurity extends TypedEmitter {
(device as SmartSafe).wrongTryProtectAlarmEvent(this.config.eventDurationSeconds);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationDeviceWrongTryProtectAlarm device ${deviceSN} error`, error);
+ this.log.error(`onStationDeviceWrongTryProtectAlarm error`, { error: getError(error), deviceSN: deviceSN });
});
}
@@ -2278,7 +2278,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`addUser device ${deviceSN} error`, error);
+ this.log.error(`addUser error`, { error: getError(error), deviceSN: deviceSN, username: username, schedule: schedule });
this.emit("user error", device, username, new AddUserError("Generic error", { cause: error, context: { device: deviceSN, username: username, passcode: "[redacted]", schedule: schedule } }));
}
}
@@ -2309,7 +2309,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`deleteUser device ${deviceSN} error`, error);
+ this.log.error(`deleteUser error`, { error: getError(error), deviceSN: deviceSN, username: username });
this.emit("user error", device, username, new DeleteUserError("Generic error", { cause: error, context: { device: deviceSN, username: username } }));
}
}
@@ -2344,7 +2344,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`updateUser device ${deviceSN} error`, error);
+ this.log.error(`updateUser error`, { error: getError(error), deviceSN: deviceSN, username: username, newUsername: newUsername });
this.emit("user error", device, username, new UpdateUserUsernameError("Generic error", { cause: error, context: { device: deviceSN, username: username, newUsername: newUsername } }));
}
}
@@ -2374,7 +2374,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`updateUserPasscode device ${deviceSN} error`, error);
+ this.log.error(`updateUserPasscode error`, { error: getError(error), deviceSN: deviceSN, username: username });
this.emit("user error", device, username, new UpdateUserPasscodeError("Generic error", { cause: error, context: { device: deviceSN, username: username, passcode: "[redacted]" } }));
}
}
@@ -2404,7 +2404,7 @@ export class EufySecurity extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`updateUserSchedule device ${deviceSN} error`, error);
+ this.log.error(`updateUserSchedule error`, { error: getError(error), deviceSN: deviceSN, username: username, schedule: schedule });
this.emit("user error", device, username, new UpdateUserScheduleError("Generic error", { cause: error, context: { device: deviceSN, username: username, schedule: schedule } }));
}
}
@@ -2414,7 +2414,7 @@ export class EufySecurity extends TypedEmitter {
this.emit("device pin verified", device, successfull);
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationDevicePinVerified device ${deviceSN} error`, error);
+ this.log.error(`onStationDevicePinVerified error`, { error: getError(error), deviceSN: deviceSN, successfull: successfull });
});
}
@@ -2448,7 +2448,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`onStationImageDownload - Set first picture error`, error);
+ this.log.error(`onStationImageDownload - Set first picture error`, { error: getError(error), stationSN: station.getSerial(), file: file });
});
}
@@ -2466,7 +2466,7 @@ export class EufySecurity extends TypedEmitter {
device.update(raw);
}).catch((err) => {
const error = ensureError(err);
- this.log.error("onStationDatabaseQueryLatest Error", error);
+ this.log.error("onStationDatabaseQueryLatest Error", { error: getError(error), stationSN: station.getSerial(), returnCode: returnCode });
});
}
}
@@ -2494,7 +2494,7 @@ export class EufySecurity extends TypedEmitter {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station sensor status error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station sensor status error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
@@ -2503,7 +2503,7 @@ export class EufySecurity extends TypedEmitter {
device.updateRawProperty(CommandType.CMD_CAMERA_GARAGE_DOOR_STATUS, status.toString(), "p2p");
}).catch((err) => {
const error = ensureError(err);
- this.log.error(`Station garage door status error (station: ${station.getSerial()} channel: ${channel})`, error);
+ this.log.error(`Station garage door status error`, { error: getError(error), stationSN: station.getSerial(), channel: channel });
});
}
diff --git a/src/http/api.ts b/src/http/api.ts
index ae768a48..807bd021 100644
--- a/src/http/api.ts
+++ b/src/http/api.ts
@@ -13,8 +13,9 @@ import { EventFilterType, PublicKeyType, ResponseErrorCode, StorageType, VerfyCo
import { ParameterHelper } from "./parameter";
import { encryptAPIData, decryptAPIData, getTimezoneGMTString, decodeImage } from "./utils";
import { InvalidCountryCodeError, InvalidLanguageCodeError, ensureError } from "./../error";
-import { getShortUrl, md5, mergeDeep, parseJSON } from "./../utils";
+import { getError, getShortUrl, md5, mergeDeep, parseJSON } from "./../utils";
import { ApiBaseLoadError, ApiGenericError, ApiHTTPResponseCodeError, ApiInvalidResponseError, ApiRequestError, ApiResponseCodeError } from "./error";
+import { getNullTerminatedString } from "../p2p/utils";
export class HTTPApi extends TypedEmitter {
@@ -79,7 +80,7 @@ export class HTTPApi extends TypedEmitter {
this.log = log;
this.apiBase = apiBase;
- this.log.debug(`Loaded API_BASE: ${apiBase}`);
+ this.log.debug(`Loaded API`, { apieBase: apiBase, country: country, username: username, persistentData: persistentData });
this.headers.timezone = getTimezoneGMTString();
this.headers.country = country.toUpperCase();
@@ -95,7 +96,7 @@ export class HTTPApi extends TypedEmitter {
this.ecdh.setPrivateKey(Buffer.from(this.persistentData.clientPrivateKey, "hex"));
} catch (err) {
const error = ensureError(err);
- this.log.debug(`Invalid client private key, generate new client private key...`, error);
+ this.log.debug(`Invalid client private key, generate new client private key...`, { error: getError(error) });
this.ecdh.generateKeys();
this.persistentData.clientPrivateKey = this.ecdh.getPrivateKey().toString("hex");
}
@@ -107,7 +108,7 @@ export class HTTPApi extends TypedEmitter {
this.ecdh.computeSecret(Buffer.from(this.persistentData.serverPublicKey, "hex"))
} catch (err) {
const error = ensureError(err);
- this.log.debug(`Invalid server public key, fallback to default server public key...`, error);
+ this.log.debug(`Invalid server public key, fallback to default server public key...`, { error: getError(error) });
this.persistentData.serverPublicKey = this.SERVER_PUBLIC_KEY;
}
}
@@ -195,19 +196,6 @@ export class HTTPApi extends TypedEmitter {
return error;
}
],
- /*beforeError: [
- error => {
- const { response } = error;
- if (response && response.body) {
- const result = (response.body as ResultResponse);
- error.name = "EufyError";
- error.message = `Code: ${result.code} Message: ${result.msg} (HTTP Code: ${response.statusCode})`;
- this.log.error(`${error.name} - ${error.message} - requestUrl: ${error.request?.requestUrl}`);
- }
-
- return error;
- }
- ],*/
beforeRequest: [
async _options => {
await this.throttle(async () => { return; })();
@@ -302,7 +290,7 @@ export class HTTPApi extends TypedEmitter {
options = mergeDeep(options, {
force: false
} as LoginOptions) as LoginOptions;
- this.log.debug("Login and get an access token", { token: this.token, tokenExpiration: this.tokenExpiration });
+ this.log.debug("Login and get an access token", { token: this.token, tokenExpiration: this.tokenExpiration, options: options });
if (!this.token || (this.tokenExpiration && (new Date()).getTime() >= this.tokenExpiration.getTime()) || options.verifyCode || options.captcha || options.force) {
try {
const data: LoginRequest = {
@@ -346,14 +334,14 @@ export class HTTPApi extends TypedEmitter {
...this.headers,
gtoken: md5(dataresult.user_id)
};
- this.log.debug("Token data", { token: this.token, tokenExpiration: this.tokenExpiration, serverPublicKey: this.persistentData.serverPublicKey });
+ this.log.debug("Login - Token data", { token: this.token, tokenExpiration: this.tokenExpiration, serverPublicKey: this.persistentData.serverPublicKey });
if (!this.connected) {
this.connected = true;
this.emit("connect");
}
this.scheduleRenewAuthToken();
} else if (result.code == ResponseErrorCode.CODE_NEED_VERIFY_CODE) {
- this.log.debug(`Send verification code...`);
+ this.log.debug(`Login - Send verification code...`);
const dataresult: LoginResultResponse = result.data;
this.setToken(dataresult.auth_token);
@@ -364,23 +352,23 @@ export class HTTPApi extends TypedEmitter {
this.emit("tfa request");
} else if (result.code == ResponseErrorCode.LOGIN_NEED_CAPTCHA || result.code == ResponseErrorCode.LOGIN_CAPTCHA_ERROR) {
const dataresult: CaptchaResponse = result.data;
- this.log.debug("Captcha verification received", { captchaId: dataresult.captcha_id, item: dataresult.item });
+ this.log.debug("Login - Captcha verification received", { captchaId: dataresult.captcha_id, item: dataresult.item });
this.emit("captcha request", dataresult.captcha_id, dataresult.item);
} else {
- this.log.error("Response code not ok", {code: result.code, msg: result.msg });
+ this.log.error("Login - Response code not ok", {code: result.code, msg: result.msg, data: response.data });
this.emit("connection error", new ApiResponseCodeError("API response code not ok", { context: { code: result.code, message: result.msg } }));
}
} else {
- this.log.error("Response data is missing", {code: result.code, msg: result.msg, data: result.data });
+ this.log.error("Login - Response data is missing", {code: result.code, msg: result.msg, data: result.data });
this.emit("connection error", new ApiInvalidResponseError("API response data is missing", { context: { code: result.code, message: result.msg, data: result.data } }));
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Login - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
this.emit("connection error", new ApiHTTPResponseCodeError("API HTTP response code not ok", { context: { status: response.status, statusText: response.statusText } }));
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error:", error);
+ this.log.error("Login - Generic Error:", { error: getError(error) });
this.emit("connection error", new ApiGenericError("Generic API error", { cause: error }));
}
} else if (!this.connected) {
@@ -395,7 +383,7 @@ export class HTTPApi extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("getPassportProfile Error", error);
+ this.log.error("Login - getPassportProfile Error", { error: getError(error) });
this.emit("connection error", new ApiGenericError("API get passport profile error", { cause: error }));
}
}
@@ -420,14 +408,14 @@ export class HTTPApi extends TypedEmitter {
this.log.info(`Requested verification code for 2FA`);
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Send verify code - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Send verify code - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Send verify code - Generic Error", { error: getError(error) });
}
return false;
}
@@ -446,14 +434,14 @@ export class HTTPApi extends TypedEmitter {
return result.data.list;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("List trust device - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("List trust device - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("List trust device - Generic Error", { error: getError(error) });
}
}
return [];
@@ -470,7 +458,7 @@ export class HTTPApi extends TypedEmitter {
transaction: `${new Date().getTime()}`
}
});
- this.log.debug("Response trust device:", response.data);
+ this.log.debug("Add trust device - Response trust device", { verifyCode: verifyCode, data: response.data });
if (response.status == 200) {
const result: ResultResponse = response.data;
@@ -479,19 +467,19 @@ export class HTTPApi extends TypedEmitter {
const trusted_devices = await this.listTrustDevice();
trusted_devices.forEach((trusted_device: TrustDevice) => {
if (trusted_device.is_current_device === 1) {
- this.log.debug("This device is trusted. Token expiration extended:", { tokenExpiration: this.tokenExpiration});
+ this.log.debug("Add trust device - This device is trusted. Token expiration extended:", { trustDevice: { phoneModel: trusted_device.phone_model, openUdid: trusted_device.open_udid }, tokenExpiration: this.tokenExpiration});
}
});
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Add trust device - Response code not ok", { code: result.code, msg: result.msg, verifyCode: verifyCode, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Add trust device - Status return code not 200", { status: response.status, statusText: response.statusText, verifyCode: verifyCode, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Add trust device - Generic Error", { error: getError(error) });
}
}
return false;
@@ -522,14 +510,14 @@ export class HTTPApi extends TypedEmitter {
return stationList;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Station list - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Station list - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Stations - Generic Error", error);
+ this.log.error("Station list - Generic Error", { error: getError(error) });
}
}
return [];
@@ -560,14 +548,14 @@ export class HTTPApi extends TypedEmitter {
return deviceList;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Device list - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Device list - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Devices - Generic Error", error);
+ this.log.error("Device list - Generic Error", { error: getError(error) });
}
}
return [];
@@ -627,7 +615,7 @@ export class HTTPApi extends TypedEmitter {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public async request(request: HTTPApiRequest): Promise {
- this.log.debug("Request:", { method: request.method, endpoint: request.endpoint, responseType: request.responseType, token: this.token, data: request.data });
+ this.log.debug("Api request", { method: request.method, endpoint: request.endpoint, responseType: request.responseType, token: this.token, data: request.data });
try {
const internalResponse = await this.requestEufyCloud(request.endpoint, {
method: request.method,
@@ -640,7 +628,7 @@ export class HTTPApi extends TypedEmitter {
headers: internalResponse.headers,
data: internalResponse.body,
};
- this.log.debug("Response:", { token: this.token, request: request, response: response.data });
+ this.log.debug("Api request - Response", { token: this.token, request: request, response: response.data });
return response;
} catch (err) {
@@ -672,17 +660,17 @@ export class HTTPApi extends TypedEmitter {
if (response.status == 200) {
const result: ResultResponse = response.data;
if (result.code == 0) {
- this.log.debug(`Push token OK`);
+ this.log.debug(`Check push token - Push token OK`);
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Check push token - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Check push token - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Check push token - Generic Error", { error: getError(error) });
}
}
return false;
@@ -704,17 +692,17 @@ export class HTTPApi extends TypedEmitter {
if (response.status == 200) {
const result: ResultResponse = response.data;
if (result.code == 0) {
- this.log.debug(`Push token registered successfully`);
+ this.log.debug(`Register push token - Push token registered successfully`);
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Register push token - Response code not ok", { code: result.code, msg: result.msg, data: response.data, token: token });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Register push token - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, token: token });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Register push token - Generic Error", { error: getError(error), token: token });
}
}
return false;
@@ -737,23 +725,23 @@ export class HTTPApi extends TypedEmitter {
params: tmp_params
}
});
- this.log.debug("Response:", { stationSN: stationSN, deviceSN: deviceSN, params: tmp_params, response: response.data });
+ this.log.debug("Set paramter - Response:", { stationSN: stationSN, deviceSN: deviceSN, params: tmp_params, response: response.data });
if (response.status == 200) {
const result: ResultResponse = response.data;
if (result.code == 0) {
const dataresult = result.data;
- this.log.debug("New parameters set", { params: tmp_params, response: dataresult });
+ this.log.debug("Set paramter - New parameters set", { params: tmp_params, response: dataresult });
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Set paramter - Response code not ok", { code: result.code, msg: result.msg, data: response.data, stationSN: stationSN, deviceSN: deviceSN, params: params });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Set paramter - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, stationSN: stationSN, deviceSN: deviceSN, params: params });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Set paramter - Generic Error", { error: getError(error), stationSN: stationSN, deviceSN: deviceSN, params: params });
}
}
return false;
@@ -782,14 +770,14 @@ export class HTTPApi extends TypedEmitter {
return ciphers;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get ciphers - Response code not ok", { code: result.code, msg: result.msg, data: response.data, cipherIDs: cipherIDs, userID: userID });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get ciphers - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, cipherIDs: cipherIDs, userID: userID });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get ciphers - Generic Error", { error: getError(error), cipherIDs: cipherIDs, userID: userID });
}
}
return {};
@@ -813,14 +801,14 @@ export class HTTPApi extends TypedEmitter {
return voices;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get Voices - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get Voices - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get Voices - Generic Error", { error: getError(error), deviceSN: deviceSN });
}
}
return {};
@@ -917,17 +905,17 @@ export class HTTPApi extends TypedEmitter {
});
}
} else {
- this.log.error("Response data is missing", { code: result.code, msg: result.msg, data: result.data });
+ this.log.error(`${functionName} - Response data is missing`, { code: result.code, msg: result.msg, data: response.data, endpoint: endpoint, startTime: startTime, endTime: endTime, filter: filter, maxResults: maxResults });
}
} else {
- this.log.error(`${functionName} - Response code not ok`, {code: result.code, msg: result.msg });
+ this.log.error(`${functionName} - Response code not ok`, {code: result.code, msg: result.msg, data: response.data, endpoint: endpoint, startTime: startTime, endTime: endTime, filter: filter, maxResults: maxResults });
}
} else {
- this.log.error(`${functionName} - Status return code not 200`, { status: response.status, statusText: response.statusText });
+ this.log.error(`${functionName} - Status return code not 200`, { status: response.status, statusText: response.statusText, data: response.data, endpoint: endpoint, startTime: startTime, endTime: endTime, filter: filter, maxResults: maxResults });
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`${functionName} - Generic Error`, error);
+ this.log.error(`${functionName} - Generic Error`, { error: getError(error), endpoint: endpoint, startTime: startTime, endTime: endTime, filter: filter, maxResults: maxResults });
}
}
return records;
@@ -993,14 +981,14 @@ export class HTTPApi extends TypedEmitter {
return invites;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get invites - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get invites - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get invites - Generic Error", { error: getError(error) });
}
}
return {};
@@ -1022,14 +1010,14 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Confirm invites - Response code not ok", { code: result.code, msg: result.msg, data: response.data, confirmInvites: confirmInvites });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Confirm invites - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, confirmInvites: confirmInvites });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Confirm invites - Generic Error", { error: getError(error), confirmInvites: confirmInvites });
}
}
return false;
@@ -1055,15 +1043,15 @@ export class HTTPApi extends TypedEmitter {
return result.data.public_key;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get public key - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN, type: type });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get public key - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, type: type });
}
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get public key - Generic Error", { error: getError(error), deviceSN: deviceSN, type: type });
}
}
return "";
@@ -1076,15 +1064,16 @@ export class HTTPApi extends TypedEmitter {
decryptedData = decryptAPIData(data, this.ecdh.computeSecret(Buffer.from(this.persistentData.serverPublicKey, "hex")));
} catch (err) {
const error = ensureError(err);
- this.log.error("Data decryption error, invalidating session data and reconnecting...", error);
+ this.log.error("Data decryption error, invalidating session data and reconnecting...", { error: getError(error) });
this.persistentData.serverPublicKey = this.SERVER_PUBLIC_KEY;
this.invalidateToken();
this.emit("close");
}
if (decryptedData) {
+ const str = getNullTerminatedString(decryptedData, "utf-8");
if (json)
- return parseJSON(decryptedData.toString("utf-8"), this.log);
- return decryptedData.toString();
+ return parseJSON(str, this.log);
+ return str;
}
if (json)
return {};
@@ -1115,14 +1104,14 @@ export class HTTPApi extends TypedEmitter {
return entries;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get sensor history - Response code not ok", { code: result.code, msg: result.msg, data: response.data, stationSN: stationSN, deviceSN: deviceSN });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get sensor history - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, stationSN: stationSN, deviceSN: deviceSN });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get sensor history - Generic Error", { error: getError(error), stationSN: stationSN, deviceSN: deviceSN });
}
}
return [];
@@ -1144,18 +1133,18 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
if (result.data) {
const houseDetail = this.decryptAPIData(result.data) as HouseDetail;
- this.log.debug("Decrypted house detail data", houseDetail);
+ this.log.debug("Get house detail - Decrypted house detail data", { details: houseDetail });
return houseDetail;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get house detail - Response code not ok", { code: result.code, msg: result.msg, data: response.data, houseID: houseID });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get house detail - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, houseID: houseID });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get house detail - Generic Error", { error: getError(error), houseID: houseID });
}
}
return null;
@@ -1175,17 +1164,18 @@ export class HTTPApi extends TypedEmitter {
const result: ResultResponse = response.data;
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
if (result.data) {
+ this.log.debug("Get house list - houses", { houses: result.data });
return result.data as Array;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get house list - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get house list - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get house list - Generic Error", { error: getError(error) });
}
}
return [];
@@ -1208,18 +1198,18 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
if (result.data) {
const houseInviteList = this.decryptAPIData(result.data) as Array;
- this.log.debug("Decrypted house invite list data", houseInviteList);
+ this.log.debug("Get house invite list - Decrypted house invite list data", houseInviteList);
return houseInviteList;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get house invite list - Response code not ok", { code: result.code, msg: result.msg, data: response.data, isInviter: isInviter });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get house invite list - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, isInviter: isInviter });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get house invite list - Generic Error", { error: getError(error), isInviter: isInviter });
}
}
return [];
@@ -1244,14 +1234,14 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Confirm house invite - Response code not ok", { code: result.code, msg: result.msg, data: response.data, houseID: houseID, inviteID: inviteID });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Confirm house invite - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, houseID: houseID, inviteID: inviteID });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Confirm house invite - Generic Error", { error: getError(error), houseID: houseID, inviteID: inviteID });
}
}
return false;
@@ -1272,21 +1262,21 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
if (result.data) {
const profile = this.decryptAPIData(result.data) as PassportProfileResponse;
- this.log.debug("Decrypted passport profile data", profile);
+ this.log.debug("Get passport profile - Decrypted passport profile data", { profile: profile });
this.persistentData.user_id = profile.user_id;
this.persistentData.nick_name = profile.nick_name;
this.persistentData.email = profile.email;
return profile;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get passport profile - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get passport profile - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get passport profile - Generic Error", { error: getError(error) });
}
return null;
}
@@ -1310,14 +1300,14 @@ export class HTTPApi extends TypedEmitter {
if (result.data)
return result.data as AddUserResponse;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Add user - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN, nickname: nickname, stationSN: stationSN });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Add user - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, nickname: nickname, stationSN: stationSN });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Add user - Generic Error", { error: getError(error), deviceSN: deviceSN, nickname: nickname, stationSN: stationSN });
}
}
return null;
@@ -1341,14 +1331,14 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Delete user - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN, shortUserId: shortUserId, stationSN: stationSN });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Delete user - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, shortUserId: shortUserId, stationSN: stationSN });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Delete user - Generic Error", { error: getError(error), deviceSN: deviceSN, shortUserId: shortUserId, stationSN: stationSN });
}
}
return false;
@@ -1368,14 +1358,14 @@ export class HTTPApi extends TypedEmitter {
return usersResponse.user_list;
}
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Get users - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN, stationSN: stationSN });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get users - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, stationSN: stationSN });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get users - Generic Error", { error: getError(error), deviceSN: deviceSN, stationSN: stationSN });
}
return null;
}
@@ -1392,7 +1382,7 @@ export class HTTPApi extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get user - Generic Error", { error: getError(error), deviceSN: deviceSN, stationSN: stationSN, shortUserId: shortUserId });
}
return null;
}
@@ -1420,15 +1410,15 @@ export class HTTPApi extends TypedEmitter {
if (result.code == ResponseErrorCode.CODE_WHATEVER_ERROR) {
return true;
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Update user - Response code not ok", { code: result.code, msg: result.msg, data: response.data, deviceSN: deviceSN, stationSN: stationSN, shortUserId: shortUserId, nickname: nickname });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Update user - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, stationSN: stationSN, shortUserId: shortUserId, nickname: nickname });
}
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Update user - Generic Error", { error: getError(error), deviceSN: deviceSN, stationSN: stationSN, shortUserId: shortUserId, nickname: nickname });
}
}
return false;
@@ -1449,13 +1439,13 @@ export class HTTPApi extends TypedEmitter {
if (response.status == 200) {
return decodeImage(station.p2p_did, response.data as Buffer);
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Get Image - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data, deviceSN: deviceSN, url: url });
}
}
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Get Image - Generic Error", { error: getError(error), deviceSN: deviceSN, url: url });
}
}
return Buffer.alloc(0);
diff --git a/src/http/device.ts b/src/http/device.ts
index 6a9b5867..9df38cb1 100644
--- a/src/http/device.ts
+++ b/src/http/device.ts
@@ -11,7 +11,7 @@ import { calculateCellularSignalLevel, calculateWifiSignalLevel, getAbsoluteFile
import { DecimalToRGBColor, eslTimestamp, getCurrentTimeInSeconds } from "../p2p/utils";
import { CusPushEvent, DoorbellPushEvent, LockPushEvent, IndoorPushEvent, SmartSafeEvent, HB3PairedDevicePushEvent, GarageDoorPushEvent } from "../push/types";
import { PushMessage, SmartSafeEventValueDetail } from "../push/models";
-import { isEmpty } from "../utils";
+import { getError, isEmpty } from "../utils";
import { InvalidPropertyError, PropertyNotSupportedError } from "./error";
import { DeviceSmartLockNotifyData } from "../mqtt/model";
import { DynamicLighting, InternalColoredLighting, InternalDynamicLighting, RGBColor } from "../p2p";
@@ -66,7 +66,7 @@ export class Device extends TypedEmitter {
this.updateRawProperty(param.param_type, param.param_value, "http");
});
}
- this.log.debug("Normalized Properties", { deviceSN: this.getSerial(), properties: this.properties });
+ this.log.debug("Update device cloud properties", { deviceSN: this.getSerial(), properties: this.properties });
}
public updateProperty(name: string, value: PropertyValue, force = false): boolean {
@@ -80,9 +80,9 @@ export class Device extends TypedEmitter {
} catch (err) {
const error = ensureError(err);
if (error instanceof InvalidPropertyError) {
- this.log.error(`Invalid Property ${name} error`, error);
+ this.log.error(`Device update property - Invalid Property error`, { error: getError(error), deviceSN: this.getSerial(), propertyName: name, propertyValue: value, force: force });
} else {
- this.log.error(`Property ${name} error`, error);
+ this.log.error(`Device update property - Property error`, { error: getError(error), deviceSN: this.getSerial(), propertyName: name, propertyValue: value, force: force });
}
}
return true;
@@ -128,7 +128,7 @@ export class Device extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Device handlePropertyChange error`, error, { metadata: metadata, oldValue: oldValue, newValue: newValue });
+ this.log.error(`Device handle property change - error`, { error: getError(error), deviceSN: this.getSerial(), metadata: metadata, oldValue: oldValue, newValue: newValue });
}
}
@@ -153,9 +153,9 @@ export class Device extends TypedEmitter {
} catch (err) {
const error = ensureError(err);
if (error instanceof PropertyNotSupportedError) {
- this.log.debug("Property not supported error", error);
+ this.log.debug("Device update raw property - Property not supported error", { error: getError(error), deviceSN: this.getSerial(), type: type, value: value, source: source });
} else {
- this.log.error("Property error", error);
+ this.log.error("Device update raw property - Property error", { error: getError(error), deviceSN: this.getSerial(), type: type, value: value, source: source });
}
}
}
@@ -180,7 +180,7 @@ export class Device extends TypedEmitter {
return value !== undefined ? (Number.parseInt((value as any).notification_ring_onoff) === 1 ? true : false) : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationRing Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationRing Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -190,7 +190,7 @@ export class Device extends TypedEmitter {
return value !== undefined ? (Number.parseInt((value as any).notification_motion_onoff) === 1 ? true : false) : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationMotion Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationMotion Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -200,7 +200,7 @@ export class Device extends TypedEmitter {
return value !== undefined ? Number.parseInt((value as any).notification_style) : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationType Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE DeviceNotificationType Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
}
@@ -215,7 +215,7 @@ export class Device extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert DOORBELL_NOTIFICATION_OPEN Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - DOORBELL_NOTIFICATION_OPEN Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return false;
}
} else if (property.key === CommandType.CMD_SET_PIRSENSITIVITY) {
@@ -258,7 +258,7 @@ export class Device extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_PIRSENSITIVITY Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_PIRSENSITIVITY Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.key === CommandType.CMD_SMARTLOCK_AUTO_LOCK_SCHEDULE_STARTTIME || property.key === CommandType.CMD_SMARTLOCK_AUTO_LOCK_SCHEDULE_ENDTIME) {
@@ -291,7 +291,7 @@ export class Device extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error(`Convert CMD_DOORBELL_DUAL_RADAR_WD_DETECTION_SENSITIVITY ${property.name} Error`, { property: property, value: value, error: error });
+ this.log.error(`Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_DETECTION_SENSITIVITY ${property.name} Error`, { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.key === CommandType.CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE) {
@@ -302,7 +302,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].start_hour !== undefined && (value as any).setting[0].start_min !== undefined) ? `${(value as any).setting[0].start_hour.padStart(2, "0")}:${(value as any).setting[0].start_min.padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseTimeFrom Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseTimeFrom Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -312,7 +312,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].end_hour !== undefined && (value as any).setting[0].end_min !== undefined) ? `${(value as any).setting[0].end_hour.padStart(2, "0")}:${(value as any).setting[0].end_min.padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseTimeTo Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseTimeTo Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -322,7 +322,7 @@ export class Device extends TypedEmitter {
return (value as any).setting[0].push_notify === 1 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponsePhoneNotification Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponsePhoneNotification Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -332,7 +332,7 @@ export class Device extends TypedEmitter {
return (value as any).setting[0].homebase_alert === 1 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseHomeBaseNotification Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseHomeBaseNotification Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -342,7 +342,7 @@ export class Device extends TypedEmitter {
return (value as any).setting[0].auto_voice_resp === 1 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseAutoVoiceResponse Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseAutoVoiceResponse Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -352,7 +352,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].auto_voice_id !== undefined) ? (value as any).setting[0].auto_voice_id : numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseAutoVoiceResponseVoice Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE DeviceLoiteringCustomResponseAutoVoiceResponseVoice Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
}
@@ -363,7 +363,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).ai_bottom_switch !== undefined ? (value as any).ai_bottom_switch === 1024 : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_DELIVERY_GUARD_SWITCH Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_DELIVERY_GUARD_SWITCH Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
} else if (property.key === CommandType.CMD_DOORBELL_DUAL_PACKAGE_STRAND_TIME) {
@@ -372,7 +372,7 @@ export class Device extends TypedEmitter {
return ((value as any).start_h !== undefined && (value as any).start_m !== undefined) ? `${(value as any).start_h.toString().padStart(2, "0")}:${(value as any).start_m.toString().padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_PACKAGE_STRAND_TIME Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_PACKAGE_STRAND_TIME Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
} else if (property.key === CommandType.CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE) {
@@ -383,7 +383,7 @@ export class Device extends TypedEmitter {
return (value as any).setting[0].active === 1 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponse Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponse Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -393,7 +393,7 @@ export class Device extends TypedEmitter {
return (value as any).setting[0].active === 1 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseVoiceResponse Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseVoiceResponse Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -403,7 +403,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].start_hour !== undefined && (value as any).setting[0].start_min !== undefined) ? `${(value as any).setting[0].start_hour.padStart(2, "0")}:${(value as any).setting[0].start_min.padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseTimeFrom Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseTimeFrom Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -413,7 +413,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].end_hour !== undefined && (value as any).setting[0].end_min !== undefined) ? `${(value as any).setting[0].end_hour.padStart(2, "0")}:${(value as any).setting[0].end_min.padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseTimeTo Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseTimeTo Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -423,7 +423,7 @@ export class Device extends TypedEmitter {
return ((value as any).setting !== undefined && (value as any).setting.length > 0 !== undefined && (value as any).setting[0].auto_voice_id !== undefined) ? (value as any).setting[0].auto_voice_id : numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseVoiceResponseVoice Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE DeviceRingAutoResponseVoiceResponseVoice Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
}
@@ -436,7 +436,7 @@ export class Device extends TypedEmitter {
return ((value as any).start_h !== undefined && (value as any).start_m !== undefined) ? `${(value as any).start_h.toString().padStart(2, "0")}:${(value as any).start_m.toString().padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_PACKAGE_GUARD_TIME DeviceDeliveryGuardPackageGuardingActivatedTimeFrom Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_PACKAGE_GUARD_TIME DeviceDeliveryGuardPackageGuardingActivatedTimeFrom Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -446,7 +446,7 @@ export class Device extends TypedEmitter {
return ((value as any).end_h !== undefined && (value as any).end_m !== undefined) ? `${(value as any).end_h.toString().padStart(2, "0")}:${(value as any).end_m.toString().padStart(2, "0")}` : stringProperty.default !== undefined ? stringProperty.default : "";
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_PACKAGE_GUARD_TIME DeviceDeliveryGuardPackageGuardingActivatedTimeTo Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_PACKAGE_GUARD_TIME DeviceDeliveryGuardPackageGuardingActivatedTimeTo Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return stringProperty.default !== undefined ? stringProperty.default : "";
}
}
@@ -457,7 +457,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).radar_wd_distance !== undefined ? (value as any).radar_wd_distance as number : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_DISTANCE Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_DISTANCE Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.key === CommandType.CMD_DOORBELL_DUAL_RADAR_WD_TIME) {
@@ -466,7 +466,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).radar_wd_time !== undefined ? (value as any).radar_wd_time as number : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_RADAR_WD_TIME Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_RADAR_WD_TIME Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.key === CommandType.CMD_DOORBELL_DUAL_PACKAGE_GUARD_VOICE) {
@@ -475,7 +475,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).auto_voice_id !== undefined ? (value as any).auto_voice_id as number : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_DOORBELL_DUAL_PACKAGE_GUARD_VOICE Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_DOORBELL_DUAL_PACKAGE_GUARD_VOICE Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.key === CommandType.CMD_SET_SNOOZE_MODE) {
@@ -486,7 +486,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).snooze_time !== undefined && (value as any).snooze_time !== "" && Number.parseInt((value as any).snooze_time) !== 0 ? true : booleanProperty.default !== undefined ? booleanProperty.default : false;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnooze Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnooze Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -496,7 +496,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).snooze_time !== undefined && (value as any).snooze_time !== "" ? Number.parseInt((value as any).snooze_time) : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnoozeTime Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnoozeTime Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
}
@@ -506,7 +506,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).startTime !== undefined ? Number.parseInt((value as any).startTime) : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnoozeTime Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnoozeTime Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
}
@@ -516,7 +516,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).homebase_onoff !== undefined ? ((value as any).homebase_onoff === 1 ? true : false) : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnoozeHomebase Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnoozeHomebase Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -526,7 +526,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).motion_notify_onoff !== undefined ? ((value as any).motion_notify_onoff === 1 ? true : false) : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnoozeMotion Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnoozeMotion Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -536,7 +536,7 @@ export class Device extends TypedEmitter {
return value !== undefined && (value as any).chime_onoff !== undefined ? ((value as any).chime_onoff === 1 ? true : false) : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_SNOOZE_MODE DeviceSnoozeChime Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - CMD_SET_SNOOZE_MODE DeviceSnoozeChime Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
}
@@ -553,7 +553,7 @@ export class Device extends TypedEmitter {
return isHB3DetectionModeEnabled(Number.parseInt(value), property.name === PropertyName.DeviceMotionDetectionTypeHuman ? HB3DetectionTypes.HUMAN_DETECTION : property.name === PropertyName.DeviceMotionDetectionTypeHumanRecognition ? HB3DetectionTypes.HUMAN_RECOGNITION : property.name === PropertyName.DeviceMotionDetectionTypePet ? HB3DetectionTypes.PET_DETECTION : property.name === PropertyName.DeviceMotionDetectionTypeVehicle ? HB3DetectionTypes.VEHICLE_DETECTION : HB3DetectionTypes.ALL_OTHER_MOTION);
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert HB3 motion detection type Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - HB3 motion detection type Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
} else if (property.key === CommandType.CELLULAR_INFO) {
@@ -581,7 +581,7 @@ export class Device extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.warn("PropertyMetadataNumeric Convert Error", { property: property, value: value, error: error });
+ this.log.warn("Device convert raw property - PropertyMetadataNumeric Convert Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.type === "boolean") {
@@ -590,7 +590,7 @@ export class Device extends TypedEmitter {
return value !== undefined ? (value === "1" || value.toLowerCase() === "true" ? true : false) : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.warn("PropertyMetadataBoolean Convert Error", { property: property, value: value, error: error });
+ this.log.warn("Device convert raw property - PropertyMetadataBoolean Convert Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
} else if (property.type === "string") {
@@ -602,7 +602,7 @@ export class Device extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("Device convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return value;
}
@@ -1457,7 +1457,7 @@ export class Camera extends Device {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("Camera convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -1475,7 +1475,7 @@ export class Camera extends Device {
//TODO: Deprecated. Will be removed!
await this.setParameters([{ paramType: ParamType.DETECT_SWITCH, paramValue: 1 }]).catch(err => {
const error = ensureError(err);
- this.log.error("Start detection Error", error);
+ this.log.error("Camera start detection - Error", { error: getError(error), deviceSN: this.getSerial() });
});
}
@@ -1492,7 +1492,7 @@ export class Camera extends Device {
proto: 2
}
});
- this.log.debug("Response:", response.data);
+ this.log.debug("Camera start stream - Response", { data: response.data });
if (response.status == 200) {
const result: ResultResponse = response.data;
@@ -1505,14 +1505,14 @@ export class Camera extends Device {
return `rtmp://${dataresult.domain}/hls/${dataresult.stream_name}==?time=${dataresult.time}&token=${dataresult.token}`
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Camera start stream - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Camera start stream - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Camera start stream - Generic Error", { error: getError(error), deviceSN: this.getSerial() });
}
return "";
}
@@ -1535,7 +1535,7 @@ export class Camera extends Device {
proto: 2
}
});
- this.log.debug("Response:", response.data);
+ this.log.debug("Camera stop stream - Response", { data: response.data });
if (response.status == 200) {
const result: ResultResponse = response.data;
@@ -1543,14 +1543,14 @@ export class Camera extends Device {
this._isStreaming = false;
this.log.info(`Livestream of camera ${this.rawDevice.device_sn} stopped`);
} else {
- this.log.error("Response code not ok", { code: result.code, msg: result.msg });
+ this.log.error("Camera stop stream - Response code not ok", { code: result.code, msg: result.msg, data: response.data });
}
} else {
- this.log.error("Status return code not 200", { status: response.status, statusText: response.statusText });
+ this.log.error("Camera stop stream - Status return code not 200", { status: response.status, statusText: response.statusText, data: response.data });
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Generic Error", error);
+ this.log.error("Camera stop stream - Generic Error", { error: getError(error), deviceSN: this.getSerial() });
}
}
@@ -1667,7 +1667,7 @@ export class Camera extends Device {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`CusPushEvent.SECURITY - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`Camera process push notification - CusPushEvent.SECURITY - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
if (message.fetch_id !== undefined) {
@@ -1691,7 +1691,7 @@ export class Camera extends Device {
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`CusPushEvent.SECURITY - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`Camera process push notification - CusPushEvent.SECURITY - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
} else if (message.msg_type === DeviceType.HB3) {
if (message.device_sn === this.getSerial()) {
@@ -1703,7 +1703,7 @@ export class Camera extends Device {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`HB3PairedDevicePushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`Camera process push notification - HB3PairedDevicePushEvent - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -1802,12 +1802,12 @@ export class Camera extends Device {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled homebase3 camera push event", message);
+ this.log.debug("Camera process push notification - Unhandled homebase3 camera push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`HB3PairedDevicePushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`Camera process push notification - HB3PairedDevicePushEvent - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -1843,7 +1843,7 @@ export class SoloCamera extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`SoloPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`SoloCamera process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -1866,12 +1866,12 @@ export class SoloCamera extends Camera {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled solo camera push event", message);
+ this.log.debug("SoloCamera process push notification - Unhandled solo camera push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`SoloPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`SoloCamera process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -1933,7 +1933,7 @@ export class IndoorCamera extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`IndoorPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`IndoorCamera process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -1980,12 +1980,12 @@ export class IndoorCamera extends Camera {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled indoor camera push event", message);
+ this.log.debug("IndoorCamera process push notification - Unhandled indoor camera push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`IndoorPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`IndoorCamera process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2075,7 +2075,7 @@ export class DoorbellCamera extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`DoorbellPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`DoorbellCamera process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -2147,12 +2147,12 @@ export class DoorbellCamera extends Camera {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled doorbell push event", message);
+ this.log.debug("DoorbellCamera process push notification - Unhandled doorbell push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`DoorbellPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`DoorbellCamera process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2212,7 +2212,7 @@ export class FloodlightCamera extends Camera {
try {
switch (property.key) {
case CommandType.CMD_DEV_RECORD_AUTOSTOP:
- if (this.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || this.getDeviceType() === DeviceType.FLOODLIGHT)
+ if (this.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || this.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8424 || this.getDeviceType() === DeviceType.FLOODLIGHT)
return value !== undefined ? (value === "0" ? true : false) : false;
break;
case CommandType.CMD_FLOODLIGHT_SET_AUTO_CALIBRATION:
@@ -2243,7 +2243,7 @@ export class FloodlightCamera extends Camera {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("FloodlightCamera convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -2260,7 +2260,7 @@ export class FloodlightCamera extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`FloodlightPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`FloodlightCamera process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -2283,12 +2283,12 @@ export class FloodlightCamera extends Camera {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled floodlight push event", message);
+ this.log.debug("FloodlightCamera process push notification - Unhandled floodlight push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`FloodlightPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`FloodlightCamera process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2351,7 +2351,7 @@ export class WallLightCam extends Camera {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("WallLightCam convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -2383,7 +2383,7 @@ export class WallLightCam extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`WallLightCamPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`WallLightCam process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -2406,12 +2406,12 @@ export class WallLightCam extends Camera {
}, eventDurationSeconds * 1000));
break;
default:
- this.log.debug("Unhandled WallLightCam push event", message);
+ this.log.debug("WallLightCam process push notification - Unhandled WallLightCam push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`WallLightCamPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`WallLightCam process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2490,7 +2490,7 @@ export class GarageCamera extends Camera {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("GarageCamera convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -2507,7 +2507,7 @@ export class GarageCamera extends Camera {
}
}).catch((err) => {
const error = ensureError(err);
- this.log.debug(`GarageDoorPushEvent - Device: ${message.device_sn} - Get picture - Error`, error);
+ this.log.debug(`GarageCamera process push notification - Device Get picture - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
});
}
switch (message.event_type) {
@@ -2539,12 +2539,12 @@ export class GarageCamera extends Camera {
}
break;
default:
- this.log.debug("Unhandled GarageDoor push event", message);
+ this.log.debug("GarageCamera process push notification - Unhandled GarageDoor push event", message);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`GarageDoorPushEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`GarageCamera process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2595,7 +2595,7 @@ export class EntrySensor extends Sensor {
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`CusPushEvent.DOOR_SENSOR - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`EntrySensor process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2677,7 +2677,7 @@ export class MotionSensor extends Sensor {
}, eventDurationSeconds * 1000));
} catch (err) {
const error = ensureError(err);
- this.log.debug(`CusPushEvent.MOTION_SENSOR_PIR - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`MotionSensor process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
@@ -2823,12 +2823,12 @@ export class Lock extends Device {
// this.updateRawProperty(CommandType.CMD_SMARTLOCK_QUERY_BATTERY_LEVEL, "5");
// break;
default:
- this.log.debug("Unhandled lock notification event", eventType, eventTime, deviceSN);
+ this.log.debug("Lock process push notification - Unhandled lock notification event", eventType, eventTime, deviceSN);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`LockEvent - Device: ${deviceSN} Error`, error);
+ this.log.debug(`Lock process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), eventType: eventType, eventTime: eventTime, eventDurationSeconds: eventDurationSeconds, source: source });
}
}
}
@@ -3087,7 +3087,7 @@ export class Keypad extends Device {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("Keypad convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -3260,7 +3260,7 @@ export class SmartSafe extends Device {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("SmartSafe convert raw property - Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value });
}
return super.convertRawPropertyValue(property, value);
}
@@ -3378,12 +3378,12 @@ export class SmartSafe extends Device {
break;
}
default:
- this.log.debug("Unhandled smart safe notification event", message.event_type, message.event_time, message.device_sn);
+ this.log.debug("SmartSafe process push notification - Unhandled smart safe notification event", message.event_type, message.event_time, message.device_sn);
break;
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`LockEvent - Device: ${message.device_sn} Error`, error);
+ this.log.debug(`SmartSafe process push notification - Error`, { error: getError(error), deviceSN: this.getSerial(), message: JSON.stringify(message), eventDurationSeconds: eventDurationSeconds });
}
}
}
diff --git a/src/http/parameter.ts b/src/http/parameter.ts
index 553a53b1..62737f72 100644
--- a/src/http/parameter.ts
+++ b/src/http/parameter.ts
@@ -1,7 +1,7 @@
import { Logger } from "ts-log";
import { CommandType } from "../p2p/types";
-import { decodeBase64 } from "../p2p/utils";
+import { decodeBase64, getNullTerminatedString } from "../p2p/utils";
import { parseJSON } from "../utils";
import { ParamType } from "./types";
@@ -26,7 +26,7 @@ export class ParameterHelper {
type === CommandType.CMD_WALL_LIGHT_SETTINGS_COLORED_LIGHTING_COLORS ||
type === CommandType.CMD_WALL_LIGHT_SETTINGS_DYNAMIC_LIGHTING_THEMES) {
if (typeof value === "string") {
- const parsedValue = parseJSON(decodeBase64(value).toString("utf8"), log);
+ const parsedValue = parseJSON(getNullTerminatedString(decodeBase64(value), "utf-8"), log);
if (parsedValue === undefined) {
log.warn("Non-parsable parameter value received from eufy cloud. Will be ignored.", { type: type, value: value });
}
diff --git a/src/http/station.ts b/src/http/station.ts
index f90c5413..8a744f55 100644
--- a/src/http/station.ts
+++ b/src/http/station.ts
@@ -19,8 +19,9 @@ import { InvalidCommandValueError, InvalidPropertyValueError, NotSupportedError,
import { PushMessage } from "../push/models";
import { CusPushEvent } from "../push/types";
import { InvalidPropertyError, LivestreamAlreadyRunningError, LivestreamNotRunningError, PropertyNotSupportedError } from "./error";
-import { validValue } from "../utils";
+import { getError, validValue } from "../utils";
import { TalkbackStream } from "../p2p/talkback";
+import { start } from "repl";
export class Station extends TypedEmitter {
@@ -153,7 +154,7 @@ export class Station extends TypedEmitter {
this.updateRawProperty(param.param_type, param.param_value, "http");
});
}
- this.log.debug("Normalized Properties", { stationSN: this.getSerial(), properties: this.properties });
+ this.log.debug("Update station cloud properties", { stationSN: this.getSerial(), properties: this.properties });
}
public updateProperty(name: string, value: PropertyValue, force = false): boolean {
@@ -168,9 +169,9 @@ export class Station extends TypedEmitter {
} catch (err) {
const error = ensureError(err);
if (error instanceof InvalidPropertyError) {
- this.log.error(`Invalid Property ${name} error`, error);
+ this.log.error(`Station update property - Invalid Property error`, { error: getError(error), stationSN: this.getSerial(), propertyName: name, propertyValue: value, force: force });
} else {
- this.log.error(`Property ${name} error`, error);
+ this.log.error(`Station update property - Property error`, { error: getError(error), stationSN: this.getSerial(), propertyName: name, propertyValue: value, force: force });
}
}
return true;
@@ -231,7 +232,7 @@ export class Station extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Number conversion error", error);
+ this.log.error("Station update raw property - Number conversion error", { error: getError(error), stationSN: this.getSerial(), type: type, value: value, source: source });
}
}
@@ -244,9 +245,9 @@ export class Station extends TypedEmitter {
} catch (err) {
const error = ensureError(err);
if (error instanceof PropertyNotSupportedError) {
- this.log.debug("Property not supported error", error);
+ this.log.debug("Station update raw property - Property not supported error", { error: getError(error), stationSN: this.getSerial(), type: type, value: value, source: source });
} else {
- this.log.error("Property error", error);
+ this.log.error("Station update raw property - Property error", { error: getError(error), stationSN: this.getSerial(), type: type, value: value, source: source });
}
}
}
@@ -300,7 +301,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : 1;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_HUB_ALARM_TONE Error", { property: property, value: value, error: error });
+ this.log.error("Station convert raw property - CMD_HUB_ALARM_TONE Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return 1;
}
case CommandType.CMD_SET_HUB_SPK_VOLUME:
@@ -308,7 +309,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : 26;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_HUB_SPK_VOLUME Error", { property: property, value: value, error: error });
+ this.log.error("Station convert raw property - CMD_SET_HUB_SPK_VOLUME Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return 26;
}
case CommandType.CMD_SET_PROMPT_VOLUME:
@@ -316,7 +317,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : 26;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_PROMPT_VOLUME Error", { property: property, value: value, error: error });
+ this.log.error("Station convert raw property - CMD_SET_PROMPT_VOLUME Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return 26;
}
case CommandType.CMD_SET_HUB_OSD:
@@ -324,7 +325,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : 0;
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert CMD_SET_HUB_OSD Error", { property: property, value: value, error: error });
+ this.log.error("Station convert raw property - CMD_SET_HUB_OSD Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return 0;
}
case CommandType.CMD_SET_HUB_ALARM_AUTO_END:
@@ -338,7 +339,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? Number.parseInt(value) : (numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0));
} catch (err) {
const error = ensureError(err);
- this.log.warn("PropertyMetadataNumeric Convert Error", { property: property, value: value, error: error });
+ this.log.warn("Station convert raw property - PropertyMetadataNumeric Convert Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return numericProperty.default !== undefined ? numericProperty.default : (numericProperty.min !== undefined ? numericProperty.min : 0);
}
} else if (property.type === "boolean") {
@@ -347,7 +348,7 @@ export class Station extends TypedEmitter {
return value !== undefined ? (value === "1" || value.toLowerCase() === "true" ? true : false) : (booleanProperty.default !== undefined ? booleanProperty.default : false);
} catch (err) {
const error = ensureError(err);
- this.log.warn("PropertyMetadataBoolean Convert Error", { property: property, value: value, error: error });
+ this.log.warn("Station convert raw property - PropertyMetadataBoolean Convert Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
return booleanProperty.default !== undefined ? booleanProperty.default : false;
}
} else if (property.type === "string") {
@@ -359,7 +360,7 @@ export class Station extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.error("Convert Error", { property: property, value: value, error: error });
+ this.log.error("Station convert raw property - Error", { error: getError(error), stationSN: this.getSerial(), property: property, value: value });
}
return value;
}
@@ -525,7 +526,7 @@ export class Station extends TypedEmitter {
this.updateRawProperty(CommandType.CMD_GET_ALARM_MODE, message.station_current_mode.toString(), "push");
} catch (err) {
const error = ensureError(err);
- this.log.debug(`Station ${message.station_sn} MODE_SWITCH event (${message.event_type}) - Error`, error);
+ this.log.debug(`Station process push notification - MODE_SWITCH event error`, { error: getError(error), stationSN: this.getSerial(), message: JSON.stringify(message) });
}
} else if (message.event_type === CusPushEvent.ALARM && message.station_sn === this.getSerial() && !this.isStation()) {
this.log.info("Received push notification for alarm event", { stationSN: message.station_sn, alarmType: message.alarm_type });
@@ -559,7 +560,7 @@ export class Station extends TypedEmitter {
}
public async connect(): Promise {
- this.log.debug(`Connecting to station ${this.getSerial()}...`, { p2pConnectionType: P2PConnectionType[this.p2pConnectionType] });
+ this.log.debug(`Connecting to station ${this.getSerial()}...`, { stationSN: this.getSerial(), p2pConnectionType: P2PConnectionType[this.p2pConnectionType] });
this.p2pSession.setConnectionType(this.p2pConnectionType);
this.p2pSession.connect();
}
@@ -690,9 +691,9 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, mode);
- this.log.debug(`Sending guard mode command to station ${this.getSerial()} with value: ${GuardMode[mode]}`);
+ this.log.debug(`Station set guard mode - sending command`, { stationSN: this.getSerial(), mode: mode });
if (((isGreaterEqualMinVersion("2.0.7.9", this.getSoftwareVersion()) && !Device.isIntegratedDeviceBySn(this.getSerial())) || Device.isSoloCameraBySn(this.getSerial())) || this.rawStation.device_type === DeviceType.HB3) {
- this.log.debug(`Using CMD_SET_PAYLOAD for station ${this.getSerial()}`, { main_sw_version: this.getSoftwareVersion() });
+ this.log.debug(`Station set guard mode - Using CMD_SET_PAYLOAD`, { stationSN: this.getSerial(), mode: mode, main_sw_version: this.getSoftwareVersion() });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
value: JSON.stringify({
@@ -709,7 +710,7 @@ export class Station extends TypedEmitter {
property: propertyData
});
} else {
- this.log.debug(`Using CMD_SET_ARMING for station ${this.getSerial()}`);
+ this.log.debug(`Station set guard mode - Using CMD_SET_ARMING`, { stationSN: this.getSerial(), mode: mode });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_SET_ARMING,
value: mode,
@@ -722,7 +723,7 @@ export class Station extends TypedEmitter {
}
public async getCameraInfo(): Promise {
- this.log.debug(`Sending get camera infos command to station ${this.getSerial()}`);
+ this.log.debug(`Station send get camera info command`, { stationSN: this.getSerial() });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_CAMERA_INFO,
value: 255,
@@ -731,7 +732,7 @@ export class Station extends TypedEmitter {
}
public async getStorageInfoEx(): Promise {
- this.log.debug(`Sending get storage info command to station ${this.getSerial()}`);
+ this.log.debug(`Station send get storage info command`, { stationSN: this.getSerial() });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SDINFO_EX,
value: 0,
@@ -742,7 +743,7 @@ export class Station extends TypedEmitter {
}
private async onAlarmMode(mode: AlarmMode): Promise {
- this.log.info(`Alarm mode for station ${this.getSerial()} changed to: ${AlarmMode[mode]}`);
+ this.log.debug(`Station alarm mode changed`, { stationSN: this.getSerial(), mode: mode });
this.updateRawProperty(CommandType.CMD_GET_ALARM_MODE, mode.toString(), "p2p");
const armDelay = this.getArmDelay(mode);
if (armDelay > 0) {
@@ -805,7 +806,7 @@ export class Station extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`Station ${this.getSerial()} - getArmDelay - Error`, { error: error, mode: mode, propertyName: propertyName, settings: settings });
+ this.log.debug(`Station get arm delay - Error`, { error: getError(error), stationSN: this.getSerial(), mode: mode, propertyName: propertyName, settings: settings });
}
}
return 0;
@@ -834,7 +835,7 @@ export class Station extends TypedEmitter {
}
} catch (err) {
const error = ensureError(err);
- this.log.debug(`Station ${this.getSerial()} - getGuardModeActionSetting - Error`, { error: error, mode: mode });
+ this.log.debug(`Station get guard mode action setting - Error`, { error: getError(error), stationSN: this.getSerial(), mode: mode });
}
return value;
}
@@ -859,7 +860,7 @@ export class Station extends TypedEmitter {
}
private onCameraInfo(cameraInfo: CmdCameraInfoResponse): void {
- this.log.debug("Got camera infos", { station: this.getSerial(), cameraInfo: cameraInfo });
+ this.log.debug("Station got camera info", { station: this.getSerial(), cameraInfo: cameraInfo });
const devices: { [index: string]: RawValues; } = {};
cameraInfo.params.forEach(param => {
if (param.dev_type === Station.CHANNEL || param.dev_type === Station.CHANNEL_INDOOR || this.isIntegratedDevice()) {
@@ -904,12 +905,12 @@ export class Station extends TypedEmitter {
}
private onCommandResponse(result: CommandResult): void {
- this.log.debug("Got p2p command response", { station: this.getSerial(), commandType: result.command_type, channel: result.channel, returnCodeName: ErrorCode[result.return_code], returnCode: result.return_code, customData: result.customData });
+ this.log.debug("Station got p2p command response", { station: this.getSerial(), commandType: result.command_type, channel: result.channel, returnCodeName: ErrorCode[result.return_code], returnCode: result.return_code, customData: result.customData });
this.emit("command result", this, result);
}
private onSecondaryCommandResponse(result: CommandResult): void {
- this.log.debug("Got p2p secondary command response", { station: this.getSerial(), commandType: result.command_type, channel: result.channel, returnCode: result.return_code, customData: result.customData });
+ this.log.debug("Station got p2p secondary command response", { station: this.getSerial(), commandType: result.command_type, channel: result.channel, returnCode: result.return_code, customData: result.customData });
this.emit("secondary command result", this, result);
if (result.command_type === CommandType.CMD_SMARTSAFE_SETTINGS && result.customData?.command?.name === "deviceVerifyPIN") {
if (result.return_code === 0) {
@@ -965,7 +966,7 @@ export class Station extends TypedEmitter {
private scheduleReconnect(): void {
if (!this.reconnectTimeout) {
const delay = this.getCurrentDelay();
- this.log.debug(`Schedule reconnect to station ${this.getSerial()}...`, { delay: delay });
+ this.log.debug(`Station schedule reconnect`, { stationSN: this.getSerial(), delay: delay });
this.reconnectTimeout = setTimeout(async () => {
this.reconnectTimeout = undefined;
this.connect();
@@ -980,7 +981,7 @@ export class Station extends TypedEmitter {
if (!this.hasCommand(CommandName.StationReboot)) {
throw new NotSupportedError("This functionality is not implemented or supported", { context: { commandName: commandData.name, station: this.getSerial()} });
}
- this.log.debug(`Sending reboot command to station ${this.getSerial()}`);
+ this.log.debug(`Station reboot - sending command`, { stationSN: this.getSerial() });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_HUB_REBOOT,
value: 0,
@@ -1005,7 +1006,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending status led command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set status led - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isCamera2Product() || device.isCamera3Product() || device.getDeviceType() === DeviceType.CAMERA || device.getDeviceType() === DeviceType.CAMERA_E) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_DEV_LED_SWITCH,
@@ -1025,6 +1026,26 @@ export class Station extends TypedEmitter {
}, {
property: propertyData
});
+ } else if (device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8424) {
+ await this.p2pSession.sendCommandWithStringPayload({
+ commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
+ value: JSON.stringify({
+ "commandType": CommandType.CMD_INDOOR_LED_SWITCH,
+ "data":{
+ "enable": 0,
+ "index": 0,
+ "status": 0,
+ "type": 0,
+ "value": value === true ? 1 : 0,
+ "voiceID": 0,
+ "zonecount": 0,
+ "transaction": `${new Date().getTime()}`,
+ }
+ }),
+ channel: device.getChannel()
+ }, {
+ property: propertyData
+ });
} else if (device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || (device.getDeviceType() === DeviceType.FLOODLIGHT && !device.isFloodLightT8420X()) || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_DEV_LED_SWITCH,
@@ -1172,7 +1193,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending autonightvision command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set auto night vision - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isWallLightCam()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -1210,7 +1231,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending nightvision command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set night vision - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
value: JSON.stringify({
@@ -1242,7 +1263,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion detection command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion detection - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera() || (device.isFloodLight() && device.getDeviceType() !== DeviceType.FLOODLIGHT) || device.isFloodLightT8420X() || device.isWiredDoorbellT8200X() || device.isStarlight4GLTE() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -1324,7 +1345,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending sound detection command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set sound detection - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1359,7 +1380,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending sound detection type command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set sound detection type - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1394,7 +1415,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending sound detection sensitivity command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set sound detection sensitivity - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1429,7 +1450,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending pet detection command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set pet detection - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1464,7 +1485,8 @@ export class Station extends TypedEmitter {
if (!(direction in PanTiltDirection)) {
throw new InvalidCommandValueError("Invalid value for this command", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending pan and tilt command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${PanTiltDirection[direction]}`);
+
+ this.log.debug(`Station pan adn tilt - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), direction: PanTiltDirection[direction], command });
if (device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -1513,7 +1535,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending switch light command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station switch light - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight() || device.isSoloCameraSpotlight1080() || device.isSoloCameraSpotlight2k() ||
device.isSoloCameraSpotlightSolar() || device.isCamera2C() || device.isCamera2CPro() ||
device.isIndoorOutdoorCamera1080p() || device.isIndoorOutdoorCamera2k() || device.isCamera3() || device.isCamera3C()) {
@@ -1573,7 +1595,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion detection sensitivity command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion detection sensitivity - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if ((device.isFloodLight() && device.getDeviceType() !== DeviceType.FLOODLIGHT) || device.isIndoorCamera() || device.isFloodLightT8420X() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -1761,7 +1783,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion detection type command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion detection type - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isCamera2Product() || device.isBatteryDoorbell() || device.getDeviceType() === DeviceType.CAMERA ||
device.getDeviceType() === DeviceType.CAMERA_E || device.isSoloCameras() ||
device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || device.isWiredDoorbellDual() || device.isStarlight4GLTE() || device.isGarageCamera()) {
@@ -1824,7 +1846,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion detection type homebase 3 command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion detection type HB3 - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), type: type, value: value });
try {
const aiDetectionType = device.getRawProperty(device.getPropertyMetadata(propertyData.name).key as number) !== undefined ? device.getRawProperty(device.getPropertyMetadata(propertyData.name).key as number)! : "0";
await this.p2pSession.sendCommandWithStringPayload({
@@ -1845,7 +1867,7 @@ export class Station extends TypedEmitter {
});
} catch (err) {
const error = ensureError(err);
- this.log.error(`setMotionDetectionTypeHB3 - station ${this.getSerial()} device ${device.getSerial()}`, error);
+ this.log.error(`setMotionDetectionTypeHB3 Error`, { error: getError(error), stationSN: this.getSerial(), deviceSN: device.getSerial() });
}
}
@@ -1863,7 +1885,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion zone command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion zone - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1890,7 +1912,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending motion tracking command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set motion tracking - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1926,7 +1948,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending pan and tilt rotation speed command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set pan and tilt rotation speed - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -1962,7 +1984,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending mic mute command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set mic mute - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEV_MIC_MUTE,
value: value === true ? 1 : 0,
@@ -1988,7 +2010,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending audio recording command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set audio recording - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -2118,7 +2140,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending enable speaker command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station enable speaker - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEV_SPEAKER_MUTE,
value: value === true ? 1 : 0,
@@ -2144,7 +2166,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending speaker volume command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set speaker volume - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isWallLightCam()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2183,7 +2205,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending ringtone volume command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set ringtone volume - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell() || device.isWiredDoorbellDual()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_BAT_DOORBELL_SET_RINGTONE_VOLUME,
@@ -2239,7 +2261,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending enable indoor chime command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station enable indoor chime - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_BAT_DOORBELL_MECHANICAL_CHIME_SWITCH,
@@ -2282,7 +2304,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending enable homebase chime command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station enable homebase chime - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_BAT_DOORBELL_CHIME_SWITCH,
@@ -2312,7 +2334,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending homebase chime ringtone volume command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set homebase chime ringtone volume - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -2347,7 +2369,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending homebase chime ringtone type command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set homebase chime ringtone type - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -2382,7 +2404,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification type command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification type - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight() || device.isIndoorCamera() || device.isSoloCameras() || device.isStarlight4GLTE() || device.isGarageCamera()) {
if (!Object.values(NotificationType).includes(value as NotificationType)) {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, NotificationType);
@@ -2515,7 +2537,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification person command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification person - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2566,7 +2588,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification pet command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification pet - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2606,7 +2628,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification all other motion command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification all other motion - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2657,7 +2679,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification all sound command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification all sound - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2697,7 +2719,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification crying command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification crying - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2737,7 +2759,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification ring command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification ring - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell() || device.isWiredDoorbellDual()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -2787,7 +2809,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending notification motion command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set notification motion - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isBatteryDoorbell() || device.isWiredDoorbellDual()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -2837,7 +2859,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending power source command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set power source - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isStarlight4GLTE()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -2884,7 +2906,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending power working mode command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set power working mode - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_PIR_POWERMODE,
value: value,
@@ -2910,7 +2932,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending recording clip length command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set recording clip length - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_DEV_RECORD_TIMEOUT,
value: value,
@@ -2935,7 +2957,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending recording retrigger interval command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set recording retrigger interval - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_DEV_RECORD_INTERVAL,
value: value,
@@ -2960,7 +2982,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending recording end clip motion stops command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set recording end clip motion stops - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_DEV_RECORD_AUTOSTOP,
value: value === true ? 0 : 1,
@@ -2985,7 +3007,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending video streaming quality command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set video streaming quality - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera() || device.isSoloCameras() || device.isFloodLight() || device.isWiredDoorbell() || device.isStarlight4GLTE() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -3039,7 +3061,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending video recording quality command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set video recording quality - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamera() || device.isWiredDoorbell() || device.isFloodLight() || device.isSoloCameras() || device.isStarlight4GLTE() || device.isGarageCamera()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -3098,7 +3120,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending wdr command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set wdr - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_BAT_DOORBELL_WDR_SWITCH,
value: value === true ? 1 : 0,
@@ -3124,7 +3146,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending floodlight light settings enable command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set light settings enable - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_FLOODLIGHT_TOTAL_SWITCH,
value: value === true ? 1 : 0,
@@ -3150,7 +3172,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending floodlight light settings brightness manual command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set light settings brightness manual - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight() || device.isSoloCameraSpotlight1080() || device.isSoloCameraSpotlight2k() ||
device.isSoloCameraSpotlightSolar() || device.isCamera2C() || device.isCamera2CPro() ||
device.isIndoorOutdoorCamera1080p() || device.isIndoorOutdoorCamera2k() || device.isCamera3() || device.isCamera3C()) {
@@ -3196,7 +3218,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending floodlight light settings brightness motion command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set light settings brightness motion - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_LIGHT_CTRL_BRIGHT_PIR,
@@ -3240,7 +3262,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending floodlight light settings brightness schedule command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set light settings brightness schedule - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_LIGHT_CTRL_BRIGHT_SCH,
@@ -3284,7 +3306,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending floodlight light settings motion triggered command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set light settings motion triggered - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isFloodLight()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_LIGHT_CTRL_PIR_SWITCH,
@@ -3341,7 +3363,7 @@ export class Station extends TypedEmitter {
throw new InvalidPropertyValueError("Invalid value for this property", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } });
}
- this.log.debug(`Sending floodlight light settings motion triggered distance command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${newValue}`);
+ this.log.debug(`Station set light settings motion triggered distance - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: newValue });
if (device.isFloodLight()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_PIRSENSITIVITY,
@@ -3371,7 +3393,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, seconds);
- this.log.debug(`Sending floodlight light settings motion triggered timer command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${seconds}`);
+ this.log.debug(`Station set light settings motion triggered timer - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: seconds });
if (device.isFloodLight()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_LIGHT_CTRL_PIR_TIME,
@@ -3406,7 +3428,7 @@ export class Station extends TypedEmitter {
if (!this.hasCommand(CommandName.StationTriggerAlarmSound)) {
throw new NotSupportedError("This functionality is not implemented or supported", { context: { commandName: commandData.name, station: this.getSerial()} });
}
- this.log.debug(`Sending trigger station alarm sound command to station ${this.getSerial()} with value: ${seconds}`);
+ this.log.debug(`Station trigger station alarm sound - sending command`, { stationSN: this.getSerial(), value: seconds });
if (!isGreaterEqualMinVersion("2.0.7.9", this.getSoftwareVersion()) || Device.isIntegratedDeviceBySn(this.getSerial())) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_TONE_FILE,
@@ -3451,7 +3473,7 @@ export class Station extends TypedEmitter {
if (!device.hasCommand(CommandName.DeviceTriggerAlarmSound)) {
throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending trigger device alarm sound command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${seconds}`);
+ this.log.debug(`Station trigger device alarm sound - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: seconds });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_TONE_FILE,
value: seconds,
@@ -3478,7 +3500,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station alarm ringtone volume command to station ${this.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set station alarm ringtone volume - sending command`, { stationSN: this.getSerial(), value: value });
if (Device.isWallLightCam(this.getDeviceType())) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -3513,7 +3535,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station alarm tone command to station ${this.getSerial()} with value: ${AlarmTone[value]}`);
+ this.log.debug(`Station set station alarm tone - sending command`, { stationSN: this.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
value: JSON.stringify({
@@ -3541,7 +3563,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station prompt volume command to station ${this.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set station prompt volume - sending command`, { stationSN: this.getSerial(), value: value });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
value: JSON.stringify({
@@ -3572,7 +3594,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station notification switch mode command to station ${this.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set station notification switch mode - sending command`, { stationSN: this.getSerial(), mode: mode, value: value });
if (isGreaterEqualMinVersion("2.1.1.6", this.getSoftwareVersion())) {
let oldvalue = 0;
const rawproperty = this.getRawProperty(CommandType.CMD_HUB_NOTIFY_MODE);
@@ -3638,7 +3660,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station notification start alarm delay command to station ${this.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set station notification start alarm delay - sending command`, { stationSN: this.getSerial(), value: value });
if (isGreaterEqualMinVersion("2.1.1.6", this.getSoftwareVersion())) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -3687,7 +3709,7 @@ export class Station extends TypedEmitter {
const property = this.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending station time format command to station ${this.getSerial()} with value: ${TimeFormat[value]}`);
+ this.log.debug(`Station set station time format - sending command`, { stationSN: this.getSerial(), value: value });
if (Device.isWallLightCam(this.getDeviceType())) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -3725,7 +3747,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending rtsp stream command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set rtsp stream - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_NAS_SWITCH,
value: value === true ? 1 : 0,
@@ -3751,7 +3773,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending antitheft detection command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set anti theft detection - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_EAS_SWITCH,
value: value === true ? 1 : 0,
@@ -3777,12 +3799,12 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
+ this.log.debug(`Station set watermark - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isCamera2Product() || device.isCamera3Product()) {
if (!Object.values(WatermarkSetting3).includes(value as WatermarkSetting3)) {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, WatermarkSetting3);
return;
}
- this.log.debug(`Sending watermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting3[value]}`);
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_OSD,
value: value,
@@ -3797,7 +3819,6 @@ export class Station extends TypedEmitter {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, WatermarkSetting1);
return;
}
- this.log.debug(`Sending watermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting1[value]}`);
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_OSD,
value: value,
@@ -3812,7 +3833,6 @@ export class Station extends TypedEmitter {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, WatermarkSetting4);
return;
}
- this.log.debug(`Sending watermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting4[value]}`);
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_OSD,
value: value,
@@ -3827,7 +3847,6 @@ export class Station extends TypedEmitter {
this.log.error(`The device ${device.getSerial()} accepts only this type of values: `, WatermarkSetting2);
return;
}
- this.log.debug(`Sending matermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting2[value]}`);
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_OSD,
value: value,
@@ -3842,7 +3861,6 @@ export class Station extends TypedEmitter {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, WatermarkSetting1);
return;
}
- this.log.debug(`Sending watermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting1[value]}`);
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -3858,7 +3876,6 @@ export class Station extends TypedEmitter {
this.log.error(`The device ${device.getSerial()} accepts only this type of values:`, WatermarkSetting5);
return;
}
- this.log.debug(`Sending watermark command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${WatermarkSetting5[value]}`);
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SET_DEVS_OSD,
value: value,
@@ -3891,7 +3908,7 @@ export class Station extends TypedEmitter {
if ((device.isIndoorCamera() && !device.isIndoorCamMini()) || (device.isWiredDoorbell() && !device.isWiredDoorbellT8200X()) || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8422 || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8424 || device.isFloodLightT8420X())
param_value = value === true ? 1 : 0;
- this.log.debug(`Sending enable device command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station enable device - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isIndoorCamMini()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
@@ -3932,10 +3949,10 @@ export class Station extends TypedEmitter {
if (!device.hasCommand(CommandName.DeviceStartDownload)) {
throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
+ this.log.debug(`Station start download - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), path: path, cipherID: cipher_id });
if (this.getDeviceType() === DeviceType.HB3) {
//TODO: Implement HB3 Support! Actually doesn't work and returns return_code -104 (ERROR_INVALID_ACCOUNT). It could be that we need the new encrypted p2p protocol to make this work...
const rsa_key = this.p2pSession.getDownloadRSAPrivateKey();
- this.log.debug(`Sending start download command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${path}`);
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOWNLOAD_VIDEO,
value: JSON.stringify({
@@ -3955,7 +3972,6 @@ export class Station extends TypedEmitter {
} else if (cipher_id !== undefined) {
const cipher = await this.api.getCipher(cipher_id, this.rawStation.member.admin_user_id);
if (Object.keys(cipher).length > 0) {
- this.log.debug(`Sending start download command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${path}`);
this.p2pSession.setDownloadRSAPrivateKeyPem(cipher.private_key);
await this.p2pSession.sendCommandWithString({
commandType: CommandType.CMD_DOWNLOAD_VIDEO,
@@ -3999,7 +4015,7 @@ export class Station extends TypedEmitter {
if (!device.hasCommand(CommandName.DeviceCancelDownload)) {
throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending cancel download command to station ${this.getSerial()} for device ${device.getSerial()}`);
+ this.log.debug(`Station cancel download - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial() });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_DOWNLOAD_CANCEL,
value: device.getChannel(),
@@ -4024,11 +4040,11 @@ export class Station extends TypedEmitter {
if (this.isLiveStreaming(device)) {
throw new LivestreamAlreadyRunningError("Livestream for device is already running", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending start livestream command to station ${this.getSerial()} for device ${device.getSerial()}`);
+ this.log.debug(`Station start livestream - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), videoCodec: videoCodec });
const rsa_key = this.p2pSession.getRSAPrivateKey();
- if (device.isSoloCameras() || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || device.isWiredDoorbellT8200X() || device.isWallLightCam() || device.isGarageCamera()) {
- this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD (1) for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
+ if (device.isSoloCameras() || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8423 || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8424 || device.getDeviceType() === DeviceType.FLOODLIGHT_CAMERA_8424 || device.isWiredDoorbellT8200X() || device.isWallLightCam() || device.isGarageCamera()) {
+ this.log.debug(`Station start livestream - sending command using CMD_DOORBELL_SET_PAYLOAD (1)`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), videoCodec: videoCodec, main_sw_version: this.getSoftwareVersion() });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -4044,7 +4060,7 @@ export class Station extends TypedEmitter {
command: commandData
});
} else if (device.isWiredDoorbell() || (device.isFloodLight() && device.getDeviceType() !== DeviceType.FLOODLIGHT) || device.isIndoorCamera() || (device.getSerial().startsWith("T8420") && isGreaterEqualMinVersion("2.0.4.8", this.getSoftwareVersion()))) {
- this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD (2) for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
+ this.log.debug(`Station start livestream - sending command using CMD_DOORBELL_SET_PAYLOAD (2)`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), videoCodec: videoCodec, main_sw_version: this.getSoftwareVersion() });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -4061,7 +4077,7 @@ export class Station extends TypedEmitter {
});
} else {
if ((Device.isIntegratedDeviceBySn(this.getSerial()) || !isGreaterEqualMinVersion("2.0.9.7", this.getSoftwareVersion())) && (!this.getSerial().startsWith("T8420") || !isGreaterEqualMinVersion("1.0.0.25", this.getSoftwareVersion()))) {
- this.log.debug(`Using CMD_START_REALTIME_MEDIA for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
+ this.log.debug(`Station start livestream - sending command using CMD_START_REALTIME_MEDIA`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), videoCodec: videoCodec, main_sw_version: this.getSoftwareVersion() });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_START_REALTIME_MEDIA,
value: device.getChannel(),
@@ -4071,7 +4087,7 @@ export class Station extends TypedEmitter {
command: commandData
});
} else {
- this.log.debug(`Using CMD_SET_PAYLOAD for station ${this.getSerial()} (main_sw_version: ${this.getSoftwareVersion()})`);
+ this.log.debug(`Station start livestream - sending command using CMD_SET_PAYLOAD`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), videoCodec: videoCodec, main_sw_version: this.getSoftwareVersion() });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
value: JSON.stringify({
@@ -4105,7 +4121,7 @@ export class Station extends TypedEmitter {
if (!this.isLiveStreaming(device)) {
throw new LivestreamNotRunningError("Livestream for device is not running", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending stop livestream command to station ${this.getSerial()} for device ${device.getSerial()}`);
+ this.log.debug(`Station stop livestream - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial() });
await this.p2pSession.sendCommandWithInt({
commandType: CommandType.CMD_STOP_REALTIME_MEDIA,
value: device.getChannel(),
@@ -4138,9 +4154,9 @@ export class Station extends TypedEmitter {
if (!device.hasCommand(CommandName.DeviceQuickResponse)) {
throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), commandName: commandData.name, commandValue: commandData.value } });
}
- this.log.debug(`Sending quick response command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${voice_id}`);
+ this.log.debug(`Station quick response - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), voiceID: voice_id });
if (device.isBatteryDoorbell()) {
- this.log.debug(`Using CMD_BAT_DOORBELL_QUICK_RESPONSE for station ${this.getSerial()}`);
+ this.log.debug(`Station quick response - sending command using CMD_BAT_DOORBELL_QUICK_RESPONSE`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), voiceID: voice_id });
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_BAT_DOORBELL_QUICK_RESPONSE,
value: voice_id,
@@ -4151,7 +4167,7 @@ export class Station extends TypedEmitter {
command: commandData
});
} else if (device.isWiredDoorbell()) {
- this.log.debug(`Using CMD_DOORBELL_SET_PAYLOAD for station ${this.getSerial()}`);
+ this.log.debug(`Station quick response - sending command using CMD_DOORBELL_SET_PAYLOAD`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), voiceID: voice_id });
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_DOORBELL_SET_PAYLOAD,
value: JSON.stringify({
@@ -4183,7 +4199,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending chirp volume command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set chirp volume - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isEntrySensor()) {
await this.p2pSession.sendCommandWithStringPayload({
commandType: CommandType.CMD_SET_PAYLOAD,
@@ -4219,7 +4235,7 @@ export class Station extends TypedEmitter {
const property = device.getPropertyMetadata(propertyData.name);
validValue(property, value);
- this.log.debug(`Sending chirp tone command to station ${this.getSerial()} for device ${device.getSerial()} with value: ${value}`);
+ this.log.debug(`Station set chirp tone - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value });
if (device.isEntrySensor()) {
await this.p2pSession.sendCommandWithIntString({
commandType: CommandType.CMD_SENSOR_SET_CHIRP_TONE,
@@ -4249,7 +4265,7 @@ export class Station extends TypedEmitter