name: Motion Sensor Light
products:
  - id: oapo5mmfbcr2y7ox
    name: Deta 360 Motion Sensor
  - id: 8mrw54ape8opgl69
    name: Deta Light Motion Sensor
  - id: pxyhz90upglpoedu
    name: Arlec MAL315HA
primary_entity:
  entity: light
  dps:
    - id: 101
      type: string
      name: effect
      mapping:
        - dps_val: mode_off
          value: "off"
        - dps_val: mode_auto
          value: auto
        - dps_val: mode_on
          value: "on"
    - id: 102
      type: boolean
      name: switch
      readonly: true
secondary_entities:
  - entity: switch
    name: Auto mode
    icon: "mdi:motion-sensor"
    dps:
      - id: 101
        type: string
        name: switch
        mapping:
          - dps_val: mode_auto
            value: true
          - dps_val: mode_on
            constraint: relay
            conditions:
              - dps_val: true
                value: false
          - dps_val: mode_off
            constraint: relay
            conditions:
              - dps_val: false
                value: false
      - id: 102
        name: relay
        type: boolean
        readonly: true
        hidden: true
  - entity: number
    name: Sensitivity
    icon: "mdi:human-greeting-proximity"
    category: config
    dps:
      - id: 103
        type: integer
        name: value
        range:
          min: 0
          max: 4
        mapping:
          - invert: true
  - entity: number
    name: Duration
    icon: "mdi:camera-timer"
    category: config
    dps:
      - id: 104
        type: integer
        name: value
        unit: s
        range:
          min: 10
          max: 900
        mapping:
          - step: 10
  - entity: number
    name: Light level
    icon: "mdi:theme-light-dark"
    category: config
    class: illuminance
    dps:
      - id: 105
        type: integer
        name: value
        unit: lx
        range:
          min: 0
          max: 3900
        mapping:
          - invert: true
  - entity: switch
    name: Auto reset
    category: config
    dps:
      - id: 106
        type: boolean
        name: switch
