name: Solar garden light
products:
  - id: bt1raf68
    name: Smart Ape solar garden light
primary_entity:
  entity: light
  dps:
    - id: 1
      name: switch
      type: boolean
    - id: 2
      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: 3
      name: brightness
      type: integer
      range:
        min: 10
        max: 1000
      mapping:
        - constraint: standby
          conditions:
            - dps_val: true
              value_redirect: standby_brightness
    - id: 4
      name: color_temp
      type: integer
      range:
        min: 0
        max: 1000
      mapping:
        - target_range:
            min: 2700
            max: 6500
    - id: 5
      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: 6
      name: scene_data
      type: hex
    - id: 8
      name: music_data
      type: hex
      optional: true
    - id: 59
      name: standby_brightness
      type: integer
      optional: true
      range:
        min: 0
        max: 1000
      hidden: true
    - id: 61
      name: standby
      type: boolean
      hidden: true
      optional: true
secondary_entities:
  - entity: number
    translation_key: timer
    category: config
    dps:
      - id: 7
        type: integer
        name: value
        unit: min
        range:
          min: 0
          max: 86400
        mapping:
          - scale: 60
            step: 60
  - entity: select
    name: Device mode
    icon: "mdi:lightbulb-auto"
    category: config
    dps:
      - id: 51
        type: string
        name: option
        mapping:
          - dps_val: auto
            value: Auto
          - dps_val: manual
            value: Manual
  - entity: event
    class: motion
    category: diagnostic
    dps:
      - id: 52
        type: string
        name: event
        optional: true
        mapping:
          - dps_val: pir
            value: detected
          - dps_val: none
            value: clear
          - value: null
  - entity: select
    name: Daylight cutoff
    icon: "mdi:contrast-box"
    category: config
    dps:
      - id: 53
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: "2000lux"
            value: "Shade"
          - dps_val: "300lux"
            value: "Light Cloud"
          - dps_val: "50lux"
            value: "Dark Cloud"
          - dps_val: "10lux"
            value: "Sunset"
          - dps_val: "5lux"
            value: "Twilight"
  - entity: select
    name: PIR sensitivity
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 54
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: low
            value: Low
          - dps_val: middle
            value: Medium
          - dps_val: high
            value: High
  - entity: number
    name: PIR delay
    icon: "mdi:camera-timer"
    category: config
    dps:
      - id: 55
        type: integer
        name: value
        optional: true
        range:
          min: 5
          max: 3600
        unit: s
  - entity: switch
    name: Motion detection
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 56
        type: boolean
        name: switch
  - entity: number
    name: Standby time
    category: config
    icon: "mdi:camera-timer"
    dps:
      - id: 58
        type: integer
        name: value
        unit: min
        optional: true
        range:
          min: 1
          max: 480
  - entity: switch
    name: Group sync
    category: config
    dps:
      - id: 60
        type: boolean
        name: switch
  - entity: switch
    name: Standby
    icon: "mdi:power-standby"
    category: config
    dps:
      - id: 61
        type: boolean
        name: switch
        optional: true
        mapping:
          - dps_val: null
            value: false
  - entity: sensor
    class: battery
    category: diagnostic
    dps:
      - id: 62
        type: string
        name: sensor
        unit: "%"
        mapping:
          - dps_val: low
            value: 20
          - dps_val: middle
            value: 50
          - dps_val: high
            value: 80
