Xiaomi Aqara MCCGQ11LM Window and Door sensor

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
        }
      ]
    }
  ]
}

Hello, thx but are you sure using other value can be better here (like 60/600), or perhaps the report is not usefull and need only the bind ?

Hi, to be honest I don’t know when bindings are needed and how it works in detail - I have to say that the documentation is a bit sparse on this :slight_smile: . Maybe you can clarify or point me to a document (cheat sheet and DDF docs in github I already know)

But following your suggestion I removed the report configuration and it still works fine. Additionally, I added the temperature xiaomi-special part so this works as well now.

One question, is “Silver” the right classification or should I set to “Gold” or something else?

{
  "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",
          "awake": true,
          "parse": {
            "at": "0xff01",
            "ep": 1,
            "fn": "xiaomi:special",
            "idx": "0x01",
            "script": "xiaomi_battery.js"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/temperature",
          "parse": {
            "at": "0xff01",
            "ep": 1,
            "eval": "Item.val = Attr.val * 100",
            "fn": "xiaomi:special",
            "idx": "0x03"
          },
          "default": 0
        },
        {
          "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"
    }
  ]
}
"bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0006"

This is just a bind

      "report": [
        {
          "at": "0x0000",
          "dt": "0x10",
          "min": 0,
          "max": 0,
          "change":0x0001,
        }

This is the reporting, it mean the device will send to the coordinator (the bind is made unicast with device <> coordinator) report for the attribute 0x0000
Min is the minimum time without report.
Max is the maximum time without report.
Change is the minimum difference value that can trigger a reporting (not present on all attribute, have added it as exemple)

The cluster 0x0006 generaly need reporting too, but you know the device better than me ^^.
Just remember the reporting can already be done before you last DDF version (I don’t think deconz make unbind)

For the status, officialy we need to use “Bronze”, to don’t broke others users network, and after some validation the status become “Gold”
But as this device was never included, you can’t broke something, so for me can use “Gold”, like that the DDF will be used natively on others users.
Or “Silver” if you are not 100% sure.

BTW do you know how to make a PR on github ?
If yes can put your DDF here too Pull requests · dresden-elektronik/deconz-rest-plugin · GitHub

@Finne75 Did you make progression on this DDF? I tried to use this DDF but it won’t load. The binding is somehow rejected.

AFAIK a DDF is already existing for that device deconz-rest-plugin/xiaomi_mccgq11lm_openclose_sensor.json at master · dresden-elektronik/deconz-rest-plugin · GitHub. Just updating the existing one seems the best solution to me :wink:

I tried that one but it is not working correctly. I saw an update is added to the next Deconz release. Obviously it was impossible to get open/closed, temperature and battery to work without a special attribute:

@dimitripb The DDF coming with deconz works without any issues and and does what you state would be obvisouly missing. What’s not working in your view?

In my case the DDF is rejected. I set it to Gold status but after a restart it’s still not loaded. I did not have enough time to check the log files. Maybe this week I can try again to check the logs.

I’m not sure what you’ve done to your setup here, as the DDF coming with deconz is in gold status already. Maybe you should just delete whatever DDF you’re playing with, as it doesn’t seem to be the correct one.