name: Thermostat switch
products:
  - id: B0eP8qYAdpUo4yR9
    name: Inkbird ITC-308
primary_entity:
  entity: climate
  dps:
    - id: 12
      type: bitfield
      name: error
      mapping:
        - dps_val: 0
          value: OK
    - id: 101
      type: string
      name: temperature_unit
    - id: 104
      type: integer
      name: current_temperature
      mapping:
        - scale: 10
          constraint: temperature_unit
          conditions:
            - dps_val: F
              value_redirect: current_temperature_f
    - id: 106
      type: integer
      name: temperature
      range:
        min: -500
        max: 999
      mapping:
        - scale: 10
          constraint: temperature_unit
          conditions:
            - dps_val: F
              range:
                min: -580
                max: 2100
    - id: 111
      type: boolean
      name: high_temp_alarm
      hidden: true
      mapping:
        - dps_val: true
          icon: "mdi:thermometer-alert"
          icon_priority: 1
    - id: 112
      type: boolean
      name: low_temp_alarm
      hidden: true
      mapping:
        - dps_val: true
          icon: "mdi:snowflake-alert"
          icon_priority: 2
    - id: 113
      type: boolean
      name: sensor_fault_alarm
      hidden: true
      mapping:
        - dps_val: true
          icon: "mdi:thermometer-alert"
          icon_priority: 3
    - id: 115
      type: string
      name: hvac_action
      mapping:
        - dps_val: "0"
          icon: "mdi:thermometer-off"
          icon_priority: 5
          value: idle
        - dps_val: "1"
          icon: "mdi:snowflake"
          icon_priority: 5
          value: cooling
        - dps_val: "2"
          icon: "mdi:thermometer-off"
          icon_priority: 5
          value: idle
        - dps_val: "3"
          icon: "mdi:fire"
          icon_priority: 6
          value: heating
    - id: 116
      type: integer
      name: current_temperature_f
      mapping:
        - scale: 10
      hidden: true
secondary_entities:
  - entity: number
    category: config
    name: Calibration offset
    icon: "mdi:arrow-collapse-up"
    dps:
      - id: 102
        name: value
        type: integer
        range:
          min: -99
          max: 99
        mapping:
          - scale: 10
            constraint: unit
            conditions:
              - dps_val: F
                range:
                  min: -150
                  max: 150
  - entity: number
    name: Compressor delay
    icon: "mdi:clock"
    category: config
    dps:
      - id: 108
        type: integer
        name: value
        unit: min
        range:
          min: 0
          max: 10
  - entity: number
    name: High temperature limit
    category: config
    class: temperature
    icon: "mdi:thermometer-alert"
    dps:
      - id: 109
        name: value
        type: integer
        range:
          min: -500
          max: 999
        mapping:
          - scale: 10
            constraint: unit
            conditions:
              - dps_val: F
                range:
                  min: -500
                  max: 2100
      - id: 101
        name: unit
        type: string
        hidden: true
  - entity: number
    name: Low temperature limit
    icon: "mdi:snowflake-alert"
    category: config
    class: temperature
    dps:
      - id: 110
        name: value
        type: integer
        range:
          min: -500
          max: 999
        mapping:
          - scale: 10
            constraint: unit
            conditions:
              - dps_val: F
                range:
                  min: -500
                  max: 2100
      - id: 101
        name: unit
        type: string
        hidden: true
  - entity: select
    category: config
    translation_key: temperature_unit
    dps:
      - id: 101
        name: option
        type: string
        mapping:
          - dps_val: C
            value: celsius
          - dps_val: F
            value: fahrenheit
  - entity: binary_sensor
    class: heat
    category: diagnostic
    name: High temperature
    dps:
      - id: 111
        type: boolean
        name: sensor
  - entity: binary_sensor
    class: cold
    category: diagnostic
    name: Low temperature
    dps:
      - id: 112
        type: boolean
        name: sensor
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 12
        name: sensor
        type: bitfield
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: binary_sensor
    class: problem
    category: diagnostic
    name: Sensor fault
    icon: "mdi:thermometer-alert"
    dps:
      - id: 113
        type: boolean
        name: sensor
  - entity: number
    category: config
    name: Heating hysteresis
    icon: "mdi:thermometer-chevron-up"
    dps:
      - id: 117
        name: value
        type: integer
        range:
          min: 3
          max: 150
        mapping:
          - scale: 10
            constraint: unit
            conditions:
              - dps_val: F
                range:
                  min: 10
                  max: 300
      - id: 101
        name: unit
        type: string
        hidden: true
  - entity: number
    category: config
    name: Cooling hysteresis
    icon: "mdi:thermometer-chevron-down"
    dps:
      - id: 118
        name: value
        type: integer
        range:
          min: 3
          max: 150
        mapping:
          - scale: 10
            constraint: unit
            conditions:
              - dps_val: F
                range:
                  min: 10
                  max: 300
      - id: 101
        name: unit
        type: string
        hidden: true
