It works, but TBH I am not fully sure why.
EDIT: fixed battery readings
{
"schema": "devcap1.schema.json",
"manufacturername": "$MF_LUMI",
"modelid": "lumi.sensor_magnet.aq2",
"vendor": "Xiaomi",
"product": "lumi.sensor_magnet.aq2",
"sleeper": true,
"status": "Silver",
"path": "/devices/lumi.sensor_magnet.aq2.json",
"subdevices": [
{
"type": "$TYPE_OPEN_CLOSE_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0006"
],
"fingerprint": {
"profile": "0x0104",
"device": "0xFFFF",
"endpoint": "0x01",
"in": [
"0x0006"
]
},
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/battery",
"parse": {
"at": "0xff01",
"ep": 1,
"script": "xiaomi_battery.js",
"fn": "xiaomi:special",
"idx": "0x01"
},
"awake": true,
"default": 0
},
{
"name": "config/enrolled",
"public": false,
"description": "State of IAS enrollment process."
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "config/temperature"
},
{
"name": "state/lastupdated"
},
{
"name": "state/open",
"parse": {
"at": "0x0000",
"cl": "0x0006",
"ep": 1,
"eval": "Item.val = Attr.val != 0",
"fn": "zcl"
},
"default": false
}
]
}
],
"bindings": [
{
"bind": "unicast",
"src.ep": 1,
"cl": "0x0006",
"report": [
{
"at": "0x0000",
"dt": "0x10",
"min": 0,
"max": 0
}
]
}
]
}