How can I change the minimum dimmer presentation for my Edge driver from 0 to 1?

My SmartThings App presentation restricts my Aeotec Nano Dimmer dimmer range from 1 to 100%.
My SmartThings App presentation restricts my Edge driver dimmer range from 0 to 100%.
How do I get my Edge driver presented like an Aeotec Nano Dimmer in this respect?
I do not want to allow the user to ask for 0% when all that I can deliver is 1%.

Hi, @rossetyler.
To change the default range of a capability, you need to create a custom device presentation.
There, you need to add the values property like the samples below (I included two formats) in all the views you require this change:

//JSON
"component": "main",
"capability": "switchLevel",
"version": 1,
"values": [
    {
        "key": "level.value",
        "enabledValues": [],
        "range": [
            1,
            100
        ],
        "step": 1
    }
]

//YAML
- component: main
  capability: switchLevel
  version: 1
  values:
    - key: level.value
      range:
        - 1
        - 100
      step: 1

Once you create it, you need to add the generated vid and mnmn properties on the device profile metadata section:

name: profileName
components:
  - id: main
    capabilities:
      - id: switch
        version: 1
    categories:
      - name: Switch
metadata:
  vid: xxxx-xxx-xxxx
  mnmn: SmartThingsCommunity

create it

What is it?
My guess is a yaml file for dashboard, detail and automation views?
Does this go in my driver’s config.yaml?

generated vid and mnmn properties

How are these properties generated?
Can I use smartthings CLI?

Apologies for the confusion, what I meant was:

  1. First, you need to put together a device-config file (it can be in JSON or YAML format) where you include the three views (dashboard, detail, and automation). For example, this is the basic structure of the device-config file (in YAML format):
dashboard:
  states:
    //Capability value that appears below the device label
  actions:
    //Capability displayed in the upper-right corner of the device (button)
detailView:
  //Capabilities will appear in the same order in the detail view (except for switch and battery, which will be at the top and bottom respectively)
  //If it's a multi-component device, please avoid using numbers in the component's name
automation:
  conditions:
    //IF section in the Routines tool
  actions:
    //Then section in the Routines tool
type: profile

Note: You need to verify that the capabilities you select on each view have a configuration for it in their presentation.
For example, if you select the capability ThermostatMode in dashboard.states, the device won’t display anything below the device label because its capability presentation doesn’t include the dashboard view.
Use the command below to get a capability’s presentation:

smartthings capabilities:presentation capabilityId [-j or -y]
  1. Use the following CLI command to create the device presentation based on that device-config file:
smartthings presentation:device-config:create -i newPresentation.[json or yaml]
  1. As a result, the console will show you the created presentation including the properties of vid and mnmn (they are automatically generated), which you need to copy into your device profile.

Please, let me know if you have any questions

I don’t mind the existing presentation except for the dimmer minimum value.
This is what I did, for a $device_id of an existing dimmer with such presentation:

./smartthings devices:presentation -y $device_id > device-config/dimmer.yaml

In addition to what you say I need (…), it has

mnmn: SmartThingsCommunity
vid: 2c678b30-11bf-3525-9fb9-57356be530ae
version: 0.0.1
iconUrl: null

...

dpInfo:
  - os: ios
    dpUri: 'plugin://com.samsung.ios.plugin.stplugin/assets/files/index.html'
  - os: android
    dpUri: 'plugin://com.samsung.android.plugin.stplugin'
  - os: web
    dpUri: 'wwst://com.samsung.one.plugin.stplugin'
language:
  - locale: en_US
    poCodes:
      - label: Power
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT
      - label: Power
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT_ATTRIBUTES_SWITCH
      - label: 'On'
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT_ATTRIBUTES_SWITCH_ON
      - label: Turn off
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT_COMMANDS_OFF
      - label: 'Off'
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT_ATTRIBUTES_SWITCH_OFF
      - label: Turn on
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCH_DEFAULT_COMMANDS_ON
      - label: Dimmer
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT_ATTRIBUTES_LEVEL
      - label: Dimmer
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT
      - label: Refresh
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.REFRESH_DEFAULT
      - label: Refresh
        po: ___PO_CODE_CAPABILITY.SMARTTHINGS.REFRESH_DEFAULT_COMMANDS_REFRESH
manufacturerName: SmartThingsCommunity
presentationId: 2c678b30-11bf-3525-9fb9-57356be530ae

