Compare commits

...

2 commits

Author SHA1 Message Date
tyeth
3a155d50ba Add SGP30 custom properties and schema validation 2024-11-05 21:00:03 +00:00
tyeth
b5b1f3b424 Add example for feed suffix and multi light types 2024-11-05 14:46:04 +00:00
5 changed files with 128 additions and 3 deletions

View file

@ -0,0 +1,40 @@
{
"vendor": "Adafruit",
"productURL": "https://www.adafruit.com/product/3779",
"documentationURL": "https://learn.adafruit.com/adafruit-as7262-6-channel-visible-light-sensor",
"displayName": "AS7262",
"published": true,
"i2cAddresses": [ "0x49" ],
"subcomponents": [
{
"displayName": "Violet / Magenta",
"sensorType": "light",
"feedSuffix": "violet"
},
{
"displayName": "Blue",
"sensorType": "light",
"feedSuffix": "blue"
},
{
"displayName": "Green",
"sensorType": "light",
"feedSuffix": "green"
},
{
"displayName": "Yellow",
"sensorType": "light",
"feedSuffix": "yellow"
},
{
"displayName": "Orange",
"sensorType": "light",
"feedSuffix": "orange"
},
{
"displayName": "Red",
"sensorType": "light",
"feedSuffix": "red"
}
]
}

View file

@ -12,7 +12,7 @@
},
{
"displayName": "Infrared",
"sensorType": "raw"
"sensorType": "light"
}
]
}

View file

@ -12,7 +12,7 @@
},
{
"displayName": "Infrared",
"sensorType": "raw"
"sensorType": "light"
}
]
}

View file

@ -21,6 +21,12 @@
"minLength": 3,
"maxLength": 24
},
"feedSuffix": {
"description": "A unique string used to create the feed name for this sub-component, e.g.'red' suffix and type='light' would give ws-001-light-red.",
"type": "string",
"minLength": 1,
"maxLength": 24
},
"sensorType": {
"description": "One of the supported I2C sensor type strings (found in README).",
"type": "string",
@ -81,6 +87,63 @@
"description": "List of sensors on this I2C component.",
"type": "array",
"items": { "$ref": "#/$defs/subcomponent" }
},
"customProperties": {
"description": "A list of custom properties that this component supports.",
"type": "array",
"items": {
"type": "object",
"required": [ "name", "type", "description", "default", "displayed" ],
"properties": {
"name": {
"description": "The name and key of the custom property.",
"type": "string",
"minLength": 3,
"maxLength": 24
},
"type": {
"description": "The type of the custom property.",
"type": "string",
"pattern": "^(color|string|number|boolean|range|list)$"
},
"description": {
"description": "A brief description of the custom property.",
"type": "string",
"minLength": 3,
"maxLength": 255
},
"default": {
"description": "The default value of the custom property.",
"type": ["string", "number", "boolean"]
},
"displayed": {
"description": "If true, this custom property will be displayed in the UI.",
"type": "boolean"
},
"displayName": {
"description": "The human-friendly name of this custom property.",
"type": "string",
"minLength": 3,
"maxLength": 150
},
"displayOptions": {
"description": "Options or values for the custom property.",
"type": "object",
"optionalProperties": {
"min": { "type": "number" },
"max": { "type": "number" },
"step": { "type": "number" },
"values": {
"type": "array",
"items": {
"type": "object",
"required": [ "key", "displayText" ]
}
}
}
}
}
}
}
}
}

View file

@ -5,5 +5,27 @@
"documentationURL": "https://learn.adafruit.com/adafruit-sgp30-gas-tvoc-eco2-mox-sensor",
"published": true,
"i2cAddresses": [ "0x58" ],
"subcomponents": [ "eco2", "tvoc" ]
"subcomponents": [ "eco2", "tvoc" ],
"customProperties": [
{
"name": "input-temp",
"displayName": "Reference Ambient Temperature (°C)",
"type": "number",
"default": 20,
"description": "The reference ambient temperature in degrees Celsius.",
"displayed": true
},
{
"name": "input-humidity",
"displayName": "Reference Relative Humidity (%)",
"type": "number",
"default": 50,
"description": "The reference relative humidity in percent.",
"displayed": true,
"displayOptions": {
"min": 0,
"max": 100
}
}
]
}