Skip to content

Commit

Permalink
Update config schema
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5e committed Dec 12, 2022
1 parent dd7946e commit fb4aabb
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

- [ ] I've read the [Readme - Troubleshooting](https://github.com/0x5e/homebridge-tuya-platform#troubleshooting) section.
- [ ] I've read the [Readme - FAQ](https://github.com/0x5e/homebridge-tuya-platform#faq) and [Readme - Troubleshooting](https://github.com/0x5e/homebridge-tuya-platform#troubleshooting) section.

**Describe the bug**
A clear and concise description of what the bug is.
Expand Down
2 changes: 1 addition & 1 deletion ADVANCED_OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- `options.deviceOverrides[].schema` - **optional**: An array of schema overriding config objects. When your device have non-standard schemas, this is used for transform them.
- `options.deviceOverrides[].schema[].oldCode` - **required**: Original Schema code.
- `options.deviceOverrides[].schema[].newCode` - **required**: New Schema code.
- `options.deviceOverrides[].schema[].code` - **required**: New Schema code.
- `options.deviceOverrides[].schema[].type` - **optional**: New schema type. One of the `Boolean`, `Integer`, `Enum`, `String`, `Json`, `Raw`.
- `options.deviceOverrides[].schema[].property` - **optional**: New schema property object. For `Integer` type, the object should contains `min`, `max`, `scale`, `step`; For `Enum` type, the object should contains `range`. For detail information, please see `TuyaDeviceSchemaProperty` in [TuyaDevice.ts](./src/device/TuyaDevice.ts).
- `options.deviceOverrides[].schema[].onGet` - **optional**: An one-line JavaScript code convert old value to new value. The function is called with one argument: `value`.
Expand Down
91 changes: 70 additions & 21 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,37 +101,86 @@
"type": "object",
"properties": {
"id": {
"name": "ID",
"title": "ID",
"description": "Device ID or Product ID or `global`",
"type": "string",
"required": true
},
"category": {
"name": "Category",
"title": "Category",
"description": "Category Code or `hidden`",
"type": "string"
},
"schema": {
"name": "Schema Overriding Configs",
"title": "Schema Overriding Configs",
"type": "array",
"properties": {
"oldCode": {
"title": "Original Schema Code",
"type": "string",
"required": true
},
"code": {
"title": "New Schema Code",
"type": "string",
"required": true
},
"type": {
"title": "New Schema Type",
"type": "string"
},
"property": {
"title": "New Schema Property",
"type": "object"
"items": {
"type": "object",
"properties": {
"oldCode": {
"title": "Original Schema Code",
"type": "string",
"required": true
},
"code": {
"title": "New Schema Code",
"type": "string",
"required": true
},
"type": {
"title": "New Schema Type",
"type": "string",
"default": "Boolean",
"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 Schema 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"
}
}
}
}
}
}
}
Expand Down

0 comments on commit fb4aabb

Please sign in to comment.