name: Fan with light
# products:
#   - id: UNKNOWN
#     manufacturer: Prestige
#     model: M3
entities:
  - entity: fan
    translation_only_key: fan_with_presets
    dps:
      - id: 1
        type: boolean
        name: switch
      - id: 2
        type: string
        name: preset_mode
        mapping:
          - dps_val: nature
            value: nature
          - dps_val: sleep
            value: sleep
          - dps_val: fresh
            value: fresh
          - dps_val: smart
            value: smart
          - dps_val: custom
            value: custom
      - id: 3
        type: integer
        name: speed
        range:
          min: 1
          max: 6
      - id: 8
        type: string
        name: direction
      - id: 101
        type: integer
        optional: true
        name: model_number
      - id: 102
        type: integer
        optional: true
        name: device_num
      - id: 103
        type: integer
        optional: true
        name: version
  - entity: light
    dps:
      - id: 15
        type: boolean
        name: switch
      - id: 16
        name: brightness
        type: integer
        range:
          min: 1
          max: 100
      - id: 17
        type: integer
        optional: true
        name: color_temp
        range:
          min: 0
          max: 100
        mapping:
          - target_range:
              min: 3000
              max: 6500
          - dps_val: null
            value_redirect: fixed_color_temp
      - id: 19
        type: string
        name: fixed_color_temp
        mapping:
          - dps_val: night
            value: 3000
          - dps_val: warm
            value: 4000
          - dps_val: white
            value: 5000
          - dps_val: cold
            value: 6500
  - entity: select
    name: Fixed color temperature
    icon: "mdi:lightbulb"
    category: config
    dps:
      - id: 19
        type: string
        name: option
        mapping:
          - dps_val: night
            value: Night
          - dps_val: warm
            value: Warm white
          - dps_val: white
            value: Daylight
          - dps_val: cold
            value: Cold white
  - entity: sensor
    class: temperature
    dps:
      - id: 21
        type: integer
        name: sensor
        unit: C
        class: measurement
  - entity: select
    translation_key: timer
    category: config
    dps:
      - id: 22
        type: string
        name: option
        mapping:
          - dps_val: cancel
            value: cancel
          - dps_val: "1h"
            value: "1h"
          - dps_val: "2h"
            value: "2h"
          - dps_val: "3h"
            value: "3h"
          - dps_val: "4h"
            value: "4h"
          - dps_val: "5h"
            value: "5h"
          - dps_val: "6h"
            value: "6h"
          - dps_val: "7h"
            value: "7h"
          - dps_val: "8h"
            value: "8h"
          - dps_val: "9h"
            value: "9h"
          - dps_val: "10h"
            value: "10h"
          - dps_val: "11h"
            value: "11h"
          - dps_val: "12h"
            value: "12h"
  - entity: binary_sensor
    class: problem
    category: diagnostic
    dps:
      - id: 24
        type: bitfield
        optional: true
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - dps_val: null
            value: false
          - value: true
      - id: 24
        type: bitfield
        optional: true
        name: fault_code
