[Custom capabilities] NumberField displayType doesn't show the unit

@nayelyz,

Another thing that is happening and I can’t find an explanation or if I have an error.
Units defined in a custom capability are not displayed in the app and are displayed correctly in my.smartthings.com

In App:

This is the capability:

{
    "id": "legendabsolute60149.localHourOffset",
    "version": 1,
    "status": "proposed",
    "name": "Local Hour Offset",
    "ephemeral": false,
    "attributes": {
        "localHourOffset": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": -12,
                        "maximum": 12
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "hr"
                        ],
                        "default": "hr"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setLocalHourOffset",
            "enumCommands": []
        }
    },
    "commands": {
        "setLocalHourOffset": {
            "name": "setLocalHourOffset",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer",
                        "minimum": -12,
                        "maximum": 12
                    }
                }
            ]
        }
    }
}

Capability presentation:

{
    "dashboard": {
        "states": [
            {
                "label": "{{localHourOffset.value}}"
            }
        ],
        "actions": []
    },
    "detailView": [
        {
            "label": "Local Hour to UTC Offset",    
            "displayType": "numberField",
            "numberField": {
                "value": "localHourOffset.value",   
                "valueType": "integer",
                "unit": "localHourOffset.unit",
                "command": "setLocalHourOffset",
                "argumentType": "integer",
                "range": [
                    -12,
                    12
                ]
            },
            "state": null
        }
    ],

Thanks

Update:
This happens also in the previous version of the app, if you want change this post to other thread

At a glance, it seems there are no issues with the capability configuration but when you send the capability events to the device, do you include the unit as well?

Does not include units in my driver events.
In other types of display type it is not necessary to send the unit to be displayed, as in state or slider

Sunrise Offest and Sunset Offset displayType:State shows min units

In Color Change Timer, displayType:Slider shows Sec

I will try to send Units in the event

I know, I just want to check if there’s a difference. I’ll make some tests on my side as well :smiley:

Sending the units in event function are not shown in the App either

device:emit_event(local_Hour_Offset.localHourOffset({value = command.args.value,  unit = "hr"}))
2022-06-15T18:00:16.480524685+00:00 PRINT Virtual Calendar Mc  <<< local_Hour_Offset:   2
2022-06-15T18:00:16.488408685+00:00 INFO Virtual Calendar Mc  <Device: 4e1f0a56-3ab0-4741-a97e-94b18ec34993 (Virtual Calendar Device)> emitting event: {"attribute_id":"localHourOffset","capability_id":"legendabsolute60149.localHourOffset","component_id":"main","state":{"unit":"hr","value":2}}

Hi! Just following up with this issue.
I was able to replicate the issue in another integration type so, it seems it’s related to the app’s plugin.
I already reported it so, I’ll keep you updated.

1 Like