diff --git a/plugins/unifi-protect/package-lock.json b/plugins/unifi-protect/package-lock.json index 5b2dd763b..d82c4276c 100644 --- a/plugins/unifi-protect/package-lock.json +++ b/plugins/unifi-protect/package-lock.json @@ -1,23 +1,23 @@ { "name": "@scrypted/unifi-protect", - "version": "0.0.133", + "version": "0.0.134", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/unifi-protect", - "version": "0.0.133", + "version": "0.0.134", "license": "Apache", "dependencies": { "@koush/unifi-protect": "file:../../external/unifi-protect", "@scrypted/common": "file:../../common", "@scrypted/sdk": "file:../../sdk", - "axios": "^1.2.2", - "ws": "^8.5.0" + "axios": "^1.4.0", + "ws": "^8.13.0" }, "devDependencies": { - "@types/node": "^16.7.1", - "@types/ws": "^7.4.7" + "@types/node": "^20.4.2", + "@types/ws": "^8.5.5" } }, "../../common": { @@ -61,7 +61,7 @@ }, "../../sdk": { "name": "@scrypted/sdk", - "version": "0.2.86", + "version": "0.2.103", "license": "ISC", "dependencies": { "@babel/preset-typescript": "^7.18.6", @@ -112,15 +112,15 @@ "link": true }, "node_modules/@types/node": { - "version": "16.7.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz", - "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true }, "node_modules/@types/ws": { - "version": "7.4.7", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", - "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", "dev": true, "dependencies": { "@types/node": "*" @@ -132,9 +132,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", - "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -217,15 +217,15 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -291,15 +291,15 @@ } }, "@types/node": { - "version": "16.7.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz", - "integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true }, "@types/ws": { - "version": "7.4.7", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", - "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", "dev": true, "requires": { "@types/node": "*" @@ -311,9 +311,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "axios": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", - "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -367,9 +367,9 @@ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "requires": {} } } diff --git a/plugins/unifi-protect/package.json b/plugins/unifi-protect/package.json index 5a0b2c316..a970e6775 100644 --- a/plugins/unifi-protect/package.json +++ b/plugins/unifi-protect/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/unifi-protect", - "version": "0.0.133", + "version": "0.0.134", "description": "Unifi Protect Plugin for Scrypted", "author": "Scrypted", "license": "Apache", @@ -34,14 +34,14 @@ ] }, "devDependencies": { - "@types/node": "^16.7.1", - "@types/ws": "^7.4.7" + "@types/node": "^20.4.2", + "@types/ws": "^8.5.5" }, "dependencies": { "@koush/unifi-protect": "file:../../external/unifi-protect", "@scrypted/common": "file:../../common", "@scrypted/sdk": "file:../../sdk", - "axios": "^1.2.2", - "ws": "^8.5.0" + "axios": "^1.4.0", + "ws": "^8.13.0" } } diff --git a/plugins/unifi-protect/src/camera.ts b/plugins/unifi-protect/src/camera.ts index 16c0ec53e..8e0244347 100644 --- a/plugins/unifi-protect/src/camera.ts +++ b/plugins/unifi-protect/src/camera.ts @@ -14,11 +14,12 @@ const { log, deviceManager, mediaManager } = sdk; export const defaultSensorTimeout = 30; export class UnifiPackageCamera extends ScryptedDeviceBase implements Camera, VideoCamera, MotionSensor { - constructor(public camera: UnifiCamera, nativeId: string) { + constructor(public protectCamera: UnifiCamera, nativeId: string) { super(nativeId); + this.console.log(protectCamera); } async takePicture(options?: PictureOptions): Promise { - const buffer = await this.camera.getSnapshot(options, 'package-snapshot?'); + const buffer = await this.protectCamera.getSnapshot(options, 'package-snapshot?'); return this.createMediaObject(buffer, 'image/jpeg'); } async getPictureOptions(): Promise { @@ -30,10 +31,10 @@ export class UnifiPackageCamera extends ScryptedDeviceBase implements Camera, Vi } async getVideoStream(options?: MediaStreamOptions): Promise { const o = (await this.getVideoStreamOptions())[0]; - return this.camera.getVideoStream(o); + return this.protectCamera.getVideoStream(o); } async getVideoStreamOptions(): Promise { - const options = await this.camera.getVideoStreamOptions(); + const options = await this.protectCamera.getVideoStreamOptions(); return [options[options.length - 1]]; } } @@ -59,6 +60,7 @@ export class UnifiCamera extends ScryptedDeviceBase implements Notifier, Interco } this.updateState(protectCamera); + this.console.log(protectCamera); } async ptzCommand(command: PanTiltZoomCommand): Promise { diff --git a/plugins/unifi-protect/src/light.ts b/plugins/unifi-protect/src/light.ts index 0e81cd8b6..bcf099d1b 100644 --- a/plugins/unifi-protect/src/light.ts +++ b/plugins/unifi-protect/src/light.ts @@ -8,6 +8,7 @@ export class UnifiLight extends ScryptedDeviceBase implements OnOff, Brightness, this.temperatureUnit = TemperatureUnit.C; this.updateState(protectLight); + this.console.log(protectLight); } async turnOff(): Promise { const result = await this.protect.api.updateLight(this.findLight(), { lightOnSettings: { isLedForceOn: false } }); diff --git a/plugins/unifi-protect/src/lock.ts b/plugins/unifi-protect/src/lock.ts index ebd300462..c087f446d 100644 --- a/plugins/unifi-protect/src/lock.ts +++ b/plugins/unifi-protect/src/lock.ts @@ -7,6 +7,7 @@ export class UnifiLock extends ScryptedDeviceBase implements Lock { super(nativeId); this.updateState(protectLock); + this.console.log(protectLock); } async lock(): Promise { diff --git a/plugins/unifi-protect/src/sensor.ts b/plugins/unifi-protect/src/sensor.ts index 53b45a26d..b584d710d 100644 --- a/plugins/unifi-protect/src/sensor.ts +++ b/plugins/unifi-protect/src/sensor.ts @@ -7,6 +7,7 @@ export class UnifiSensor extends ScryptedDeviceBase implements Thermometer, Humi super(nativeId); this.temperatureUnit = TemperatureUnit.C; this.updateState(protectSensor); + this.console.log(protectSensor); } findSensor() {