name: Air conditioner
products:
  - id: q1z0isgflmccqzpz
    manufacturer: Beltax
    model: Air Condition-A011_D2
entities:
  - entity: climate
    dps:
      - id: 1
        type: boolean
        name: hvac_mode
        mapping:
          - dps_val: false
            value: "off"
          - dps_val: true
            constraint: mode
            conditions:
              - dps_val: Cool
                value: cool
              - dps_val: Heat
                value: heat
                available: heat_supported
              - dps_val: Fan
                value: fan_only
              - dps_val: Dyr  # Tuya model says "Dyr", but app/UI may show "Dry"
                value: dry

      - id: 2
        type: integer
        name: temperature
        range:
          min: 16
          max: 32
        mapping:
          - constraint: temperature_unit
            conditions:
              - dps_val: f
                value_redirect: temperature_f
                range:
                  min: 61
                  max: 90

      - id: 3
        type: integer
        name: current_temperature
        mapping:
          - constraint: temperature_unit
            conditions:
              - dps_val: f
                value_redirect: current_temperature_f

      - id: 4
        type: string
        name: mode
        hidden: true

      - id: 5
        type: string
        name: fan_mode
        mapping:
          - dps_val: Low
            value: low
          - dps_val: High
            value: high

      - id: 19
        type: string
        name: temperature_unit
        # Device sends "c"/"f"; integration expects "C"/"F" for unit_from_ascii
        mapping:
          - dps_val: c
            value: "C"
          - dps_val: f
            value: "F"

      - id: 23
        type: integer
        name: temperature_f
        hidden: true
        range:
          min: 61
          max: 90
        optional: true

      - id: 24
        type: integer
        name: current_temperature_f
        hidden: true
        optional: true

      - id: 103
        type: string
        name: heat_supported
        hidden: true
        mapping:
          - dps_val: C_H
            value: true
          - value: false

      - id: 101
        type: boolean
        name: preset_mode
        mapping:
          - dps_val: true
            value: sleep
          - dps_val: false
            value: comfort

  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 22
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 22
        type: bitfield
        name: fault_code
