Edge driver device-config creation

Looking to change the color temperature slider in my driver to reflect correct values for a particular bulb. Hopefully I am going in the right direction, below are the steps I have taken so far.

smartthings devices:presentation ID

Using the Presentation ID from generated info above to get the device-config file.

smartthings presentation:device-config PresentationID -j -o=outputfilename.json

Noticed the mnmn, VID and version at the top and presentationID and manufacturerName at the bottom of the file. Do I use an exact duplicate of this file with required changes, or should those lines be left out?

Once the file is modified, will this be my next step?

smartthings presentation:device-config:create -i=inputfilename.json

From here I should get the VID for use in the profile.yaml file?

For consistency, I recommend you to remove these references and store the new configuration right away, i.e.:

> smartthings presentation:device-config:create --json \
--input inputfilename.json \
--output new_config_file.json

That’s right!, vid / presentationId and mnmn / manufacturerName

Thank you @erickv. Working well except for automation actions, this still shows 1-30k. Believe I read in another post this was a known issue.

That’s right, @roadDOG, so, to raise the priority of the current report a bit, I included this thread as a reference and hopefully, this issue will be addressed soon.


UPDATE

Hey, I just received the update that attribute ranges for automation.action can be redefined as follows:

"automation": {
        "actions": [
            {
                "component": "main",
                "capability": "colorTemperature",
                "version": 1,
                "values": [
                    {
                        "key": "setColorTemperature",
                        "range": [5, 100]
                    }
                ]
            }
        ]
        ...
1 Like

Where’s the documentation for exactly how the device-config file is modified? For example, can I surgically remove specific capabilities from a view or automation?

Can you give an example of what would you like to modify?

You can find documentation about the device-configuration here and the API reference (presentations > create a device-config)

I have a device that’s a mixture of standard and custom capabilities. I basically want the core functionality of the standard capabilities with a reinterpreted display using custom capabilities.

Here’s my current device-config:

BEFORE

type: profile
iconUrl: null
dashboard:
  states:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      idx: 0
      group: main
      values: []
      composite: false
  actions:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      idx: 0
      group: main
  basicPlus: []
detailView:
  - component: main
    capability: dictionaryorigin49938.fanDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.livingDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.kitchenDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.diningDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.bathOff113
    version: 1
    values: []
    patch: []
  - component: main
    capability: switch
    version: 1
    values: []
    patch: []
  - component: main
    capability: switchLevel
    version: 1
    values: []
    patch: []
automation:
  conditions:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.livingDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.kitchenDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.diningDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switch
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switchLevel
      version: 1
      values: []
      patch: []
      exclusion: []
  actions:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.livingDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.kitchenDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.diningDimmer113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: dictionaryorigin49938.bathOff113
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switch
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switchLevel
      version: 1
      values: []
      patch: []
      exclusion: []

What I really want is something like:

AFTER

type: profile
iconUrl: null
dashboard:
  states:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      idx: 0
      group: main
      values: []
      composite: false
  actions:
    - component: main
      capability: dictionaryorigin49938.fanDimmer113
      version: 1
      idx: 0
      group: main
  basicPlus: []
detailView:
  - component: main
    capability: dictionaryorigin49938.fanDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.livingDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.kitchenDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.diningDimmer113
    version: 1
    values: []
    patch: []
  - component: main
    capability: dictionaryorigin49938.bathOff113
    version: 1
    values: []
    patch: []
automation:
  conditions:
    - component: main
      capability: switch
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switchLevel
      version: 1
      values: []
      patch: []
      exclusion: []
  actions:
    - component: main
      capability: switch
      version: 1
      values: []
      patch: []
      exclusion: []
    - component: main
      capability: switchLevel
      version: 1
      values: []
      patch: []
      exclusion: [] 

It should function as a standard dimmer switch, but display in the app wearing a disguise. I’ve considered using 100% custom capabilities (with custom presentations), but it’s not clear if ST to Google/Alexa integration would still be possible.

Yes, it is possible.

A device UI is ruled by two things, in the case of Edge drivers:

  • Device profile
    Here you need to define which capabilities will the device use (they can be separated into components or in a single one but remember that Google/Alexa integrations don’t recognize yet the other components, only “main”)
  • Device-configuration (AKA device presentation)
    • This is where you define how the capabilities will be displayed in the ST app (order, available enums, range).
    • It is not mandatory to include all the capabilities in each view. You can even omit a capability so it is only used in the backend.
    • If you use here a capability that is not in the device profile, it will appear with a “disconnected” symbol

I commented on your other post about this, if using those integrations is a must, then, you should avoid custom capabilities.

I didn’t realize it was that easy to create the device-config. I thought it had to be some mysterious, elaborate ‘patch’.

I took my AFTER version and simply associated it with the device profile:

name: 'test'
components:
- id: main
  capabilities:
  - id: dictionaryorigin49938.fanDimmer113
    version: 1
  - id: dictionaryorigin49938.livingDimmer113
    version: 1
  - id: dictionaryorigin49938.kitchenDimmer113
    version: 1
  - id: dictionaryorigin49938.diningDimmer113
    version: 1
  - id: dictionaryorigin49938.bathOff113
    version: 1
  - id: switch
    version: 1
  - id: switchLevel
    version: 1
  categories:
  - name: Fan
metadata:
  mnmn: SmartThingsCommunity
  vid: 4cb1d4bb-4c12-3a35-a4e2-bb9fc670e2f4

Exactly what I wanted. The standard capabilities are now usable with automations, but hidden from display. The opposite with the custom capabilities. It’s a built-in virtual switch that doesn’t add to your device count.

Here’s where I’ve been successful so far:

  1. Show/hide capabilities in dashboard and detailView without any internal configuration changes
  2. Modify the label and alternatives in dashboard
  3. Modify the label, range and alternatives for fanSpeed in detailView

Here’s where I still have trouble. I have a custom capability with 2 attributes-- mode and filter. mode is displayed as a list with supportedValues: filter.value. The filter works as expected. When I apply my device-config, the dashboard changes, but the detailView is unchanged. When I smartthings presentation:device-config:create, the correct details scroll up the screen. However, if I go back and examine the vid, the changes to detailView are missing. Is this even supposed to work?

My goal is to create multiple devices with different list contents. I could just create unique custom capabilities and custom presentations. That means I have to manage more IDs. I could also have a single custom capability with all possible list contents and use the filter. That’s also messy. If I can use config-device to alter the list contents, then it becomes a one-time configuration issue with no code changes.

Here are my yaml files. The files are intentionally sparse. I don’t think more quotes or empty/default values are going to change anything. I’ve used generic content so that I can easily see if the device-config has been applied.

profile

name: scope
components:
- id: main
  capabilities:
  - id: dictionaryorigin49938.modeFilterPush129
    version: 1
  categories:
  - name: Fan    
metadata:
  mnmn: SmartThingsCommunity
  vid: e98944f2-170d-3260-b295-f73e2c08d31b

capability

name: mode filter push 129
attributes:
  mode:
    setter: setMode
    schema:
      type: object
      additionalProperties: false
      properties:
        value:
          type: integer
          default: 0
  filter:
    schema:
      type: object
      additionalProperties: false
      properties:
        value:
          type: array
          items:
            enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
commands:
  setMode:
    name: setMode
    arguments:
      - name: value
        optional: false
        schema:
          type: integer
  nextMode:
    name: nextMode
    arguments: []

presentation

id: dictionaryorigin49938.filterStatusPush129
dashboard:
  states:
    - label: dashboard
  actions:
    - displayType: pushButton
      pushButton:
        command: nextMode
detailView:
  - label: detailView
    displayType: list
    list:
      command:
        name: setMode
        argumentType: integer
        supportedValues: filter.value
        alternatives:
          - key: 0
            value: 0
          - key: 1
            value: 1
          - key: 2
            value: 2
          - key: 3
            value: 3
          - key: 4
            value: 4
          - key: 5
            value: 5
          - key: 6
            value: 6
          - key: 7
            value: 7
          - key: 8
            value: 8
          - key: 9
            value: 9
      state:
        value: mode.value
        valueType: integer
        alternatives:
          - key: 0
            value: 0
          - key: 1
            value: 1
          - key: 2
            value: 2
          - key: 3
            value: 3
          - key: 4
            value: 4
          - key: 5
            value: 5
          - key: 6
            value: 6
          - key: 7
            value: 7
          - key: 8
            value: 8
          - key: 9
            value: 9

device-config

type: profile
dashboard:
  states:
    - component: main
      capability: dictionaryorigin49938.modeFilterPush129
      version: 1
      values:
        - key: mode
          label: '{{mode.value}}'
          alternatives:
            - key: 0
              value: Off
              type: inactive
            - key: 1
              value: Fast
            - key: 2
              value: Medium
            - key: 3
              value: Slow
  actions:
    - component: main
      capability: dictionaryorigin49938.modeFilterPush129
      version: 1
detailView:
  - component: main
    capability: dictionaryorigin49938.modeFilterPush129
    version: 1
    values:
      - key: mode
        label: Speed
        alternatives:
          - key: 0
            value: Off
          - key: 1
            value: Dim
          - key: 2
            value: On
          - key: 3
            value: Bright