# Issue with an automation for custom capability

**URL:** <https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685>\
**Category:** Support\
**Created:** [May 15, 2022, 7:27am UTC](https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685 "2022-05-15T07:27:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ygerlovin](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ygerlovin/32/143020_2.png) [@ygerlovin](https://community.smartthings.com/u/ygerlovin)\
**Post date:** [May 15, 2022, 7:27am UTC](https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685/1 "2022-05-15T07:27:10Z")

</div>

Hi,

I created a custom capability and it works fine from the detailed view.  
However, I’m unable to use it in automation action, I get “Network error” when trying to save the routine.  
[![](https://global.discourse-cdn.com/smartthings/original/3X/5/0/503fabcde478e542270c08b0c36f66aaa4495b10.png) ](https://global.discourse-cdn.com/smartthings/original/3X/5/0/503fabcde478e542270c08b0c36f66aaa4495b10.png)  
Please see below the capability and presentation.  
Any ideas would be greatly appreciated.  
Yakov

Capability.yml

```auto
id: amberpiano10217.powerOnState
version: 1
name: Power On State
attributes:
  powerOnState:
    schema:
      type: object
      properties:
        value:
          type: string
          enum:
            - on
            - off
            - togge_previous
            - set_previous
      additionalProperties: false
      required:
        - value
    enumCommands: []
    setter: setSate
  supportedPowerOnStates:
    schema:
      type: object
      properties:
        value:
          type: array
          items:
            type: string
            enum:
            - on
            - off
            - togge_previous
            - set_previous
      additionalProperties: false
      required: []
    enumCommands: []
commands:
  setSate:
    name: setSate
    arguments:
      - name: value
        optional: false
        schema:
          type: string
          enum:
            - on
            - off
            - togge_previous
            - set_previous
ocfResourceType: oic.d.switch

```

Presentation.yml

```auto
dashboard:
  states:
    - label: '{{powerOnState.value}}'
      alternatives:
        - key: on
          value: Initial state ON
        - key: off
          value: Initial state OFF
        - key: togge_previous
          value: Initial state LAST
        - key: set_previous
          value: Initial state Unknown
  actions: []
  basicPlus: []
detailView:
  - label: 'PowerON State'
    displayType: list
    list:
      command:
        name: setSate
        alternatives:
          - key: on
            value: ON
          - key: off
            value: OFF
          - key: togge_previous
            value: LAST
          - key: set_previous
            value: Previous
        supportedValues: supportedPowerOnStates.value
      state:
        value: powerOnState.value
        alternatives:
          - key: on
            value: Always ON
          - key: off
            value: Always OFF
          - key: togge_previous
            value: LAST
          - key: set_previous
            value: PREV
automation:
  conditions: []
  actions: 
    - label: 'PowerON State'
      displayType: list
      list:
        alternatives:
          - key: on
            value: Initial state ON
          - key: off
            value: Initial state OFF
          - key: togge_previous
            value: Initial state LAST
          - key: set_previous
            value: Initial state PREVIOUS
        supportedValues: supportedPowerOnStates.value
id: amberpiano10217.powerOnState
version: 1

```

---

<div class="post-metadata">

**Author:** ![orangebucket](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/orangebucket/32/81590_2.png) [@orangebucket](https://community.smartthings.com/u/orangebucket)\
**Post date:** [May 15, 2022, 8:25am UTC](https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685/2 "2022-05-15T08:25:48Z")

</div>

As there is nothing in the `list` action that says which attribute you are working with it can’t possibly know what the setter command is. So I think you probably need to include a `command: setSate` to define it. Otherwise all it can do is assume your keys are also command names.

---

<div class="post-metadata">

**Author:** ![ygerlovin](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ygerlovin/32/143020_2.png) [@ygerlovin](https://community.smartthings.com/u/ygerlovin)\
**Post date:** [May 15, 2022, 9:00pm UTC](https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685/3 "2022-05-15T21:00:52Z")

</div>

@orangebucket Great, thank you very much for your help.

@nayelyz Please consider adding a command to automation.actions in “Garage Door” example.  
Thanks

> **[Capability Presentations | SmartThings Developers](https://developer-preview.smartthings.com/docs/devices/capabilities/capability-presentations/#creating-your-capability-presentation)**
>
> Looking for a detailed list of the display types used by Capability Presentations? Visit the display types reference.

---

<div class="post-metadata">

**Author:** ![nayelyz](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@nayelyz](https://community.smartthings.com/u/nayelyz)\
**Post date:** [May 16, 2022, 10:43pm UTC](https://community.smartthings.com/t/issue-with-an-automation-for-custom-capability/242685/4 "2022-05-16T22:43:29Z")

</div>

That example is a different use case.  
In that capability presentation, the list is using `enumCommands`, therefore, a setter is not needed.

_Note: Up to now, we can only use `enumCommands` in a list in the `automation.actions` view. In the detail view, it only works with a setter._

When using that kind of command in the list, the `key` is the `commandName`. So, based on that sample, the capability should have the commands “closed” and “open”.

I’ll check if we can clarify that in the doc so it’s not confusing.
