Issue with an automation for custom capability

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.

Please see below the capability and presentation.
Any ideas would be greatly appreciated.
Yakov

Capability.yml

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

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

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.

1 Like

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

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

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.

1 Like