name: Ceiling fan
products:
  - id: lonfamz9k72cpjgq
    name: Keyun MKCFE002
primary_entity:
  entity: fan
  translation_only_key: fan_with_presets
  dps:
    - id: 60
      type: boolean
      name: switch
    - id: 61
      type: string
      name: preset_mode
      mapping:
        - dps_val: fresh
          value: fresh
        - dps_val: nature
          value: nature
    - id: 62
      type: integer
      name: speed
      range:
        min: 1
        max: 100
    - id: 63
      type: string
      name: direction
    - id: 106
      type: boolean
      name: oscillate
secondary_entities:
  - entity: light
    dps:
      - id: 20
        type: boolean
        name: switch
      - id: 21
        name: color_mode
        type: string
        mapping:
          - dps_val: white
            value: color_temp
          - dps_val: colour
            value: hs
          - dps_val: scene
            value: Scene
          - dps_val: music
            value: Music
      - id: 22
        name: brightness
        type: integer
        range:
          min: 10
          max: 1000
      - id: 23
        name: color_temp
        type: integer
        range:
          min: 0
          max: 1000
        mapping:
          - target_range:
              min: 3000
              max: 6000
      - id: 24
        name: rgbhsv
        type: hex
        format:
          - name: h
            bytes: 2
            range:
              min: 0
              max: 360
          - name: s
            bytes: 2
            range:
              min: 0
              max: 1000
          - name: v
            bytes: 2
            range:
              min: 0
              max: 1000
      - id: 25
        type: hex
        name: scene_data
      - id: 28
        type: string
        optional: true
        name: control_data
      - id: 33
        type: string
        optional: true
        name: power_memory
      - id: 35
        type: string
        optional: true
        name: switch_gradient
      - id: 51
        type: string
        optional: true
        name: mix_rgbcw
      - id: 121
        type: string
        optional: true
        name: music_data
  - entity: switch
    name: Do not disturb
    category: config
    dps:
      - id: 34
        type: boolean
        name: switch
  - entity: sensor
    name: Fan timer
    class: duration
    category: diagnostic
    dps:
      - id: 64
        type: integer
        name: sensor
        unit: min
  - entity: switch
    name: Beep
    icon: "mdi:volume-high"
    category: config
    dps:
      - id: 103
        type: boolean
        name: switch
  - entity: light
    name: White
    category: config
    dps:
      - id: 107
        type: boolean
        name: switch
  - entity: light
    name: Color
    category: config
    dps:
      - id: 108
        type: boolean
        name: switch
  - entity: number
    translation_key: timer
    category: config
    dps:
      - id: 112
        type: integer
        name: value
        optional: true
        unit: min
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 60
            step: 60
  - entity: switch
    name: Main switch
    category: config
    dps:
      - id: 119
        type: boolean
        name: switch
