{
  "schema": "devcap1.schema.json",
  "manufacturername": "aqara",
  "modelid": "lumi.motion.ac01",
  "vendor": "Xiaomi",
  "product": "Aqara FP1 Human Presence Sensor RTCZCGQ11LM",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_PRESENCE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0406"
      ],
      "fingerprint": {
        "endpoint": "0x01",
        "profile": "0x0104",
        "device": "0xfff0",
        "in": [
          "0x0000",
          "0x0003",
          "0xFCC0"
        ],
        "out": [
          "0x000A",
          "0x0019"
        ]
      },
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "awake": true,
          "parse": {
            "fn": "xiaomi:special",
            "at": "0x00F7",
            "idx": "0x08",
            "eval": "Item.val = '0.0.0_' + ('0000' + (Attr.val & 0xFF).toString()).slice(-4)"
          },
          "read": {
            "fn": "none"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/devicemode",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0144",
            "eval": "Item.val = ['undirected', 'leftright'][Attr.val]"
          },
          "read": {
            "fn": "none"
          },
          "refresh.interval": 360,
          "write": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0144",
            "dt": "0x20",
            "eval": "['undirected', 'leftright'].indexOf(Item.val)"
          },
          "values": [
            [
              "\"undirected\"",
              "Undirected"
            ],
            [
              "\"leftright\"",
              "Left and right"
            ]
          ],
          "default": "undirected"
        },
        {
          "name": "config/devicemode_bis",
          "awake": true,
          "parse": {
            "fn": "xiaomi:special",
            "at": "0x00F7",
            "idx": "0x67",
            "eval": "R.item('config/devicemode').val = ['undirected', 'leftright'][Attr.val]"
          }
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/reportgrid",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0155",
            "eval": "Item.val = Attr.val !== 0"
          },
          "read": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0155"
          },
          "write": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0155",
            "dt": "0x20",
            "eval": "Item.val ? 1 : 0"
          },
          "default": true,
          "refresh.interval": 84000
        },
        {
          "name": "config/resetpresence",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "at": "0x0143",
            "eval": "if (Attr.val) { Item.val = false }"
          },
          "read": {
            "fn": "none"
          },
          "write": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "at": "0x0157",
            "dt": "0x20",
            "eval": "Item.val ? 1 : 0"
          }
        },
        {
          "name": "config/sensitivity",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "at": "0x010C",
            "eval": "Item.val = Attr.val - 1"
          },
          "read": {
            "fn": "none"
          },
          "refresh.interval": 60,
          "write": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x010C",
            "dt": "0x20",
            "eval": "Item.val + 1"
          },
          "values": [
            [
              0,
              "Low"
            ],
            [
              1,
              "Medium"
            ],
            [
              2,
              "High"
            ]
          ],
          "default": 2
        },
        {
          "name": "config/sensitivity_bis",
          "awake": true,
          "parse": {
            "fn": "xiaomi:special",
            "at": "0x00F7",
            "idx": "0x66",
            "eval": "R.item('config/sensitivity').val = Attr.val - 1"
          }
        },
        {
          "name": "config/sensitivitymax",
          "static": 2
        },
        {
          "name": "config/temperature",
          "awake": true,
          "parse": {
            "fn": "xiaomi:special",
            "at": "0x00F7",
            "idx": "0x03",
            "eval": "Item.val = Attr.val * 100"
          }
        },
        {
          "name": "config/triggerdistance",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0146",
            "eval": "Item.val = ['far', 'medium', 'near'][Attr.val]"
          },
          "read": {
            "fn": "none"
          },
          "write": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "mf": "0x115F",
            "at": "0x0146",
            "dt": "0x20",
            "eval": "['far', 'medium', 'near'].indexOf(Item.val)"
          },
          "values": [
            [
              "\"far\"",
              "Someone approaching is detected on high distance"
            ],
            [
              "\"medium\"",
              "Someone approaching is detected on medium distance"
            ],
            [
              "\"near\"",
              "Someone approaching is detected on low distance"
            ]
          ],
          "default": "far"
        },
        {
          "name": "config/triggerdistance_bis",
          "awake": true,
          "parse": {
            "fn": "xiaomi:special",
            "at": "0x00F7",
            "idx": "0x69",
            "eval": "R.item('config/triggerdistance').val = ['far', 'medium', 'near'][Attr.val]"
          }
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/presence",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "at": "0x0143",
            "eval": "Item.val = (Attr.val !== 1 && Attr.val !== 3 && Attr.val !== 5)"
          },
          "read": {
            "fn": "none"
          }
        },
        {
          "name": "state/presenceevent",
          "parse": {
            "fn": "zcl:attr",
            "ep": 1,
            "cl": "0xFCC0",
            "at": "0x0143",
            "eval": "Item.val = ['enter', 'leave', 'enterleft', 'rightleave', 'enterright', 'leftleave', 'approaching', 'absenting', '8', '9'][Attr.val]"
          },
          "read": {
            "fn": "none"
          }
        }
      ]
    }
  ]
}
