From 9442c92cf4f9003ee3431637d2770e6898e7743b Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 9 Sep 2021 17:49:25 -0700 Subject: [PATCH] update for volume --- plugins/core/package-lock.json | 4 +-- plugins/core/package.json | 2 +- .../ui/src/components/dashboard/layout.ts | 3 ++- plugins/core/ui/src/interfaces/Setting.vue | 12 ++++----- plugins/homekit/package-lock.json | 4 +-- plugins/homekit/package.json | 2 +- plugins/homekit/src/main.ts | 26 ++++++++++--------- plugins/rtsp/package-lock.json | 4 +-- plugins/rtsp/package.json | 2 +- plugins/zwave/package-lock.json | 4 +-- plugins/zwave/package.json | 2 +- plugins/zwave/src/main.ts | 8 +++++- 12 files changed, 41 insertions(+), 32 deletions(-) diff --git a/plugins/core/package-lock.json b/plugins/core/package-lock.json index 5249b61ba..c750a08c1 100644 --- a/plugins/core/package-lock.json +++ b/plugins/core/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/core", - "version": "0.0.72", + "version": "0.0.76", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/core", - "version": "0.0.72", + "version": "0.0.76", "license": "Apache-2.0", "dependencies": { "@scrypted/sdk": "file:../../sdk", diff --git a/plugins/core/package.json b/plugins/core/package.json index 7b7578954..9a2fa29a8 100644 --- a/plugins/core/package.json +++ b/plugins/core/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/core", - "version": "0.0.72", + "version": "0.0.76", "description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/core/ui/src/components/dashboard/layout.ts b/plugins/core/ui/src/components/dashboard/layout.ts index 25a3f0788..eae2c55f9 100644 --- a/plugins/core/ui/src/components/dashboard/layout.ts +++ b/plugins/core/ui/src/components/dashboard/layout.ts @@ -140,6 +140,7 @@ for (const type of [ScryptedDeviceType.Light, ScryptedDeviceType.Outlet, Scrypte } cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Sensor, 0, true, 6, DashboardMap, { cardName: "Map" }, ScryptedInterface.PositionSensor)); cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Camera, 0, false, 4, DashboardCamera, undefined, ScryptedInterface.Camera, ScryptedInterface.VideoCamera)); +cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Doorbell, 0, false, 4, DashboardCamera, undefined, ScryptedInterface.Camera, ScryptedInterface.VideoCamera)); cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Lock, 15, false, 1, DashboardLock, undefined, ScryptedInterface.Lock)); cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Thermostat, 20, false, 1, DashboardThermostat, undefined, ScryptedInterface.TemperatureSetting)); cardComponentTypes.push(new CardComponentType(ScryptedDeviceType.Vacuum, 10, false, 1, DashboardStartStop, undefined, ScryptedInterface.StartStop)); @@ -180,7 +181,7 @@ const cardComponentSettings: Map = new Map(); { title: "Camera Device", key: "deviceId", - type: `device:${JSON.stringify(ScryptedDeviceType.Camera)} === type && (interfaces.includes(${JSON.stringify(ScryptedInterface.Camera)}) || interfaces.includes(${JSON.stringify(ScryptedInterface.VideoCamera)}))`, + type: `device:(${JSON.stringify(ScryptedDeviceType.Camera)} === type || ${JSON.stringify(ScryptedDeviceType.Doorbell)} === type) && (interfaces.includes(${JSON.stringify(ScryptedInterface.Camera)}) || interfaces.includes(${JSON.stringify(ScryptedInterface.VideoCamera)}))`, value: null, } ]); diff --git a/plugins/core/ui/src/interfaces/Setting.vue b/plugins/core/ui/src/interfaces/Setting.vue index 94557663e..a10c381ec 100644 --- a/plugins/core/ui/src/interfaces/Setting.vue +++ b/plugins/core/ui/src/interfaces/Setting.vue @@ -21,8 +21,8 @@ persistent-hint > @@ -55,8 +55,8 @@ :description="lazyValue.description" > @@ -72,8 +72,8 @@ :type="lazyValue.type && lazyValue.type.toLowerCase() === 'password' ? 'password' : undefined" > diff --git a/plugins/homekit/package-lock.json b/plugins/homekit/package-lock.json index 7f46019a9..a4ac2cd89 100644 --- a/plugins/homekit/package-lock.json +++ b/plugins/homekit/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/homekit", - "version": "0.0.34", + "version": "0.0.37", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/homekit", - "version": "0.0.34", + "version": "0.0.37", "dependencies": { "axios": "^0.21.1", "hap-nodejs": "file:../HAP-NodeJS", diff --git a/plugins/homekit/package.json b/plugins/homekit/package.json index 73395cc93..59f139b34 100644 --- a/plugins/homekit/package.json +++ b/plugins/homekit/package.json @@ -42,5 +42,5 @@ "@types/node": "^14.17.9", "@types/url-parse": "^1.4.3" }, - "version": "0.0.34" + "version": "0.0.37" } diff --git a/plugins/homekit/src/main.ts b/plugins/homekit/src/main.ts index 420756728..611cacafa 100644 --- a/plugins/homekit/src/main.ts +++ b/plugins/homekit/src/main.ts @@ -60,9 +60,19 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings { } getUsername() { - return this.storage.getItem("mac") || (Object.entries(os.networkInterfaces()).filter(([iface, entry]) => iface.startsWith('en') || iface.startsWith('wlan')) as any) + let username = this.storage.getItem("mac") || (Object.entries(os.networkInterfaces()).filter(([iface, entry]) => iface.startsWith('en') || iface.startsWith('wlan')) as any) .flat().map(([iface, entry]) => entry).find(i => i && (i.family === 'IPv4' || i.family === 'IPv6'))?.mac; - } + + if (!username) { + const buffers = []; + for (let i = 0; i < 6; i++) { + buffers.push(randomBytes(1).toString('hex')); + } + username = buffers.join(':'); + this.storage.setItem('mac', username); + } + return username; + } async getSettings(): Promise { return [ @@ -116,7 +126,7 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings { } catch (e) { console.error('error while checking device if syncable', e); - throw e; + continue; } const accessory = supportedType.getAccessory(device); @@ -141,15 +151,7 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings { this.storage.setItem('defaultIncluded', JSON.stringify(defaultIncluded)); - let username = this.getUsername(); - if (!username) { - const buffers = []; - for (let i = 0; i < 6; i++) { - buffers.push(randomBytes(1).toString('hex')); - } - username = buffers.join(':'); - this.storage.setItem('username', username); - } + const username = this.getUsername(); this.bridge.publish({ username: this.getUsername(), diff --git a/plugins/rtsp/package-lock.json b/plugins/rtsp/package-lock.json index ce20f068e..6b40150ce 100644 --- a/plugins/rtsp/package-lock.json +++ b/plugins/rtsp/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/rtsp", - "version": "0.0.19", + "version": "0.0.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/rtsp", - "version": "0.0.19", + "version": "0.0.20", "license": "Apache", "dependencies": { "axios": "^0.18.1", diff --git a/plugins/rtsp/package.json b/plugins/rtsp/package.json index 4aa871eab..439790dd4 100644 --- a/plugins/rtsp/package.json +++ b/plugins/rtsp/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/rtsp", - "version": "0.0.19", + "version": "0.0.20", "description": "RTSP Cameras and Streams Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/zwave/package-lock.json b/plugins/zwave/package-lock.json index 1591e5bb2..831d938ef 100644 --- a/plugins/zwave/package-lock.json +++ b/plugins/zwave/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/zwave", - "version": "0.0.27", + "version": "0.0.28", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/zwave", - "version": "0.0.27", + "version": "0.0.28", "license": "Apache", "dependencies": { "@scrypted/sdk": "file:../../sdk", diff --git a/plugins/zwave/package.json b/plugins/zwave/package.json index ab4aae0d0..d124cd2fd 100644 --- a/plugins/zwave/package.json +++ b/plugins/zwave/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/zwave", - "version": "0.0.27", + "version": "0.0.28", "description": "Z-Wave USB Controller for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/zwave/src/main.ts b/plugins/zwave/src/main.ts index 239c2683a..9a602f2ea 100644 --- a/plugins/zwave/src/main.ts +++ b/plugins/zwave/src/main.ts @@ -7,6 +7,7 @@ import debounce from "lodash/debounce"; import { Driver, Endpoint, ZWaveController, ZWaveNode, CommandClass } from "zwave-js"; import { ValueID, CommandClasses } from "@zwave-js/core" import { randomBytes } from "crypto"; +import path from "path/posix"; const { log, deviceManager } = sdk; @@ -60,8 +61,13 @@ export class ZwaveControllerProvider extends ScryptedDeviceBase implements Devic this.log.a('No Network Key was present, so a random one was generated. You can change the Network Key in Settings.') } + const cacheDir = path.join(process.env['SCRYPTED_PLUGIN_VOLUME'], 'cache'); + this.console.log(process.cwd()); const driver = new Driver(this.storage.getItem('serialPort'), { - networkKey + networkKey, + storage: { + cacheDir, + } }); this.driver = driver; console.log(driver.cacheDir);