From cfd3383b2356bf70dfc2cbe80243cf54555a700c Mon Sep 17 00:00:00 2001 From: Yasuharu Ozaki Date: Sat, 6 Nov 2021 19:31:45 +0900 Subject: [PATCH] Use default CLIENT_ID when clientID is not set in config.json --- config.schema.json | 17 +---------------- src/platform.ts | 3 +++ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/config.schema.json b/config.schema.json index 1cb319e..65c3163 100644 --- a/config.schema.json +++ b/config.schema.json @@ -18,19 +18,6 @@ "type": "password" } }, - "clientID": { - "title": "Client ID", - "description": "CLIENT_ID at https://dash.candyhouse.co. Leave blank when you don't have CLIENT_ID.", - "type": "string", - "required": false - }, - "interval": { - "title": "Status update interval(second)", - "description": "Status update interval used only when CLIENT_ID is empty", - "type": "number", - "default": 3600000, - "required": false - }, "locks": { "title": "Sesame Locks", "type": "array", @@ -94,9 +81,7 @@ "title": "Common settings", "items": [ "name", - "apiKey", - "clientID", - "interval" + "apiKey" ] }, { diff --git a/src/platform.ts b/src/platform.ts index 04249f4..ababaf7 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -18,6 +18,8 @@ import { } from "./settings"; import { CHDevice } from "./types/Device"; +const CLIENT_ID = "ap-northeast-1:0a1820f1-dbb3-4bca-9227-2a92f6abf0ae"; + export class OpenSesame implements DynamicPlatformPlugin { public readonly Service: typeof Service = this.api.hap.Service; public readonly Characteristic: typeof Characteristic = @@ -49,6 +51,7 @@ export class OpenSesame implements DynamicPlatformPlugin { } this.config = config; + this.config.clientID = config.clientID ? config.clientID : CLIENT_ID; this.api.on(APIEvent.DID_FINISH_LAUNCHING, () => { this.log.debug("Executed didFinishLaunching callback");