Hi, @aruna_t
I retested the implementation and customization of this capability, and it is now possible to define your own modes.
To support your ["White","Blue","Aqua","Lightshow"]
modes (at least at API-level), you’ll need to patch the Device Configuration that has been prepared for your device profile. So, do the following through the ST CLI:
-
Extract the current device config:
st presentation:device-config:generate \
<DEVICE_PROFILE_ID> --json --output config,json
-
Open the output file and from the detailView
array, replace the reference of the capability Mode with the following:
{
"component": "main",
"capability": "mode",
"version": 1,
"values": [
{
"key": "mode.value",
"enabledValues": ["default", "x"]
}
],
"patch": [
{
"op": "add",
"path": "/0/alternatives",
"value": {
"key": "default",
"value": "Default Mode"
}
},
{
"op": "add",
"path": "/0/alternatives",
"value": {
"key": "x",
"value": "X Mode"
}
}
]
}
What it does is just to include those two alternatives as part of the configuration of the capability itself (and its presentation). Of course, you can add any key-value you need.
-
Then push the patch into the server:
st presentation:device-config:create --input config.json
Now, its time to update the device profile:
-
Get your device profile config:
st deviceprofiles <DEVICE_PROFILE_ID> --json --output profile.json
-
From the device-config:create
command, copy the vid and mnmn values and update the metadata section of your device profile, e.g.:
"metadata": {
"deviceType": "Light",
"vid": "< VID_FROM_OUTPUT >",
"mnmn": "< MNMN_FROM_OUTPUT >",
"ocfDeviceType": "oic.d.light",
"deviceTypeId": "Light",
"ocfSpecVer": "core 1.1.0"
}
-
Push the update:
st deviceprofile:update <DEVICE_PROFILE_ID> --input profile.json
Now, the next time you create a new device with that metadata reference, check its status via:
st devices:status <DEVICE_ID> --json
and you’ll find the references.
As soon as I have more news regarding the rendering of this implementation, I’ll share them at this post.