name: Air conditioner
products:
  # - id: UNKNOWN
  #   manufacturer: Fisher
  #   model: Summer
  - id: u9jjsaluqe1trtxv
    manufacturer: Daitsu
    model: DS-9KTP
  - id: fcnlevuwfd1jgkvx
    manufacturer: Tesla
    model: TT34TP21-1232IAWUV
  - id: 0v9shs7pwdjuwi9e
    manufacturer: Kogan
    model: 8.2kW split aircon
  - id: 2mixrhxp38ehekxx
    manufacturer: Kogan
    model: 2.6kW/3.5kW split aircon
  - id: hrzr8mr0mtgfwwri
    manufacturer: ComfortStar
    model: 12000 BTU mini split
entities:
  - entity: climate
    translation_only_key: aircon_extra
    dps:
      - id: 1
        name: hvac_mode
        type: boolean
        mapping:
          - dps_val: false
            value: "off"
          - dps_val: true
            constraint: mode
            conditions:
              - dps_val: auto
                value: heat_cool
              - dps_val: cold
                value: cool
              - dps_val: wind
                value: fan_only
              - dps_val: wet
                value: dry
              - dps_val: hot
                value: heat
      - id: 2
        name: temperature
        type: integer
        range:
          min: 160
          max: 310
        mapping:
          - scale: 10
            step: 5
        unit: C
      - id: 3
        name: current_temperature
        type: integer
      - id: 4
        name: mode
        type: string
      - id: 5
        name: fan_mode
        type: string
        mapping:
          - dps_val: auto
            value: auto
          - dps_val: mute
            value: quiet
          - dps_val: low
            value: low
          - dps_val: mid_low
            value: medlow
          - dps_val: mid
            value: medium
          - dps_val: mid_high
            value: medhigh
          - dps_val: high
            value: high
          - dps_val: strong
            value: strong
      - id: 18
        name: current_humidity
        type: integer
        optional: true
      - id: 110
        name: functions_available
        type: bitfield
        # Used to indicate whether this function is available.
        #   0. Whether the temperature is adjustable in dehumidification mode
        #   1. Whether the temperature is adjustable in air supply mode
        #   2. Whether the temperature is adjustable in automatic mode
        #   3. Fresh air volume mark
        #   4. Vector air supply (implemented on Set vertical direction)
        #   5. Left and right sweeping air (implemented on horizontal sweep
        #      and et horizontal mode basic options)
        #   6. Photosensitive
        #   7. Intelligent dehumidification and anti-mildew
        #   8. Humidity sensor
        #   9. Evaporator cleaning
        #   10. Save money and see it (implemented on Energy saving)
        #   11. Power statistics
        #   12. Generator mode (implemented on Generator mode)
        #   13. High temperature wind/cool wind (implemented on Hot cold wind)
        #   14. Air quality detection function (implemented on Air quality)
        #   15. Set to empty (original: humidity function)
        #   16. Set to empty (original: equipment operation saves money and
        #       visible temperature curve display)
        #   17. 8℃ heating
        #   18. Filter dirty and clogged function (implemented on Dirty filter)
        #   ??? - 19 is missing in Tuya json
        #   20. presence or absence of PM2.5 (implemented on PM25)
        #   21. temperature scale switching, 1 is Fahrenheit, 0 is Celsius
        #   22. soft wind (implemented on Sleep)
        #   23. left and right wide-angle air supply (implemented on Set
        #       horizontal direction to filter "wide" options)
      - id: 123
        name: options
        type: string
      - id: 128
        name: style
        type: string
        optional: true
        mapping:
          - dps_val: "0"
            value: wall
          - dps_val: "1"
            value: floor
      - id: 133
        name: swing_mode
        type: string
        mapping:
          - dps_val: "0"
            value: "off"
          - dps_val: "1"
            value: horizontal
            available: hswing_available
          - dps_val: "2"
            value: vertical
          - dps_val: "3"
            value: both
            available: hswing_available
      - id: 134
        name: work_time
        type: string
        optional: true
      - id: 110
        type: bitfield
        name: hswing_available
        mapping:
          - dps_val: 32
            value: true
          - value: false
  - entity: light
    translation_key: display
    category: config
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0008"
  - entity: switch
    name: Buzzer
    category: config
    icon: "mdi:volume-high"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0010"
  - entity: switch
    name: Soft wind
    category: config
    icon: "mdi:weather-windy"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "8000"
  - entity: switch
    name: Anti-mildew
    category: config
    icon: "mdi:water-off-outline"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0100"
  - entity: switch
    name: Health
    category: config
    icon: "mdi:heart-outline"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0020"
  - entity: switch
    translation_key: anti_frost
    category: config
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "1000"
  - entity: switch
    name: Eco mode
    category: config
    icon: "mdi:leaf"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0001"
  - entity: switch
    name: Self cleaning
    category: config
    icon: "mdi:spray-bottle"
    dps:
      - id: 123
        type: hex
        name: switch
        mask: "0004"
        mapping:
          - dps_val: false
            value: "Off"
          - dps_val: true
            constraint: power
            conditions:
              - dps_val: true
                invalid: true
              - dps_val: false
                value: Cleaning
      - id: 1
        name: power
        type: boolean
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 20
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 20
        name: fault_code
        type: bitfield
      - id: 122
        name: fault2
        type: bitfield
        optional: true
  - entity: sensor  # no sensor in Fisher Summer AC, returns 0
    class: pm25
    hidden: unavailable
    dps:
      - id: 101
        name: sensor
        type: integer
        optional: true
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 1048576
            value: true
          - value: false
  - entity: select
    name: Sleep
    category: config
    icon: "mdi:weather-night"
    hidden: unavailable
    dps:
      - id: 105
        name: option
        type: string
        mapping:
          - dps_val: "off"
            value: "Off"
            default: true
          - dps_val: normal
            value: Normal
          - dps_val: old
            value: Elderly
          - dps_val: child
            value: Child
        optional: true
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 4194394
            value: true
          - value: false
  - entity: select
    name: Vertical sweep
    category: config
    icon: "mdi:arrow-up-down-bold"
    dps:
      - id: 113
        name: option
        type: string
        mapping:
          - dps_val: "0"
            value: None
            default: true
          - dps_val: "1"
            value: Upper and lower
          - dps_val: "2"
            value: Upper
          - dps_val: "3"
            value: Lower
  - entity: select
    name: Horizontal sweep
    category: config
    icon: "mdi:arrow-left-right-bold"
    hidden: unavailable
    dps:
      - id: 114
        name: option
        type: string
        mapping:
          - dps_val: "0"
            value: "Off"
            default: true
          - dps_val: "1"
            value: Left and Right
          - dps_val: "2"
            value: Left
          - dps_val: "3"
            value: Middle
          - dps_val: "4"
            value: Right
          - dps_val: "5"
            value: Partial Left
          - dps_val: "6"
            value: Partial Right
          - dps_val: "7"
            value: Wide Angle
            available: wide_available
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 32
            value: true
          - value: false
      - id: 110
        type: bitfield
        name: wide_available
        mapping:
          - dps_val: 8388608
            value: true
          - value: false
  - entity: select
    name: Energy saving
    category: config
    hidden: unavailable
    dps:
      - id: 119
        name: option
        type: string
        mapping:
          - dps_val: "0"
            value: None
            default: true
          - dps_val: "1"
            value: Default Power Saving
          - dps_val: "2"
            value: Quota Power Saving
          - dps_val: "3"
            value: Fixed Temperature Power Saving
        optional: true
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 1024
            value: true
          - value: false
  - entity: select
    name: Generator mode
    category: config
    icon: "mdi:generator-stationary"
    hidden: unavailable
    dps:
      - id: 120
        name: option
        type: string
        mapping:
          - dps_val: "off"
            value: None
            default: true
          - dps_val: L1
            value: L1 (30%)
          - dps_val: L2
            value: L2 (50%)
          - dps_val: L3
            value: L3 (80%)
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 4096
            value: true
          - value: false
  - entity: sensor
    translation_key: air_quality
    class: enum
    category: diagnostic
    hidden: unavailable
    dps:
      - id: 125
        name: sensor
        type: string
        optional: true
        mapping:
          - dps_val: great
            value: excellent
          - dps_val: good
            value: good
          - dps_val: middle
            value: moderate
          - dps_val: bad
            value: poor
          - dps_val: varybad
            value: severe
      - id: 110
        name: available
        type: bitfield
        mapping:
          - dps_val: 16384
            value: true
          - value: false
  - entity: select
    name: Set vertical direction
    category: config
    icon: "mdi:unfold-more-horizontal"
    hidden: unavailable
    dps:
      - id: 126
        name: option
        type: string
        mapping:
          - dps_val: "0"
            value: Freeze Current Position
            default: true
          - dps_val: "1"
            value: Top
          - dps_val: "2"
            value: Slightly Up
          - dps_val: "3"
            value: Middle
          - dps_val: "4"
            value: Slightly Down
          - dps_val: "5"
            value: Down
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 16
            value: true
          - value: false
  - entity: select
    name: Set horizontal direction  # Tuya JSON phrasing: Freeze Horizontal
    category: config
    icon: "mdi:unfold-more-vertical"
    hidden: unavailable
    dps:
      - id: 127
        name: option
        type: string
        mapping:
          - dps_val: "0"
            value: Freeze current position
            default: true
          - dps_val: "1"
            value: Left
          - dps_val: "2"
            value: Slightly left
          - dps_val: "3"
            value: Middle
          - dps_val: "4"
            value: Slightly right
          - dps_val: "5"
            value: Right
          - dps_val: "6"
            value: Wide angle left
            available: wide_available
          - dps_val: "7"
            value: Wide angle right
            available: wide_available
          - dps_val: "8"
            value: Wide angle
            available: wide_available
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 32
            value: true
          - value: false
      - id: 110
        type: bitfield
        name: wide_available
        mapping:
          - dps_val: 8388608
            value: true
          - value: false

  - entity: select
    name: Power
    category: config
    dps:
      - id: 129
        name: option
        type: string
        mapping:
          - dps_val: 1
            value: 1 kWh
          - dps_val: 2
            value: 2 kWh
          - dps_val: 3
            value: 3 kWh
          - dps_val: 4
            value: 4 kWh
          - dps_val: 5
            value: 5 kWh
        optional: true
      - id: 115
        type: integer
        name: total_n
        optional: true
      - id: 116
        type: integer
        name: total_p
        optional: true
  - entity: number
    name: Power saving temperature
    category: config
    class: temperature
    dps:
      - id: 130
        name: value
        type: integer
        unit: C
        range:
          min: 26
          max: 31
        optional: true
  - entity: binary_sensor
    name: Dirty filter
    class: problem
    hidden: unavailable
    category: diagnostic
    icon: "mdi:air-filter"
    dps:
      - id: 131
        type: boolean
        name: sensor
        optional: true
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 262144
            value: true
          - value: false
  - entity: select
    name: Hot cold wind
    category: config
    icon: "mdi:sun-snowflake"
    dps:
      - id: 132
        name: option
        type: boolean
        optional: true
        mapping:
          - dps_val: false
            value: "Off"
          - dps_val: true
            constraint: mode
            conditions:
              - dps_val: cold
                value: Cold wind
              - dps_val: hot
                value: Hot wind
      - id: 4
        name: mode
        type: string
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 8192
            value: true
          - value: false
  - entity: sensor
    name: Running time
    class: duration
    hidden: unavailable
    dps:
      - id: 135
        name: sensor
        type: integer
        unit: min
        optional: true
        mapping:
          - scale: 0.5
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 1024
            value: true
          - value: false
  - entity: select
    name: Fresh air
    icon: "mdi:weather-windy"
    hidden: unavailable
    category: config
    dps:
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 8
            value: true
          - value: false
      - id: 102
        type: string
        optional: true
        name: option
        mapping:
          - dps_val: "auto"
            value: "Auto"
          - dps_val: "low"
            value: "Low"
          - dps_val: "mid"
            value: "Medium"
          - dps_val: "strong"
            value: "Strong"
          - dps_val: "off"
            value: "Off"
  - entity: binary_sensor
    name: Fresh air filter
    class: problem
    hidden: unavailable
    category: diagnostic
    dps:
      - id: 110
        type: bitfield
        name: available
        mapping:
          - dps_val: 8
            value: true
          - value: false
      - id: 103
        type: boolean
        optional: true
        name: sensor
