Error in automatic translation to English in the Capability presentation label field:

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!!! :rofl: :rofl:

I hope smartthings takes some time to make another change that will force me to change everything again

2 Likes

It’s ironic the person who works the most for us, has to work even more today of all days!
Happy International Workers’ Day!

1 Like

I’m lying on the sofa trying to take a nap and I think I’m going to go on strike today! :wink:

3 Likes

Hi, @Mariano_Colmenarejo
Since this issue was reported, we asked the team about the “rules” followed to define the label of a capability and they shared what Andres posted here:

So, the title (label) will be set first to the same as the capability name, the label of the presentation will be considered if the capability has no name, but due to how we create them they will always have a name. So, based on their comments, this is expected.

I understand this modification affected all the custom capabilities, and we are truly sorry for the inconvenience. We also shared all the negative comments with the engineering team hoping this is avoided in the future.

Hi @nayelyz I didn’t expect you to work today, here we celebrate international worker’s day, not working :upside_down_face:

I remember that answer, to which I answered this and there were no more comments from the team.

In any case, there was no reference to that this would be done in the automatic English translation.
It seemed to me that he was referring to the fact that the capability’s presentation in the App showed the name of the capability if it exist or the capability presentation label if capability name did not exist.

In fact, if you now modify the automatic translation to English with the correct text, it displays perfectly. But he has an extra job that doesn’t seem to make sense to me.
I have already modified about 40 custom capabilities translations

On the other hand, only the English translation is done and shown for the details view.
In the automations condition and actions the presentation label is shown fine. I don’t know if I should say this, maybe tomorrow they mess it up too and I have to fix it :grin:

I was connected checking other things and saw your comment, and I had some time so…here we are.

Sorry, I sometimes create new capabilities to report issues and noticed that. It is indeed a little weird how it works for newly created capabilities but as I understand, the translation takes over in the case of the labels, I don’t remember what happens for elements in a list…

I’ve seen that despite the Routines tool being part of the plugin, it is handled differently, so, it might be due to that, and translations are only used in the dashboard and detail view… :thinking:

I would say that this is totally undocumented behavior.

Capabilities created a long time ago: legendabsolute60149.randomNextStep have capability name in label field of automatic translation to English, but the capability presentation label is displayed correctly in the App

An identical capability, created some time later: legendabsolute60149.randomNextStep2 the name of the capability is shown in the App. I have modified the translation to English and the label is now displayed correctly in the App

Hi @TAustin

I see in your LAN Device Monitor driver, which I am using, capabilities with the same problem as mine, the name of the capability is shown instead of the label of the presentation.

In case you are bored and want to have fun fixing the translations. :wink:

I still don’t get the thinking here, regardless of the translations.

The capability developer creates a label which could include the capability name if that is what they want.

Instead of using the label for the purpose it was intended for, it is decided to use the capability name instead, even though the developer has already clearly expressed what they wanted by creating a label.

It turns out that a number of capabilities don’t have a name anyway, so the label is used as a fallback.

So that means that developers who don’t write capabilities properly get their choice of label, and developers who do it right get ignored.

Or something like that.

2 Likes

Yes, thanks for the reminder! I’ve been slowly getting around to fixing the older drivers’ capabilities but haven’t gotten around to that one…

No problem, the driver works perfectly, which is the important thing.

I just wanted to add you to the conversation since you use a lot of custom capabilities.

1 Like

I’ve just gotten used to using {{i18n.label}} for the Detail view label and modifying the en translation (via a saved Postman request) to the desired label. Just more steps…

Updating existing devices/capabilities is the real pain. I guess you have more luck on Android, but iOS doesn’t update so easily, and I’ve found the only dependable way to make it work for everyone is to change the profile (new ID or some other change), and do an update_metadata in the driver with the new profile…which requires a driver update. Sometimes that doesn’t even work and you have to create new devices to see the change.

I don’t know how the process is for iOS, on Android clearing the cache makes things easier.

When I update a capability presentation or a translation, modifying anything in the driver code, adding a space in a commented text for example, and packaging, publishing and installing the driver is enough.

If there is a profile that uses a custom VID then I have to create it again, even if the same VID is generated it is enough.
That’s why I save with the driver all the .json of each VID.

If the capability is used in other drivers and they use VIDs I have to package, publish and install each driver and recreate the VIDs.

1 Like