I’m using capabilities with Schema connector, and I met problem about states.
As we know, we can use capability like below.
capability
"attributes": {
"switch": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "SwitchState",
"type": "string",
"enum": [
"on",
"off"
]
}
},
"required": [
"value"
]
}
}
}
part of StateRefresh response
"states": [{
"component": "main",
"capability": "st.switch",
"attribute": "switch",
"value": "on"
}]
And we can do like this if there are many fields under attributes
field.
capability
"attributes": {
"hue": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "PositiveNumber",
"type": "number",
"minimum": 0
}
}
}
},
"saturation": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "PositiveNumber",
"type": "number",
"minimum": 0
}
}
}
}
}
part of StateRefresh response
"states": [
{
"component": "main",
"capability": "st.colorControl",
"attribute": "hue",
"value": 0
},
{
"component": "main",
"capability": "st.colorControl",
"attribute": "saturation",
"value": 0
}
]
But what should I do if there are multiple field under properties
?
capability
"attributes": {
"coolingSetpoint": {
"schema": {
"title": "Temperature",
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "TemperatureValue",
"type": "number",
"minimum": -460,
"maximum": 10000
},
"unit": {
"title": "TemperatureUnit",
"type": "string",
"enum": [
"F",
"C"
]
},
"constraints": {
"title": "NumberConstraint",
"type": "object",
"additionalProperties": false,
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
}
},
"required": [
"value",
"unit"
]
}
}
}
I tried below form and others, but didn’t works.
"states": [
{
"component": "main",
"capability": "st.temperatureMeasurement",
"attribute": "temperature",
"value": {
"unit": "C",
"value": 10
}
}
]
I found SmartApp connector API reference, but I couldn’t find about Schema connector API.