From f52e2a07c31abb8a7023b403df364855e102e940 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Mon, 17 Apr 2023 17:57:39 -0500 Subject: [PATCH 1/4] Update config.schema.json --- config.schema.json | 241 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 206 insertions(+), 35 deletions(-) diff --git a/config.schema.json b/config.schema.json index 835476d8..f1587995 100644 --- a/config.schema.json +++ b/config.schema.json @@ -4,12 +4,8 @@ "singular": true, "headerDisplay": "", "footerDisplay": "", + "customUi": false, "schema": { - "name": { - "type": "string", - "title": "Name", - "default": "Tuya" - }, "type": "object", "properties": { "options": { @@ -21,13 +17,20 @@ "title": "Project Type (Development Method)", "type": "string", "default": "2", - "oneOf": [{ - "title": "Custom", - "enum": ["1"] - }, { - "title": "Smart Home", - "enum": ["2"] - }], + "oneOf": [ + { + "title": "Custom", + "enum": [ + "1" + ] + }, + { + "title": "Smart Home", + "enum": [ + "2" + ] + } + ], "required": true }, "endpoint": { @@ -71,13 +74,18 @@ "title": "App", "type": "string", "default": "tuyaSmart", - "oneOf": [{ + "oneOf": [ + { "title": "Tuya Smart", - "enum": ["tuyaSmart"] + "enum": [ + "tuyaSmart" + ] }, { "title": "Smart Life", - "enum": ["smartlife"] + "enum": [ + "smartlife" + ] } ], "condition": { @@ -131,25 +139,45 @@ "type": { "title": "New DP Type", "type": "string", - "oneOf": [{ - "title": "Boolean", - "enum": ["Boolean"] - }, { - "title": "Integer", - "enum": ["Integer"] - }, { - "title": "Enum", - "enum": ["Enum"] - }, { - "title": "String", - "enum": ["String"] - }, { - "title": "Json", - "enum": ["Json"] - }, { - "title": "Raw", - "enum": ["Raw"] - }] + "default": "", + "oneOf": [ + { + "title": "Boolean", + "enum": [ + "Boolean" + ] + }, + { + "title": "Integer", + "enum": [ + "Integer" + ] + }, + { + "title": "Enum", + "enum": [ + "Enum" + ] + }, + { + "title": "String", + "enum": [ + "String" + ] + }, + { + "title": "Json", + "enum": [ + "Json" + ] + }, + { + "title": "Raw", + "enum": [ + "Raw" + ] + } + ] }, "property": { "title": "New DP Property", @@ -194,5 +222,148 @@ } } } - } + }, + "layout": [ + { + "type": "fieldset", + "title": "Tuya Account Info", + "expandable": true, + "expanded": false, + "items": [ + "options.projectType", + "options.appSchema", + "options.accessId", + "options.accessKey", + "options.countryCode", + "options.username", + "options.password", + "options.appSchema" + ] + }, + { + "type": "fieldset", + "title": "Tuya Home Settings", + "expandable": true, + "expanded": false, + "notitle": false, + "items": [ + { + "key": "options.homeWhitelist", + "add": "Add Another Home ID", + "title": "{{ 'New Whitelisted Home' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "flex-direction": "row", + "notitle": true, + "title": "{{ value }}", + "items": [ + { + "key": "options.homeWhitelist[]", + "placeholder": "Home ID" + } + ] + } + ] + } + ] + }, + { + "type": "fieldset", + "title": "Tuya Device Settings", + "expandable": true, + "expanded": true, + "notitle": false, + "items": [ + { + "key": "options.deviceOverrides", + "add": "Add Another Device Override", + "title": "{{ 'New Device Override' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": false, + "flex-direction": "row", + "notitle": true, + "title": "{{ value.id }}", + "items": [ + { + "key": "options.deviceOverrides[].id" + }, + { + "key": "options.deviceOverrides[].category" + }, + { + "key": "options.deviceOverrides[].schema", + "add": "Add New Schema", + "title": "{{ 'New Schema' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "title": "{{ value.code + ' --> ' + value.newCode }}", + "flex-direction": "column", + "notitle": false, + "items": [ + { + "key": "options.deviceOverrides[].schema[].code" + }, + { + "key": "options.deviceOverrides[].schema[].newCode" + }, + { + "key": "options.deviceOverrides[].schema[].type" + }, + { + "key": "options.deviceOverrides[].schema[].property", + "items": [ + "options.deviceOverrides[].schema[].property.min", + "options.deviceOverrides[].schema[].property.max", + "options.deviceOverrides[].schema[].property.scale", + "options.deviceOverrides[].schema[].property.step", + { + "key": "options.deviceOverrides[].schema[].property.range", + "add": "Add Range", + "title": "{{ 'New Range' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "flex-direction": "row", + "notitle": true, + "title": "{{ value }}", + "items": [ + { + "key": "options.deviceOverrides[].schema[].property.range[]", + "placeholder": "Range" + } + ] + } + ] + } + ] + }, + { + "key": "options.deviceOverrides[].schema[].hidden" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] } From d8944f791d9d32072863fc402d59478b4409b337 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Mon, 17 Apr 2023 18:07:02 -0500 Subject: [PATCH 2/4] Update config.schema.json --- config.schema.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config.schema.json b/config.schema.json index f1587995..1a51763f 100644 --- a/config.schema.json +++ b/config.schema.json @@ -308,10 +308,13 @@ { "type": "div", "displayFlex": true, - "title": "{{ value.code + ' --> ' + value.newCode }}", + "title": "{{ value.hidden || value.code + ' --> ' + value.newCode }}", "flex-direction": "column", "notitle": false, "items": [ + { + "key": "options.deviceOverrides[].schema[].hidden" + }, { "key": "options.deviceOverrides[].schema[].code" }, @@ -351,9 +354,6 @@ ] } ] - }, - { - "key": "options.deviceOverrides[].schema[].hidden" } ] } From 68cade1816f684aa4eaf0f9dd96f2afc569c6ff3 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Mon, 17 Apr 2023 18:51:14 -0500 Subject: [PATCH 3/4] Update config.schema.json --- config.schema.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/config.schema.json b/config.schema.json index 1a51763f..3b4b2bab 100644 --- a/config.schema.json +++ b/config.schema.json @@ -6,6 +6,11 @@ "footerDisplay": "", "customUi": false, "schema": { + "name": { + "type": "string", + "title": "Name", + "default": "Tuya" + }, "type": "object", "properties": { "options": { @@ -308,19 +313,19 @@ { "type": "div", "displayFlex": true, - "title": "{{ value.hidden || value.code + ' --> ' + value.newCode }}", + "title": "{{ value.code }}", "flex-direction": "column", "notitle": false, "items": [ - { - "key": "options.deviceOverrides[].schema[].hidden" - }, { "key": "options.deviceOverrides[].schema[].code" }, { "key": "options.deviceOverrides[].schema[].newCode" }, + { + "key": "options.deviceOverrides[].schema[].hidden" + }, { "key": "options.deviceOverrides[].schema[].type" }, From 2e8104d7310f41be2d4a6b09e51c7ebb59d3a72b Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Tue, 18 Apr 2023 13:29:52 -0500 Subject: [PATCH 4/4] Update config.schema.json --- config.schema.json | 753 +++++++++++++++++++++++---------------------- 1 file changed, 381 insertions(+), 372 deletions(-) diff --git a/config.schema.json b/config.schema.json index 3b4b2bab..ba194cad 100644 --- a/config.schema.json +++ b/config.schema.json @@ -1,374 +1,383 @@ { - "pluginAlias": "TuyaPlatform", - "pluginType": "platform", - "singular": true, - "headerDisplay": "", - "footerDisplay": "", - "customUi": false, - "schema": { - "name": { - "type": "string", - "title": "Name", - "default": "Tuya" - }, - "type": "object", - "properties": { - "options": { - "title": "Project Info", - "type": "object", - "required": true, - "properties": { - "projectType": { - "title": "Project Type (Development Method)", - "type": "string", - "default": "2", - "oneOf": [ - { - "title": "Custom", - "enum": [ - "1" - ] - }, - { - "title": "Smart Home", - "enum": [ - "2" - ] - } - ], - "required": true - }, - "endpoint": { - "title": "Endpoint URL", - "type": "string", - "format": "url" - }, - "accessId": { - "title": "Access ID", - "type": "string", - "required": true - }, - "accessKey": { - "title": "Access Secret", - "type": "string", - "required": true - }, - "countryCode": { - "title": "Country Code", - "type": "integer", - "minimum": 1, - "condition": { - "functionBody": "return model.options.projectType === '2';" - } - }, - "username": { - "title": "Username", - "type": "string", - "condition": { - "functionBody": "return model.options.projectType === '2';" - } - }, - "password": { - "title": "Password", - "type": "string", - "condition": { - "functionBody": "return model.options.projectType === '2';" - } - }, - "appSchema": { - "title": "App", - "type": "string", - "default": "tuyaSmart", - "oneOf": [ - { - "title": "Tuya Smart", - "enum": [ - "tuyaSmart" - ] - }, - { - "title": "Smart Life", - "enum": [ - "smartlife" - ] - } - ], - "condition": { - "functionBody": "return model.options.projectType === '2';" - } - }, - "homeWhitelist": { - "title": "Whitelisted Home IDs", - "description": "An optional list of Home IDs to match. If blank, all homes are matched.", - "type": "array", - "items": { - "title": "Home ID", - "type": "integer" - }, - "condition": { - "functionBody": "return model.options.projectType === '2';" - } - }, - "deviceOverrides": { - "title": "Device Overriding Configs", - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "title": "ID", - "description": "Device ID or Product ID or `global`", - "type": "string", - "required": true - }, - "category": { - "title": "Category", - "description": "Category Code or `hidden`", - "type": "string" - }, - "schema": { - "title": "Schema Overriding Configs", - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "title": "DP Code", - "type": "string", - "required": true - }, - "newCode": { - "title": "New DP Code", - "type": "string" - }, - "type": { - "title": "New DP Type", - "type": "string", - "default": "", - "oneOf": [ - { - "title": "Boolean", - "enum": [ - "Boolean" - ] - }, - { - "title": "Integer", - "enum": [ - "Integer" - ] - }, - { - "title": "Enum", - "enum": [ - "Enum" - ] - }, - { - "title": "String", - "enum": [ - "String" - ] - }, - { - "title": "Json", - "enum": [ - "Json" - ] - }, - { - "title": "Raw", - "enum": [ - "Raw" - ] - } - ] - }, - "property": { - "title": "New DP Property", - "type": "object", - "properties": { - "min": { - "title": "min", - "type": "integer" - }, - "max": { - "title": "max", - "type": "integer" - }, - "scale": { - "title": "scale", - "type": "integer" - }, - "step": { - "title": "step", - "type": "integer" - }, - "range": { - "title": "range", - "type": "array", - "items": { - "title": "value", - "type": "string" - } - } - } - }, - "hidden": { - "title": "Hidden", - "type": "boolean" - } - } - } - } - } - } - } - } - } - } - }, - "layout": [ - { - "type": "fieldset", - "title": "Tuya Account Info", - "expandable": true, - "expanded": false, - "items": [ - "options.projectType", - "options.appSchema", - "options.accessId", - "options.accessKey", - "options.countryCode", - "options.username", - "options.password", - "options.appSchema" - ] - }, - { - "type": "fieldset", - "title": "Tuya Home Settings", - "expandable": true, - "expanded": false, - "notitle": false, - "items": [ - { - "key": "options.homeWhitelist", - "add": "Add Another Home ID", - "title": "{{ 'New Whitelisted Home' }}", - "type": "tabarray", - "notitle": true, - "items": [ - { - "type": "div", - "displayFlex": true, - "flex-direction": "row", - "notitle": true, - "title": "{{ value }}", - "items": [ - { - "key": "options.homeWhitelist[]", - "placeholder": "Home ID" - } - ] - } - ] - } - ] - }, - { - "type": "fieldset", - "title": "Tuya Device Settings", - "expandable": true, - "expanded": true, - "notitle": false, - "items": [ - { - "key": "options.deviceOverrides", - "add": "Add Another Device Override", - "title": "{{ 'New Device Override' }}", - "type": "tabarray", - "notitle": true, - "items": [ - { - "type": "div", - "displayFlex": false, - "flex-direction": "row", - "notitle": true, - "title": "{{ value.id }}", - "items": [ - { - "key": "options.deviceOverrides[].id" - }, - { - "key": "options.deviceOverrides[].category" - }, - { - "key": "options.deviceOverrides[].schema", - "add": "Add New Schema", - "title": "{{ 'New Schema' }}", - "type": "tabarray", - "notitle": true, - "items": [ - { - "type": "div", - "displayFlex": true, - "title": "{{ value.code }}", - "flex-direction": "column", - "notitle": false, - "items": [ - { - "key": "options.deviceOverrides[].schema[].code" - }, - { - "key": "options.deviceOverrides[].schema[].newCode" - }, - { - "key": "options.deviceOverrides[].schema[].hidden" - }, - { - "key": "options.deviceOverrides[].schema[].type" - }, - { - "key": "options.deviceOverrides[].schema[].property", - "items": [ - "options.deviceOverrides[].schema[].property.min", - "options.deviceOverrides[].schema[].property.max", - "options.deviceOverrides[].schema[].property.scale", - "options.deviceOverrides[].schema[].property.step", - { - "key": "options.deviceOverrides[].schema[].property.range", - "add": "Add Range", - "title": "{{ 'New Range' }}", - "type": "tabarray", - "notitle": true, - "items": [ - { - "type": "div", - "displayFlex": true, - "flex-direction": "row", - "notitle": true, - "title": "{{ value }}", - "items": [ - { - "key": "options.deviceOverrides[].schema[].property.range[]", - "placeholder": "Range" - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] + "pluginAlias": "TuyaPlatform", + "pluginType": "platform", + "singular": true, + "headerDisplay": "", + "footerDisplay": "", + "customUi": false, + "schema": { + "name": { + "type": "string", + "title": "Name", + "required": true, + "default": "Tuya" + }, + "type": "object", + "properties": { + "options": { + "title": "Project Info", + "type": "object", + "required": true, + "properties": { + "projectType": { + "title": "Project Type (Development Method)", + "type": "string", + "default": "2", + "oneOf": [ + { + "title": "Custom", + "enum": [ + "1" + ] + }, + { + "title": "Smart Home", + "enum": [ + "2" + ] + } + ], + "required": true + }, + "endpoint": { + "title": "Endpoint URL", + "type": "string", + "format": "url" + }, + "accessId": { + "title": "Access ID", + "type": "string", + "required": true + }, + "accessKey": { + "title": "Access Secret", + "type": "string", + "required": true + }, + "countryCode": { + "title": "Country Code", + "type": "integer", + "minimum": 1, + "condition": { + "functionBody": "return model.options.projectType === '2';" + } + }, + "username": { + "title": "Username", + "type": "string", + "condition": { + "functionBody": "return model.options.projectType === '2';" + } + }, + "password": { + "title": "Password", + "type": "string", + "condition": { + "functionBody": "return model.options.projectType === '2';" + } + }, + "appSchema": { + "title": "App", + "type": "string", + "default": "tuyaSmart", + "oneOf": [ + { + "title": "Tuya Smart", + "enum": [ + "tuyaSmart" + ] + }, + { + "title": "Smart Life", + "enum": [ + "smartlife" + ] + } + ], + "condition": { + "functionBody": "return model.options.projectType === '2';" + } + }, + "homeWhitelist": { + "title": "Whitelisted Home IDs", + "description": "An optional list of Home IDs to match. If blank, all homes are matched.", + "type": "array", + "items": { + "title": "Home ID", + "type": "integer" + }, + "condition": { + "functionBody": "return model.options.projectType === '2';" + } + }, + "deviceOverrides": { + "title": "Device Overriding Configs", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "title": "ID", + "description": "Device ID or Product ID or `global`", + "type": "string", + "required": true + }, + "category": { + "title": "Category", + "description": "Category Code or `hidden`", + "type": "string" + }, + "unbridged": { + "title": "Unbridge", + "description": "Would you like to make this device be an external device?", + "type": "boolean" + }, + "schema": { + "title": "Schema Overriding Configs", + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "title": "DP Code", + "type": "string", + "required": true + }, + "newCode": { + "title": "New DP Code", + "type": "string" + }, + "type": { + "title": "New DP Type", + "type": "string", + "default": "", + "oneOf": [ + { + "title": "Boolean", + "enum": [ + "Boolean" + ] + }, + { + "title": "Integer", + "enum": [ + "Integer" + ] + }, + { + "title": "Enum", + "enum": [ + "Enum" + ] + }, + { + "title": "String", + "enum": [ + "String" + ] + }, + { + "title": "Json", + "enum": [ + "Json" + ] + }, + { + "title": "Raw", + "enum": [ + "Raw" + ] + } + ] + }, + "property": { + "title": "New DP Property", + "type": "object", + "properties": { + "min": { + "title": "min", + "type": "integer" + }, + "max": { + "title": "max", + "type": "integer" + }, + "scale": { + "title": "scale", + "type": "integer" + }, + "step": { + "title": "step", + "type": "integer" + }, + "range": { + "title": "range", + "type": "array", + "items": { + "title": "value", + "type": "string" + } + } + } + }, + "hidden": { + "title": "Hidden", + "type": "boolean" + } + } + } + } + } + } + } + } + } + } + }, + "layout": [ + { + "type": "fieldset", + "title": "Tuya Account Info", + "expandable": true, + "expanded": false, + "items": [ + "options.projectType", + "options.appSchema", + "options.accessId", + "options.accessKey", + "options.countryCode", + "options.username", + "options.password", + "options.appSchema" + ] + }, + { + "type": "fieldset", + "title": "Tuya Home Settings", + "expandable": true, + "expanded": false, + "notitle": false, + "items": [ + { + "key": "options.homeWhitelist", + "add": "Add Another Home ID", + "title": "{{ 'New Whitelisted Home' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "flex-direction": "row", + "notitle": true, + "title": "{{ value }}", + "items": [ + { + "key": "options.homeWhitelist[]", + "placeholder": "Home ID" + } + ] + } + ] + } + ] + }, + { + "type": "fieldset", + "title": "Tuya Device Settings", + "expandable": true, + "expanded": true, + "notitle": false, + "items": [ + { + "key": "options.deviceOverrides", + "add": "Add Another Device Override", + "title": "{{ 'New Device Override' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": false, + "flex-direction": "row", + "notitle": true, + "title": "{{ value.id }}", + "items": [ + { + "key": "options.deviceOverrides[].id" + }, + { + "key": "options.deviceOverrides[].category" + }, + { + "key": "options.deviceOverrides[].unbridged" + }, + { + "key": "options.deviceOverrides[].schema", + "add": "Add New Schema", + "title": "{{ 'New Schema' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "title": "{{ value.code }}", + "flex-direction": "column", + "notitle": false, + "items": [ + { + "key": "options.deviceOverrides[].schema[].code" + }, + { + "key": "options.deviceOverrides[].schema[].newCode" + }, + { + "key": "options.deviceOverrides[].schema[].hidden" + }, + { + "key": "options.deviceOverrides[].schema[].type" + }, + { + "key": "options.deviceOverrides[].schema[].property", + "items": [ + "options.deviceOverrides[].schema[].property.min", + "options.deviceOverrides[].schema[].property.max", + "options.deviceOverrides[].schema[].property.scale", + "options.deviceOverrides[].schema[].property.step", + { + "key": "options.deviceOverrides[].schema[].property.range", + "add": "Add Range", + "title": "{{ 'New Range' }}", + "type": "tabarray", + "notitle": true, + "items": [ + { + "type": "div", + "displayFlex": true, + "flex-direction": "row", + "notitle": true, + "title": "{{ value }}", + "items": [ + { + "key": "options.deviceOverrides[].schema[].property.range[]", + "placeholder": "Range" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] }