[SOLVED][Presentation] Can I allow user to set `thermostatHeatingSetpoint` as float in detailview?

2023-02-22 UPDATE: fix broken link


As see below image, step is fixed as 1. (more correctly, it seems to set as null in capability presentation)


I want to let user can set temperature with 0.5 interval.



!!SOLVED!!

I left how did I do for someone like me.

I’m developing Smart Schema Connector, so this article may not work with other integrations.

Get profile id what you want to edit

If you want to edit already published device profile, you can not edit that. (not sure)

Clone exist one, and modify that.

$ st deviceprofiles
β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ #  β”‚ Name                   β”‚ Status      β”‚ Id                                   β”‚
β”œβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ...β”‚ ...                    β”‚ ...         β”‚ ...                                  β”‚
β”‚ 13 β”‚ HCM-300                β”‚ DEVELOPMENT β”‚ 344dd0f5-f5c8-49f8-bdfd-b8ee8e481e49 β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Obtain exist device configuration and edit that

Check docs and APIs what you sould edit.

I’m not sure about contents of values. Get help from community and ST.

$ st presentation:device-config:generate <profile id> -j -o old_device-config.json
{
	...
    "detailView": [
        ...
        {
            "component": "main",
            "capability": "thermostatHeatingSetpoint",
            "version": 1,
-           "values": []
+           "values": [
+               {
+                   "key": "heatingSetpoint.value",
+                   "enabledValues": [],
+                   "range": [
+                       0,
+                       32
+                   ],
+                   "step": 0.5
+               }
+           ],
            "patch": []
        }
    ],
    ...
}

Note - updated at 2022-01-12
If you want the device profile you made to have a action in the dashboard, check the dashboard area.
The action on dashboard which set on the workspace page may not have been applied.
Not sure, but in my case, I set switch at the page, but generated one does not have that.
So I add that.

{
    "dashboard": {
        "states": [
            {
                "component": "main",
-               "capability": "healthCheck",
+               "capability": "switch",
                "version": 1,
-               "values": []
+               "idx": 0,
+               "group": "main",
+               "composite": false
            }
        ],
        "actions": [
            {
                "component": "main",
-               "capability": "healthCheck",
+               "capability": "switch",
+               "idx": 0,
+               "group": "main",
                "version": 1
            }
        ]
    },
...

Create new device configuration

$ st presentation:device-config:create -i old_device-config.json -o new_device-config.json

At here, memo new vid and mnmn.

$ cat new_device-config.json | grep -e vid -e mnmn
    "mnmn": "SmartThingsCommunity",
    "vid": "2c31302f-ffa0-3ea4-a2d1-d0e89ef1374a",

Check new presentation was modified as you want.

$ st presentation 2c31302f-ffa0-3ea4-a2d1-d0e89ef1374a -j -o new_presentation.json
{
    "mnmn": "SmartThingsCommunity",
    "vid": "2c31302f-ffa0-3ea4-a2d1-d0e89ef1374a",
    "version": "0.0.1",
    "iconUrl": null,
    "detailView": [
        ...
        {
            "capability": "thermostatHeatingSetpoint",
            "version": 1,
            "label": "___PO_CODE_CAPABILITY.SMARTTHINGS.THERMOSTATHEATINGSETPOINT_DEFAULT",
            "displayType": "slider",
            "slider": {
                "range": [
                    0,
                    32
                ],
                "step": 0.5,
                "unit": "heatingSetpoint.unit",
                "command": "setHeatingSetpoint",
                "argumentType": "number",
                "value": "heatingSetpoint.value",
                "valueType": "number"
            },
            "state": null,
            "component": "main"
        }
    ],
    "manufacturerName": "SmartThingsCommunity",
    "presentationId": "2c31302f-ffa0-3ea4-a2d1-d0e89ef1374a"
}

You can see that range and step changed.

Download and edit device profile

Download device profile and edit vid and mnmn, which given previous step.

$ st deviceprofiles 344dd0f5-f5c8-49f8-bdfd-b8ee8e481e49 -j -o old_device-profile.json
{
    ...
    "metadata": {
-       "vid": "HCM-300",
+       "vid": "2c31302f-ffa0-3ea4-a2d1-d0e89ef1374a",
        "deviceType": "Thermostat",
-       "mnmn": "0Ar2",
+       "mnmn": "SmartThingsCommunity",
        "ocfDeviceType": "oic.d.thermostat",
        "deviceTypeId": "Thermostat",
        "ocfSpecVer": "core 1.1.0",
        "mnid": "0Ar2",
        "mnId": "0Ar2"
    },
    ...
}

Update device profile

$ st deviceprofiles:update 344dd0f5-f5c8-49f8-bdfd-b8ee8e481e49 -i old_device-profile.json -j -o new_device-profile.json

Check device profile

Now you can see that deviceprofiles changed.

$ st deviceprofiles:view 344dd0f5-f5c8-49f8-bdfd-b8ee8e481e49 -j
{
    ...
    "view": {
        ...
        "detailView": [
            ...
            {
                "capability": "thermostatHeatingSetpoint",
                "values": [
                    {
                        "key": "heatingSetpoint.value",
                        "enabledValues": [],
                        "range": [
                            0,
                            32
                        ],
                        "step": 0.5
                    }
                ],
                "patch": []
            }
        ]
    }
}

Finish

Now you can test on actual app.

3 Likes

@nayelyz could it be that this is broken in the ST App somehow? I’ve tried several ways: profile, presentation, profile + presentation and currently just in the presentation. I can only change in 1.0 steps …

my profile thermostatSetpoint Cap (currently it is blank without β€œconfig”):

name: thermostat
components:
- id: main
  capabilities:
  - id: thermostatHeatingSetpoint
    version: 1
    config:
      values:
        - key: "heatingSetpoint.value"
          range: [ 5, 35 ]
          step: 0.5

and in its presentation:

{
    "dashboard": {
        "states": [],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "component": "main",
            "capability": "thermostatHeatingSetpoint",
            "version": 1,
            "values": [
                {
                    "key": "heatingSetpoint.value",
                    "enabledValues": [],
                    "range": [
                        5,
                        35
                    ],
                    "step": 0.5
                }
            ],
            "patch": []
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "thermostatHeatingSetpoint",
                "version": 1,
                "values": [
                    {
                        "key": "heatingSetpoint.value",
                        "enabledValues": [],
                        "range": [
                            5,
                            35
                        ],
                        "step": 0.5
                    }
                ],
                "patch": [],
                "exclusion": []
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "thermostatHeatingSetpoint",
                "version": 1,
                "values": [
                    {
                        "key": "heatingSetpoint.value",
                        "enabledValues": [],
                        "range": [
                            5,
                            35
                        ],
                        "step": 0.5
                    }
                ],
                "patch": [],
                "exclusion": []
            }
        ]
    },
    "type": "profile"
}