Is this a good place to start?
Do I throw everything besides … away and change 0 to 1 everywhere needed?
If not that, what?

It seems that such would replace current behavior with a modification that I have made at this static point in time.
I would rather like to make a living patch (replace 0 with 1) to augment existing and future behavior so that I can benefit from future SmartThings presentation fixes/improvements.
I don’t want to have to maintain all the gobbledygook outside my 0 to 1 patch.
Is this possible?

You don’t need those properties to create the device presentation, they are generated automatically, that’s why you get the complete information when you query a presentation used by a device.

The presentation must include all the capabilities you want to display for the device on each view. The “values” property must be included in all the detail view and automation view, which are the only ones configured in the capability presentation.

AFAIK, it’s not possible a dynamic range, but I need to confirm. The one that we’ve seen it’s dynamic is the enums of a list using the supportedValues property. If it’s possible, you would need to create a custom capability.

It is very simple, in English, to say what I want to do (it’s captured in the Subject line).
Unfortunately, it is a little(?) harder to tell it to SmartThings (it’s in this whole thread and “condensed” below).
Let’s see how hard it is to say to SmartThings …


I don’t ever want to change which capabilities are displayed.
I don’t want to change how any of them are displayed except that I want 1 to be the minimum dimmer value.
Correct me if I am wrong but …

smartthings devices:presentation -y $device_id > presentation/dimmer-devices-presentation.yaml

…, for a targeted dimmer $device_id, seems to be the way to answer which.
Unfortunately, it only answers the question right now and cannot anticipate how the question might be answered when SmartThings decides better/differently.
What happens then?
Do I need to monitor and revisit this?
Ugh!

Use this to get the structure and edit it for content.

cp presentation/dimmer{-devices-presentation,}.yaml
vi presentation/dimmer.yaml

At the trunk, remove everything but the dashboard, detailView and automation branches.
At the tips of the remaining branches, remove everything but

 - component: main
   capability: *
   version: 1

For all the capability: switchLevel tips, add

values:
  - key: level.value
    range:
      - 1
      - 100
    step: 1

All told …

dashboard:
  states:
    - component: main
      capability: switch
      version: 1
  actions:
    - component: main
      capability: switch
      version: 1
detailView:
  - component: main
    capability: switch
    version: 1
  - component: main
    capability: switchLevel
    version: 1
    values:
      - key: level.value
        range:
          - 1
          - 100
        step: 1
automation:
  conditions:
    - component: main
      capability: switch
      version: 1
    - component: main
      capability: switchLevel
      version: 1
      values:
        - key: level.value
          range:
            - 1
            - 100
          step: 1
  actions:
    - component: main
      capability: switch
      version: 1
    - component: main
      capability: switchLevel
      version: 1
      values:
        - key: level.value
          range:
            - 1
            - 100
          step: 1

Use this for creating …

smartthings presentation:device-config:create -i presentation/dimmer.yaml > presentation/dimmer-presentation-device-config.yaml

… and consuming a tiny bit that needs to be appended to the dimmer profile

(echo metadata:; head -2 presentation/dimmer-presentation-device-config.yaml | sed 's/^/  /') >> profiles/dimmer.yaml

Apparently, the vid: UUID in the dimmer profile now references a resource in the SmartThings cloud that the SmartThings App knows how to get and use.
I hope there is some garbage collection going on because I have created a lot of such resources in my flailing but am only referencing the last one.

It works!
That wasn’t too hard to say … or was it?


Now, will this statement break when the presentation that it was based on (today’s) changes tomorrow?
What needs to be done?

If you add/remove capabilities from your device profile, you must update the device presentation as well, this will give you a new VID. If you don’t, the capability won’t appear or an icon of “disconnected” will be displayed instead.

The process you mention only works when:

  • The device is installed and
  • You’re not currently using a custom device presentation.

From now on, if you use the command below, you will get the content of the current device presentation:

smartthings devices:presentation -y $device_id > presentation/dimmer-devices-presentation.yaml

Another option is using this command to generate a device-config file using the profile ID, but again, the device must have been installed at least once, and in the case of Edge drivers, the profile ID changes every time we re-install the device:

smartthings presentation:device-config:generate profileID [-j or -y] -o=device-config.[json or yaml]

Thank you for sharing your solution, this way, developers can choose which path to follow according to their needs. :+1: