name: Thermostat
# https://www.aliexpress.com/item/1005006020556081.html
# Electric Heating 16A version
products:
  - id: dq6nlukkifyawj9n
    manufacturer: EZAIoT
    model: R9Lite
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: auto
                value: auto
              - dps_val: manual
                value: heat
      - id: 2
        type: string
        name: mode
        hidden: true
      - id: 16
        type: integer
        name: temperature
        range:
          min: 50
          max: 500
        mapping:
          - scale: 10
            step: 5
            constraint: temperature_unit
            conditions:
              - dps_val: f
                step: 10
      - id: 19
        type: integer
        name: max_temperature
        mapping:
          - scale: 10
      - id: 23
        type: string
        name: temperature_unit
        mapping:
          - dps_val: c
            value: C
          - dps_val: f
            value: F
      - id: 24
        type: integer
        name: current_temperature
        mapping:
          - scale: 10
      - id: 26
        type: integer
        name: min_temperature
        mapping:
          - scale: 10
      - id: 101
        type: integer
        name: unknown_101
      - id: 36
        # dps id 36 (valve state) is redundant with dps id 110
        type: string
        name: valve_state
      - id: 112
        type: integer
        name: unknown_112
      - id: 102
        type: integer
        name: temperature_adjust_step
      - id: 110
        type: boolean
        name: hvac_action
        mapping:
          - dps_val: false
            value: idle
          - dps_val: true
            value: heating
      - id: 105
        type: string
        name: device_name
      - id: 108
        type: integer
        name: temperature_calibration_step
      - id: 111
        type: string
        name: version
      - id: 113
        # The dps id 113 is readonly..probably not implemented on device
        type: string
        name: temperature_sensor_type
  - entity: switch
    translation_key: anti_frost
    category: config
    dps:
      - id: 10
        type: boolean
        name: switch
  - entity: select
    translation_key: temperature_unit
    category: config
    dps:
      - id: 23
        type: string
        name: option
        mapping:
          - dps_val: c
            value: celsius
          - dps_val: f
            value: fahrenheit
  - entity: select
    name: Schedule
    category: config
    icon: "mdi:calendar-clock"
    dps:
      - id: 31
        type: string
        name: option
        mapping:
          - dps_val: "5_2"
            value: Weekday+Weekend
          - dps_val: "6_1"
            value: Mon-Sat+Sun
          - dps_val: "7"
            value: Daily
  - entity: lock
    translation_key: child_lock
    category: config
    dps:
      - id: 40
        type: boolean
        name: lock
  - entity: binary_sensor
    category: diagnostic
    class: problem
    dps:
      - id: 45
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
      - id: 45
        type: bitfield
        name: fault_code
  - entity: number
    translation_key: maximum_temperature
    category: config
    class: temperature
    dps:
      - id: 19
        type: integer
        name: value
        unit: C
        range:
          min: 50
          max: 10000
        mapping:
          - scale: 10
            step: 10
  - entity: number
    translation_key: minimum_temperature
    category: config
    class: temperature
    dps:
      - id: 26
        name: value
        type: integer
        unit: C
        range:
          min: 50
          max: 10000
        mapping:
          - scale: 10
            step: 10
  - entity: number
    translation_key: temperature_calibration
    class: temperature_delta
    category: config
    dps:
      - id: 109
        name: value
        type: integer
        unit: C
        range:
          min: -99
          max: 99
        mapping:
          - scale: 10
  - entity: sensor
    name: External temperature
    class: temperature
    category: diagnostic
    dps:
      - id: 115
        name: sensor
        type: integer
        unit: C
        mapping:
          - scale: 10
