name: M027 curtain
primary_entity:
  entity: cover
  class: curtain
  dps:
    - id: 1
      name: control
      type: string
      mapping:
        - dps_val: open
          value: open
        - dps_val: close
          value: close
        - dps_val: stop
          value: stop
    - id: 2
      name: position
      type: integer
      unit: "%"
      range:
        min: 0
        max: 100
    - id: 3
      name: current_position
      type: integer
      unit: "%"
      optional: true
    - id: 7
      name: action
      type: string
      optional: true
      persist: false
      mapping:
        - dps_val: opening
          value: opening
          constraint: current_position
          conditions:
            - dps_val: 100
              value: opened
            - dps_val: null
              value: opened
        - dps_val: closing
          value: closing
          constraint: current_position
          conditions:
            - dps_val: 0
              value: closed
            - dps_val: null
              value: closed
    - id: 12
      name: fault_code
      type: bitfield
    - id: 101
      name: unknown_101
      type: boolean
secondary_entities:
  - entity: select
    name: Mode
    icon: "mdi:theme-light-dark"
    category: config
    dps:
      - id: 4
        name: option
        type: string
        mapping:
          - dps_val: morning
            value: Morning
          - dps_val: night
            value: Night
  - entity: sensor
    translation_key: time_remaining
    class: duration
    category: diagnostic
    dps:
      - id: 9
        name: sensor
        type: integer
        optional: true
        unit: s
  - entity: sensor
    name: Travel time
    icon: "mdi:hourglass"
    category: diagnostic
    dps:
      - id: 10
        name: sensor
        type: integer
        unit: ms
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 12
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
