name: Dehumidifier
products:
  - id: 6ny5ejcir57trwao
    manufacturer: Stadler Form
    model: Lukas

entities:
  # Main control
  - entity: humidifier
    class: dehumidifier
    translation_only_key: extended
    dps:
      - id: 1
        type: boolean
        name: switch

      - id: 5
        name: mode
        type: string
        mapping:
          - dps_val: "DRY"
            value: normal
          - dps_val: "LAUNDRY"
            value: laundry

      - id: 3
        name: humidity
        type: integer
        range:
          min: 25
          max: 80
        mapping:
          - step: 5

      - id: 6
        type: integer
        name: current_humidity

  # Fan speed (1–4)
  - entity: fan
    dps:
      - id: 1
        type: boolean
        name: switch
      - id: 4
        type: string
        name: speed
        mapping:
          - dps_val: "1"
            value: 25"
          - dps_val: "2"
            value: 50
          - dps_val: "3"
            value: 75
          - dps_val: "4"
            value: 100
      - id: 8
        type: boolean
        name: oscillate

  # Night mode
  - entity: switch
    translation_key: sleep
    dps:
      - id: 14
        type: boolean
        name: switch

  # Child lock
  - entity: lock
    translation_key: child_lock
    dps:
      - id: 16
        type: boolean
        name: lock

  # Error bitfield
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 19
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - dps_val: 2
            value: false
          - dps_val: 4
            value: false
          - value: true
      - id: 19
        type: bitfield
        name: fault_code

  # Tank full
  - entity: binary_sensor
    translation_key: tank_full
    dps:
      - id: 19
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 2
            value: true
          - value: false

  # Defrost mode
  - entity: binary_sensor
    translation_key: defrost
    dps:
      - id: 19
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 4
            value: true
          - value: false
