Hi @nayelyz
I was going crazy because the label of the Custom Capabilities that are created show the name of the Capability in the detail view of the App instead of the label assigned in the capability presentation.
This began to happen in the custom capabilities created almost a year ago
As you commented in other threads on these topics, When we create a custom capability, the English (en) translation is created automatically.
And here is the problem: When the automatic translation to English is created, the name of the Capability is assigned to the label field instead of assigning it the label field of the json file of the presentation.
This is a Capability Test created:
{
"id": "legendabsolute60149.capabilityTest",
"version": 1,
"status": "proposed",
"name": "Capability Test", ### This is de name of capability created
"ephemeral": false,
"attributes": {
"capabilityTest": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setCapabilityTest",
"enumCommands": []
}
},
"commands": {
"setCapabilityTest": {
"name": "setCapabilityTest",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "integer"
}
}
]
}
}
}
This is the Capability presentation:
{
"dashboard": {
"states": [
{
"label": "{{capabilityTest}} {capabilityTest.unit}}"
}
],
"actions": []
},
"detailView": [
{
"label": "English Capability Test", #### Label assigned in presentation
"displayType": "state",
"state": {
"label": "{{capabilityTest.value}} {{capabilityTest.unit}}",
"unit": "capabilityTest.unit"
}
}
],
"automation": {
"conditions": [
{
"label": "English Capability Test",
"displayType": "numberField",
"numberField": {
"value": "capabilityTest.value",
"valueType": "integer",
"unit": "capabilityTest.unit",
"range": [
-30,
30
]
}
}
],
"actions": [
{
"label": "English Capability Test",
"displayType": "numberField",
"numberField": {
"command": "setCapabilityTest",
"argumentType": "integer",
"unit": "capabilityTest.unit",
"range": [
-30,
30
]
}
}
]
},
"id": "legendabsolute60149.capabilityTest",
"version": 1
}
This is the Automatic English Translation:
{
"tag": "en",
"label": "Capability Test", #### Label assigned is the Capability name
"attributes": {
"capabilityTest": {
"label": "capabilityTest",
"displayTemplate": "{{attribute}} of {{device.label}} is {{value}}",
"i18n": {}
}
},
"commands": {}
}
That is why by default it always shows the name of the Capability instead of the label assigned when creating the presentation.
For automations conditions and actions App label is shown fine due to no translation is performed
Solution to show the correct label:
- Create a file .json for capability english translation with data in CLI:
smartthings capabilities:translations capabilityID en -j
- Modify the translation to English file, changing the label field with the correct text:
{
"tag": "en",
"label": "English Capability Test", #### Modified label text
"attributes": {
"capabilityTest": {
"label": "capabilityTest",
"displayTemplate": "{{attribute}} of {{device.label}} is {{value}}",
"i18n": {}
}
},
"commands": {}
}
-
Update the English translation with the CLI:
smartthings capabilities:translations:update legendabsolute60149.capabilityTest 1 -i C:\Users\Mariano\Documents\Mariano\VSC\SampleDrivers\zigbee-switch-v6.5\Capabilities\translations\capabilityTest-en
-
Make some change in the driver code that uses that capability, it can be a commented text or add a blank space.
-
If the driver has some custom VID created then you have to recreate it to make it show correct.
I don’t know if it will end up updating automatically after x hours have passed -
Package, publish and install the driver
-
Clear the cache of the android App
-
The correct label will appear in the details view of the App
Now I have to modify and update all the automatic English translations of my 115 custom capabilities so that they are displayed correctly in the App.
It is a good task to celebrate May 1st!!!
I hope smartthings takes some time to make another change that will force me to change everything again