Device Config for the built-in device handlers

@nayelyz Is it possible to get the device profiles and configuration by way of API or CLI for the built-in device handler types?
This is just for reference to create custom device handlers.
For example i have a device that supports fan and light. Fan with speeds 1-6 and light with rgbw.
I want to refer the device profiles & config of c2c-fan-controller-4speed and c2c-rgbw-color-bulb so that i can create a custom device profile to support both in one.

Any help would be appreciated.

Hi, @prakash_m

As the API requires us to provide a UUID, we cannot use the profile name assigned directly, so, to get that ID, you can follow the steps below:

  1. Assign the profile to a test device to get it discovered (the stateRefresh request doesn’t have to be successful)
  2. List the devices through the API to get its details (https://api.smartthings.com/v1/devices) or through the CLI smartthings devices -j)
  3. There, the device will have a property called “profile” which contains its ID inside.
  4. Then, copy that ID and get the profile’s details: smartthings deviceprofiles UUID -j

At this point, you’ll get the profile’s configuration but remember that the metadata section is the one that contains details about the view of the device. The VID (AKA device presentation) dictates how the UI of the device will look like.

To get the device-configuration to create a specific device presentation (VID), you can use this command:

smartthings presentation:device-config vid mnmn -j -o=fileName.json
--example:
smartthings presentation:device-config SmartThings-smartthings-c2c-fan-controller-4speed SmartThings -j -o=fileName.json

As your fan has 6 speeds (two more than usual), you’ll have to create a custom device presentation to add them.

"detailView": [
      {
          "component": "main",
          "capability": "fanSpeed",
          "version": 1,
          "values": [
              {
                  "key": "fanSpeed.value",
                  "range": [
                      0,6
                  ]
              }
          ],
          "patch": [
              {
                  "op": "replace",
                  "path": "/0/slider/alternatives",
                  "value": [
                      {
                          "key": "0",
                          "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                          "type": "inactive"
                      },
                      {
                          "key": "1",
                          "value": "1",
                          "type": "active"
                      },
                      {
                          "key": "2",
                          "value": "2",
                          "type": "active"
                      },
                      {
                          "key": "3",
                          "value": "3",
                          "type": "active"
                      },
                      {
                          "key": "4",
                          "value": "4",
                          "type": "active"
                      },
                      {
                          "key": "5",
                          "value": "5",
                          "type": "active"
                      },
                      {
                          "key": "6",
                          "value": "6",
                          "type": "active"
                      }
                  ]
              }
          ]
      }
  ],
  "automation": {
      "conditions": [
          {
              "component": "main",
              "capability": "fanSpeed",
              "version": 1,
              "values": [
                  {
                      "key": "fanSpeed.value",
                      "enabledValues": [
                          "0",
                          "1",
                          "2",
                          "3",
                          "4",
                          "5",
                          "6"
                      ],
                      "label": "newLabel"
                  }
              ],
              "patch": [
                  {
                      "op": "replace",
                      "path": "/0/list/alternatives",
                      "value": [
                        {
                          "key": "0",
                          "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                          "type": "inactive"
                        },
                        {
                            "key": "1",
                            "value": "1",
                            "type": "active"
                        },
                        {
                            "key": "2",
                            "value": "2",
                            "type": "active"
                        },
                        {
                            "key": "3",
                            "value": "3",
                            "type": "active"
                        },
                        {
                            "key": "4",
                            "value": "4",
                            "type": "active"
                        },
                        {
                            "key": "5",
                            "value": "5",
                            "type": "active"
                        },
                        {
                            "key": "6",
                            "value": "6",
                            "type": "active"
                        }
                      ]
                  }
              ],
              "exclusion": []
          }
      ],
      "actions": [
          {
              "component": "main",
              "capability": "fanSpeed",
              "version": 1,
              "values": [
                {
                    "key": "fanSpeed.value",
                    "enabledValues": [
                        "0",
                        "1",
                        "2",
                        "3",
                        "4",
                        "5",
                        "6"
                    ],
                    "label": "newLabel"
                }
            ],
            "patch": [
                {
                    "op": "replace",
                    "path": "/0/list/alternatives",
                    "value": [
                      {
                        "key": "0",
                        "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                        "type": "inactive"
                      },
                      {
                          "key": "1",
                          "value": "1",
                          "type": "active"
                      },
                      {
                          "key": "2",
                          "value": "2",
                          "type": "active"
                      },
                      {
                          "key": "3",
                          "value": "3",
                          "type": "active"
                      },
                      {
                          "key": "4",
                          "value": "4",
                          "type": "active"
                      },
                      {
                          "key": "5",
                          "value": "5",
                          "type": "active"
                      },
                      {
                          "key": "6",
                          "value": "6",
                          "type": "active"
                      }
                    ]
                }
            ],
              "exclusion": []
          }
      ]
  }

Note: This only affects the detail and automation view, not the device history tab. The last one shows the values based on the capability translation which we cannot modify

2 Likes