I’ve also cleaned the App cache, restarted the App, the Phone and also the Hub serveral times. Also after one or two days no change …

Thanks in advance.

Hi, @ronie_pilot
I haven’t seen reports about this not working so, let’s check first everything is correct.

First, the embedded device configurations don’t support all properties yet, which is this case:

  1. In the case of the presentation. Have you verified it was saved correctly?
    I mean that after you create the device presentation using the command smartthings presentation:device-config:create, you need to use the command smartthings presentation VID to verify the change was applied.
  2. If you change the device profile’s configuration after installing the device, the VID might not be updated for the profile.
    I mean, you need to have these properties in your profile’s YAML:
metadata:
  mnmn: SmartThingsCommunity
  vid: xxx-xxx-xxx

So, you need to make sure that once the device is installed, the VID/presentationID used by it matches the value you set in the YAML file.
That can be done with the command smartthings devices deviceID -j or -y

Unfortunately, I’m not able to check this now. I’m pretty sure that I’ve updated it correctly, each time if I change the presentation I’ve also updated the profile with the changed vid.

After that I’ve checked it with:

smartthings device-profiles:view 561d00b2-b7ea-4d23-ba70-34c6516900f1 -y

and there the presentation looks correct :person_shrugging:

Ok, so, I made a test using only the VID assigned to the profile which is c47d11a4-f23f-3c6c-a618-1c81afedb05c and the change works correctly as shown below:

I checked the device profile 561d00b2-b7ea-4d23-ba70-34c6516900f1 and noticed two things:

  1. Its status is β€œdevelopment” which indicates you created it directly and it doesn’t belong to an Edge driver, right?
    Currently, embedded configurations are supported only on profiles created by an Edge driver.
  2. Did you use the command device-profiles:view:create for it? If so, please avoid using that one because its functionality isn’t reliable and there are plans to substitute that for embedded configurations but there’s no ETA for them to work with explicitly created profiles.
    Here I shared the steps to create correctly a device profile with its device presentation manually:
    Device Profile created from the CLI is incomplete - #10 by nayelyz

Note: In a device profile where embedded configurations are supported, you cannot use both (VID and embedded configurations). I confirmed with the team that won’t work because when we use embedded configurations a new presentation will be created, so the value in the β€œmetadata” property will be ignored.

1 Like

Thank you for the feedback. I’ll check it tomorrow :slight_smile:

1 Like

You are indeed right. It seems that it got screwed up somehow. The device got the wrong presentation and not the one it was supposed to get.

I removed all the configurations from my profile.yml, deleted the uploaded profile, created a new profile from that YML, created a customized presentation, assigned it, and it worked as expected. Thank you.

It seems I missed the point of how the configuration in the profile comes about (through cli generated). I thought that came now with the last big API update and have been following other drivers. You just do not stop learning :wink:

1 Like