From 9554dfe88d6498f87645a60d62c45b24e924b864 Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 11 Mar 2020 22:07:46 +0500 Subject: [PATCH 1/6] Add IP address to result and error messages, to help diagnosis. --- Devices/MiPhilipsCeilingLamp.js | 24 ++++++++++---------- Devices/MiPhilipsSmartBulb.js | 24 ++++++++++---------- Devices/MiPhilipsTableLamp2.js | 40 ++++++++++++++++----------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Devices/MiPhilipsCeilingLamp.js b/Devices/MiPhilipsCeilingLamp.js index ead59ed..ad12f98 100644 --- a/Devices/MiPhilipsCeilingLamp.js +++ b/Devices/MiPhilipsCeilingLamp.js @@ -71,23 +71,23 @@ MiPhilipsCeilingLampLight.prototype.getServices = function() { CeilingLampOnCharacteristic .on('get', function(callback) { this.device.call("get_prop", ["power"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - getPower: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - getPower: " + result); callback(null, result[0] === 'on' ? true : false); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - getPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - getPower Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { that.device.call("set_power", [value ? "on" : "off"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - setPower Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - setPower Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - setPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - setPower Error: " + err); callback(err); }); }.bind(this)); @@ -95,24 +95,24 @@ MiPhilipsCeilingLampLight.prototype.getServices = function() { .addCharacteristic(Characteristic.Brightness) .on('get', function(callback) { this.device.call("get_prop", ["bright"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - getBrightness: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - getBrightness: " + result); callback(null, result[0]); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - getBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - getBrightness Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { if(value > 0) { this.device.call("set_bright", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - setBrightness Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - setBrightness Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - setBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - setBrightness Error: " + err); callback(err); }); } else { @@ -123,10 +123,10 @@ MiPhilipsCeilingLampLight.prototype.getServices = function() { .getCharacteristic(Characteristic.ColorTemperature) .on('get', function(callback) { this.device.call("get_prop", ["cct"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - getColorTemperature: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - getColorTemperature: " + result); callback(null, result[0] * 350); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - getColorTemperature Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - getColorTemperature Error: " + err); callback(err); }); }.bind(this)) @@ -139,14 +139,14 @@ MiPhilipsCeilingLampLight.prototype.getServices = function() { } that.platform.log.debug("[MiPhilipsLightPlatform]MiPhilipsCeilingLamp - setColorTemperature : " + value + "%"); this.device.call("set_cct", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp - setColorTemperature Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsCeilingLamp (" + that.device.address + ") - setColorTemperature Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp - setColorTemperature Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsCeilingLamp (" + that.device.address + ") - setColorTemperature Error: " + err); callback(err); }); }.bind(this)); diff --git a/Devices/MiPhilipsSmartBulb.js b/Devices/MiPhilipsSmartBulb.js index f964672..6607891 100644 --- a/Devices/MiPhilipsSmartBulb.js +++ b/Devices/MiPhilipsSmartBulb.js @@ -73,10 +73,10 @@ MiPhilipsSmartBulbLight.prototype.getServices = function() { MiPhilipsSmartBulbLight.prototype.getPower = function(callback) { var that = this; this.device.call("get_prop", ["power"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - getPower: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getPower: " + result); callback(null, result[0] === 'on' ? true : false); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getPower Error: " + err); callback(err); }); } @@ -84,14 +84,14 @@ MiPhilipsSmartBulbLight.prototype.getPower = function(callback) { MiPhilipsSmartBulbLight.prototype.setPower = function(value, callback) { var that = this; that.device.call("set_power", [value ? "on" : "off"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - setPower Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setPower Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - setPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setPower Error: " + err); callback(err); }); } @@ -99,10 +99,10 @@ MiPhilipsSmartBulbLight.prototype.setPower = function(value, callback) { MiPhilipsSmartBulbLight.prototype.getBrightness = function(callback) { var that = this; this.device.call("get_prop", ["bright"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - getBrightness: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getBrightness: " + result); callback(null, result[0]); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getBrightness Error: " + err); callback(err); }); } @@ -111,14 +111,14 @@ MiPhilipsSmartBulbLight.prototype.setBrightness = function(value, callback) { var that = this; if(value > 0) { this.device.call("set_bright", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - setBrightness Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setBrightness Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - setBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setBrightness Error: " + err); callback(err); }); } else { @@ -129,10 +129,10 @@ MiPhilipsSmartBulbLight.prototype.setBrightness = function(value, callback) { MiPhilipsSmartBulbLight.prototype.getColorTemperature = function(callback) { var that = this; this.device.call("get_prop", ["cct"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - getColorTemperature: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getColorTemperature: " + result); callback(null, result[0] * 350); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - getColorTemperature Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - getColorTemperature Error: " + err); callback(err); }); } @@ -146,14 +146,14 @@ MiPhilipsSmartBulbLight.prototype.setColorTemperature = function(value, callback } var that = this; this.device.call("set_cct", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light - setColorTemperature Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setColorTemperature Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light - setColorTemperature Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsSmartBulb - Light (" + that.device.address + ") - setColorTemperature Error: " + err); callback(err); }); } diff --git a/Devices/MiPhilipsTableLamp2.js b/Devices/MiPhilipsTableLamp2.js index dfe3d0a..d40f5c9 100644 --- a/Devices/MiPhilipsTableLamp2.js +++ b/Devices/MiPhilipsTableLamp2.js @@ -63,16 +63,16 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { mainLightOnCharacteristic .on('get', function(callback) { this.device.call("get_prop", ["power"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight - getPower: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - getPower: " + result); callback(null, result[0] === 'on' ? true : false); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight - getPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - getPower Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { that.device.call("set_power", [value ? "on" : "off"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight - setPower Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - setPower Result: " + result); if(result[0] === "ok") { if(value) { eyecareSwitchOnCharacteristic.getValue(); @@ -90,7 +90,7 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight - setPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - setPower Error: " + err); callback(err); }); }.bind(this)); @@ -98,24 +98,24 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { .addCharacteristic(Characteristic.Brightness) .on('get', function(callback) { this.device.call("get_prop", ["bright"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight - getBrightness: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - getBrightness: " + result); callback(null, result[0]); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight - getBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - getBrightness Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { if(value > 0) { this.device.call("set_bright", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight - setBrightness Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - setBrightness Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight - setBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - MainLight (" + that.device.address + ") - setBrightness Error: " + err); callback(err); }); } else { @@ -127,16 +127,16 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { secondLightOnCharacteristic .on('get', function(callback) { this.device.call("get_prop", ["ambstatus"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight - getPower: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - getPower: " + result); callback(null, result[0] === 'on' && mainLightOnCharacteristic.value ? true : false); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight - getPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - getPower Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { that.device.call("enable_amb", [value ? "on" : "off"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight - setPower Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - setPower Result: " + result); if(result[0] === "ok") { if(value) { mainLightOnCharacteristic.getValue(); @@ -147,7 +147,7 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight - setPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - setPower Error: " + err); callback(err); }); }.bind(this)); @@ -155,24 +155,24 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { .addCharacteristic(Characteristic.Brightness) .on('get', function(callback) { this.device.call("get_prop", ["ambvalue"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight - getBrightness: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - getBrightness: " + result); callback(null, result[0]); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight - getBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - getBrightness Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { if(value > 0) { this.device.call("set_amb_bright", [value]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight - setBrightness Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - setBrightness Result: " + result); if(result[0] === "ok") { callback(null); } else { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight - setBrightness Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - SecondLight (" + that.device.address + ") - setBrightness Error: " + err); callback(err); }); } else { @@ -186,16 +186,16 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { eyecareSwitchOnCharacteristic .on('get', function(callback) { this.device.call("get_prop", ["eyecare"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - EyecareSwitch - getPower: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - EyecareSwitch (" + that.device.address + ") - getPower: " + result); callback(null, result[0] === 'on' && mainLightOnCharacteristic.value ? true : false); }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - EyecareSwitch - getPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - EyecareSwitch (" + that.device.address + ") - getPower Error: " + err); callback(err); }); }.bind(this)) .on('set', function(value, callback) { that.device.call("set_eyecare", [value ? "on" : "off"]).then(result => { - that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - EyecareSwitch - setPower Result: " + result); + that.platform.log.debug("[MiPhilipsLightPlatform][DEBUG]MiPhilipsTableLamp2 - EyecareSwitch (" + that.device.address + ") - setPower Result: " + result); if(result[0] === "ok") { if(value) { mainLightOnCharacteristic.getValue(); @@ -206,7 +206,7 @@ MiPhilipsTableLamp2Light.prototype.getServices = function() { callback(new Error(result[0])); } }).catch(function(err) { - that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - EyecareSwitch - setPower Error: " + err); + that.platform.log.error("[MiPhilipsLightPlatform][ERROR]MiPhilipsTableLamp2 - EyecareSwitch (" + that.device.address + ") - setPower Error: " + err); callback(err); }); }.bind(this)); From 27769b20ebdb90161d70bdb5a101f38994765fcb Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 27 May 2020 17:06:39 +0500 Subject: [PATCH 2/6] Initial attempt at config UI support (https://github.com/oznu/homebridge-config-ui-x/wiki/Developers%3A-Plugin-Settings-GUI) --- config.schema.json | 816 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 816 insertions(+) create mode 100644 config.schema.json diff --git a/config.schema.json b/config.schema.json new file mode 100644 index 0000000..be115a3 --- /dev/null +++ b/config.schema.json @@ -0,0 +1,816 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "http://example.com/example.json", + "type": "object", + "title": "The root schema", + "description": "The root schema comprises the entire JSON document.", + "default": {}, + "examples": [ + { + "pluginAlias": "MiPhilipsLightPlatform", + "pluginType": "platform", + "singular": false, + "schema": { + "deviceCfgs": { + "title": "Devices", + "type": "array", + "items": { + "title": "Device", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + } + } + } + } + ], + "required": [ + "pluginAlias", + "pluginType", + "singular", + "schema" + ], + "additionalProperties": true, + "properties": { + "pluginAlias": { + "$id": "#/properties/pluginAlias", + "type": "string", + "title": "The pluginAlias schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "MiPhilipsLightPlatform" + ] + }, + "pluginType": { + "$id": "#/properties/pluginType", + "type": "string", + "title": "The pluginType schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "platform" + ] + }, + "singular": { + "$id": "#/properties/singular", + "type": "boolean", + "title": "The singular schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + false + ] + }, + "schema": { + "$id": "#/properties/schema", + "type": "object", + "title": "The schema schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "deviceCfgs": { + "title": "Devices", + "type": "array", + "items": { + "title": "Device", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + } + } + } + ], + "required": [ + "deviceCfgs" + ], + "additionalProperties": true, + "properties": { + "deviceCfgs": { + "$id": "#/properties/schema/properties/deviceCfgs", + "type": "object", + "title": "The deviceCfgs schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Devices", + "type": "array", + "items": { + "title": "Device", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + } + } + ], + "required": [ + "title", + "type", + "items" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Devices" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "array" + ] + }, + "items": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items", + "type": "object", + "title": "The items schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Device", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + } + ], + "required": [ + "title", + "type", + "properties" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Device" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "object" + ] + }, + "properties": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties", + "type": "object", + "title": "The properties schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + ], + "required": [ + "type", + "ip", + "token", + "lightName", + "lightDisable" + ], + "additionalProperties": true, + "properties": { + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type", + "type": "object", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": [ + "MiPhilipsCeilingLamp" + ] + } + ] + } + ], + "required": [ + "title", + "type", + "required", + "oneOf" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Light Model" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "string" + ] + }, + "required": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/required", + "type": "boolean", + "title": "The required schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + true + ] + }, + "oneOf": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf", + "type": "array", + "title": "The oneOf schema", + "description": "An explanation about the purpose of this instance.", + "default": [], + "examples": [ + [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": [ + "MiPhilipsTableLamp2" + ] + } + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0", + "type": "object", + "title": "The first anyOf schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "MiPhilipsSmartBulb", + "enum": [ + "MiPhilipsSmartBulb" + ] + } + ], + "required": [ + "title", + "enum" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "MiPhilipsSmartBulb" + ] + }, + "enum": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum", + "type": "array", + "title": "The enum schema", + "description": "An explanation about the purpose of this instance.", + "default": [], + "examples": [ + [ + "MiPhilipsSmartBulb" + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum/items/anyOf/0", + "type": "string", + "title": "The first anyOf schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "MiPhilipsSmartBulb" + ] + } + ], + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum/items" + } + } + } + } + ], + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items" + } + } + } + }, + "ip": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip", + "type": "object", + "title": "The ip schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + } + ], + "required": [ + "title", + "type", + "required", + "format" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "IP Address" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "string" + ] + }, + "required": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/required", + "type": "boolean", + "title": "The required schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + true + ] + }, + "format": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/format", + "type": "string", + "title": "The format schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "ipv4" + ] + } + } + }, + "token": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token", + "type": "object", + "title": "The token schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Token", + "type": "string", + "required": true + } + ], + "required": [ + "title", + "type", + "required" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Token" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "string" + ] + }, + "required": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/required", + "type": "boolean", + "title": "The required schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + true + ] + } + } + }, + "lightName": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName", + "type": "object", + "title": "The lightName schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Name", + "type": "string", + "required": true + } + ], + "required": [ + "title", + "type", + "required" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Name" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "string" + ] + }, + "required": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/required", + "type": "boolean", + "title": "The required schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + true + ] + } + } + }, + "lightDisable": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable", + "type": "object", + "title": "The lightDisable schema", + "description": "An explanation about the purpose of this instance.", + "default": {}, + "examples": [ + { + "title": "Disabled", + "type": "boolean", + "default": false + } + ], + "required": [ + "title", + "type", + "default" + ], + "additionalProperties": true, + "properties": { + "title": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/title", + "type": "string", + "title": "The title schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "Disabled" + ] + }, + "type": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/type", + "type": "string", + "title": "The type schema", + "description": "An explanation about the purpose of this instance.", + "default": "", + "examples": [ + "boolean" + ] + }, + "default": { + "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/default", + "type": "boolean", + "title": "The default schema", + "description": "An explanation about the purpose of this instance.", + "default": false, + "examples": [ + false + ] + } + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file From e7a8c3757e974e4c9c74fba9f622d756e9aa3ecf Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 27 May 2020 17:08:14 +0500 Subject: [PATCH 3/6] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6a7b31..af28fef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-mi-philips-light", - "version": "0.2.3", + "version": "0.3", "description": "XiaoMi Philips light plugins for HomeBridge(https://github.com/nfarina/homebridge).", "keywords": [ "homebridge-plugin", From 22f11cb34337cfe83fd42f98716cac322fd97cea Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 27 May 2020 17:12:22 +0500 Subject: [PATCH 4/6] Add source schema. Add version details to README. --- README.md | 9 +++++++ config.schema_base.json | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 config.schema_base.json diff --git a/README.md b/README.md index bd81c0c..2c9a5f0 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,16 @@ miio --discover --sync ``` Wait until you get output. For more information about token, please refer to [OpenMiHome](https://github.com/OpenMiHome/mihome-binary-protocol) and [miio](https://github.com/aholstenson/miio). + +### Homebridge-Config-UI Support + +This plugin implements UI support for Homebridge-Config-UI. The schema for this is stored in config.schema.json. An easily-readable version is stored in config.schema_base.json, and can be converted into the JSON Schema format [here](https://www.jsonschema.net/home). + ## Version Logs +### 0.3 (2020-05-27) +1. Added IP address to logs. +2. Added Homebridge-Config-UI support. + ### 0.2.3 (2018-02-10) 1.update 'package.json'. ### 0.2.2 (2017-11-18) diff --git a/config.schema_base.json b/config.schema_base.json new file mode 100644 index 0000000..5c62e9e --- /dev/null +++ b/config.schema_base.json @@ -0,0 +1,56 @@ +{ + "pluginAlias": "MiPhilipsLightPlatform", + "pluginType": "platform", + "singular": false, + "schema": { + "deviceCfgs": { + "title": "Devices", + "type": "array", + "items": { + "title": "Device", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [{ + "title": "MiPhilipsSmartBulb", + "enum": ["MiPhilipsSmartBulb"] + }, + { + "title": "MiPhilipsTableLamp2", + "enum": ["MiPhilipsTableLamp2"] + }, + { + "title": "MiPhilipsCeilingLamp", + "enum": ["MiPhilipsCeilingLamp"] + } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false + } + } + } + } + } +} \ No newline at end of file From 66f909c61f9ebf1b77bb5fe4225378ec6dadd413 Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 27 May 2020 17:35:25 +0500 Subject: [PATCH 5/6] Incorrect version format. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af28fef..b746831 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-mi-philips-light", - "version": "0.3", + "version": "0.3.0", "description": "XiaoMi Philips light plugins for HomeBridge(https://github.com/nfarina/homebridge).", "keywords": [ "homebridge-plugin", From d84a04eadb157d4f10ca28c96dd48ebb9dd51522 Mon Sep 17 00:00:00 2001 From: Jeremy Higgs Date: Wed, 27 May 2020 17:53:52 +0500 Subject: [PATCH 6/6] Fix issues with the config UI. --- README.md | 4 - config.schema.json | 853 +++------------------------------------- config.schema_base.json | 56 --- 3 files changed, 47 insertions(+), 866 deletions(-) delete mode 100644 config.schema_base.json diff --git a/README.md b/README.md index 2c9a5f0..fa59647 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,6 @@ miio --discover --sync Wait until you get output. For more information about token, please refer to [OpenMiHome](https://github.com/OpenMiHome/mihome-binary-protocol) and [miio](https://github.com/aholstenson/miio). -### Homebridge-Config-UI Support - -This plugin implements UI support for Homebridge-Config-UI. The schema for this is stored in config.schema.json. An easily-readable version is stored in config.schema_base.json, and can be converted into the JSON Schema format [here](https://www.jsonschema.net/home). - ## Version Logs ### 0.3 (2020-05-27) 1. Added IP address to logs. diff --git a/config.schema.json b/config.schema.json index be115a3..a8b1482 100644 --- a/config.schema.json +++ b/config.schema.json @@ -1,813 +1,54 @@ { - "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://example.com/example.json", - "type": "object", - "title": "The root schema", - "description": "The root schema comprises the entire JSON document.", - "default": {}, - "examples": [ - { - "pluginAlias": "MiPhilipsLightPlatform", - "pluginType": "platform", - "singular": false, - "schema": { - "deviceCfgs": { - "title": "Devices", - "type": "array", - "items": { - "title": "Device", - "type": "object", - "properties": { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] + "pluginAlias": "MiPhilipsLightPlatform", + "pluginType": "platform", + "singular": true, + "headerDisplay": "Add individual lights below.", + "schema": { + "deviceCfgs": { + "title": "Devices", + "type": "array", + "items": { + "title": "Light Config", + "type": "object", + "properties": { + "type": { + "title": "Light Model", + "type": "string", + "required": true, + "oneOf": [{ + "title": "MiPhilipsSmartBulb", + "enum": ["MiPhilipsSmartBulb"] }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" + { + "title": "MiPhilipsTableLamp2", + "enum": ["MiPhilipsTableLamp2"] }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - } - } - } - } - ], - "required": [ - "pluginAlias", - "pluginType", - "singular", - "schema" - ], - "additionalProperties": true, - "properties": { - "pluginAlias": { - "$id": "#/properties/pluginAlias", - "type": "string", - "title": "The pluginAlias schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "MiPhilipsLightPlatform" - ] - }, - "pluginType": { - "$id": "#/properties/pluginType", - "type": "string", - "title": "The pluginType schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "platform" - ] - }, - "singular": { - "$id": "#/properties/singular", - "type": "boolean", - "title": "The singular schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - false - ] - }, - "schema": { - "$id": "#/properties/schema", - "type": "object", - "title": "The schema schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "deviceCfgs": { - "title": "Devices", - "type": "array", - "items": { - "title": "Device", - "type": "object", - "properties": { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] - }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - } - } - } - ], - "required": [ - "deviceCfgs" - ], - "additionalProperties": true, - "properties": { - "deviceCfgs": { - "$id": "#/properties/schema/properties/deviceCfgs", - "type": "object", - "title": "The deviceCfgs schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Devices", - "type": "array", - "items": { - "title": "Device", - "type": "object", - "properties": { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] - }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - } - } - ], - "required": [ - "title", - "type", - "items" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Devices" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "array" - ] - }, - "items": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items", - "type": "object", - "title": "The items schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Device", - "type": "object", - "properties": { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] - }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - } - ], - "required": [ - "title", - "type", - "properties" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Device" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "object" - ] - }, - "properties": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties", - "type": "object", - "title": "The properties schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] - }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - ], - "required": [ - "type", - "ip", - "token", - "lightName", - "lightDisable" - ], - "additionalProperties": true, - "properties": { - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type", - "type": "object", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": [ - "MiPhilipsCeilingLamp" - ] - } - ] - } - ], - "required": [ - "title", - "type", - "required", - "oneOf" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Light Model" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "string" - ] - }, - "required": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/required", - "type": "boolean", - "title": "The required schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - true - ] - }, - "oneOf": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf", - "type": "array", - "title": "The oneOf schema", - "description": "An explanation about the purpose of this instance.", - "default": [], - "examples": [ - [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": [ - "MiPhilipsTableLamp2" - ] - } - ] - ], - "additionalItems": true, - "items": { - "anyOf": [ - { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0", - "type": "object", - "title": "The first anyOf schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "MiPhilipsSmartBulb", - "enum": [ - "MiPhilipsSmartBulb" - ] - } - ], - "required": [ - "title", - "enum" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "MiPhilipsSmartBulb" - ] - }, - "enum": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum", - "type": "array", - "title": "The enum schema", - "description": "An explanation about the purpose of this instance.", - "default": [], - "examples": [ - [ - "MiPhilipsSmartBulb" - ] - ], - "additionalItems": true, - "items": { - "anyOf": [ - { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum/items/anyOf/0", - "type": "string", - "title": "The first anyOf schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "MiPhilipsSmartBulb" - ] - } - ], - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items/anyOf/0/properties/enum/items" - } - } - } - } - ], - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/type/properties/oneOf/items" - } - } - } - }, - "ip": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip", - "type": "object", - "title": "The ip schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - } - ], - "required": [ - "title", - "type", - "required", - "format" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "IP Address" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "string" - ] - }, - "required": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/required", - "type": "boolean", - "title": "The required schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - true - ] - }, - "format": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/ip/properties/format", - "type": "string", - "title": "The format schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "ipv4" - ] - } - } - }, - "token": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token", - "type": "object", - "title": "The token schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Token", - "type": "string", - "required": true - } - ], - "required": [ - "title", - "type", - "required" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Token" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "string" - ] - }, - "required": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/token/properties/required", - "type": "boolean", - "title": "The required schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - true - ] - } - } - }, - "lightName": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName", - "type": "object", - "title": "The lightName schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Name", - "type": "string", - "required": true - } - ], - "required": [ - "title", - "type", - "required" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Name" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "string" - ] - }, - "required": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightName/properties/required", - "type": "boolean", - "title": "The required schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - true - ] - } - } - }, - "lightDisable": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable", - "type": "object", - "title": "The lightDisable schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "title": "Disabled", - "type": "boolean", - "default": false - } - ], - "required": [ - "title", - "type", - "default" - ], - "additionalProperties": true, - "properties": { - "title": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/title", - "type": "string", - "title": "The title schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "Disabled" - ] - }, - "type": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "boolean" - ] - }, - "default": { - "$id": "#/properties/schema/properties/deviceCfgs/properties/items/properties/properties/properties/lightDisable/properties/default", - "type": "boolean", - "title": "The default schema", - "description": "An explanation about the purpose of this instance.", - "default": false, - "examples": [ - false - ] - } - } - } - } - } + { + "title": "MiPhilipsCeilingLamp", + "enum": ["MiPhilipsCeilingLamp"] } - } + ] + }, + "ip": { + "title": "IP Address", + "type": "string", + "required": true, + "format": "ipv4" + }, + "token": { + "title": "Token", + "type": "string", + "required": true + }, + "lightName": { + "title": "Name", + "type": "string", + "required": true + }, + "lightDisable": { + "title": "Disabled", + "type": "boolean", + "default": false } } } diff --git a/config.schema_base.json b/config.schema_base.json deleted file mode 100644 index 5c62e9e..0000000 --- a/config.schema_base.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "pluginAlias": "MiPhilipsLightPlatform", - "pluginType": "platform", - "singular": false, - "schema": { - "deviceCfgs": { - "title": "Devices", - "type": "array", - "items": { - "title": "Device", - "type": "object", - "properties": { - "type": { - "title": "Light Model", - "type": "string", - "required": true, - "oneOf": [{ - "title": "MiPhilipsSmartBulb", - "enum": ["MiPhilipsSmartBulb"] - }, - { - "title": "MiPhilipsTableLamp2", - "enum": ["MiPhilipsTableLamp2"] - }, - { - "title": "MiPhilipsCeilingLamp", - "enum": ["MiPhilipsCeilingLamp"] - } - ] - }, - "ip": { - "title": "IP Address", - "type": "string", - "required": true, - "format": "ipv4" - }, - "token": { - "title": "Token", - "type": "string", - "required": true - }, - "lightName": { - "title": "Name", - "type": "string", - "required": true - }, - "lightDisable": { - "title": "Disabled", - "type": "boolean", - "default": false - } - } - } - } - } -} \ No newline at end of file