Hi everyone,
I’m working on a Custom Edge Driver for a sensor and would like to add a power switch to allow the user to turn off the sensor if not needed.
My current Custom Capability and presentation were able to update its state as I want it to be on the ST app, but I don’t know how to add a power switch on top of the “state” displayType.
Do I need to add additional Properties/Commands/Alternatives? If so, how could I do that?
Also, I have trouble displaying the Temperature unit in the detailView so if anyone can catch the bug in my code below. I would appreciate it!
I hope to get y’all assistance soon.
Thanks a lot,
-------------------------Code-------------------------------
Here is the example that I used for my Custom Capability (JSON):
{
"name": "Temperature Measurement",
"status": "live",
"attributes": {
"temperature": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "TemperatureValue",
"type": "number",
"minimum": -460,
"maximum": 10000
},
"unit": {
"title": "TemperatureUnit",
"type": "string",
"enum": [
"F",
"C"
]
}
},
"required": [
"value",
"unit"
]
}
}
},
"commands": {
},
"id": "temperatureMeasurement",
"version": 1
}
Here is my current CC presentation (JSON):
{
"dashboard": {
"states": [
{
"label": "Temp: {{temperature.value}}{{temperature.unit}}",
"alternatives": null
}
],
"actions": []
},
"detailView": [
{
"label": "Temperature",
"displayType": "state",
"state": {
"label": "Temperature: {{temperature.value}}",
"unit": "temperature.unit"
}
}
],
"id": "...",
"version": 1
}