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

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