# Xiaomi Aqara MCCGQ11LM Window and Door sensor

**URL:** <https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986>\
**Category:** DDF-Library\
**Created:** [May 11, 2022, 9:10pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986 "2022-05-11T21:10:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Finne75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/finne75/32/1538_2.png) [@Finne75](https://forum.phoscon.de/u/Finne75)\
**Post date:** [May 11, 2022, 9:10pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/1 "2022-05-11T21:10:32Z")

</div>

It works, but TBH I am not fully sure why.

EDIT: fixed battery readings

```auto
{
  "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
        }
      ]
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Smanar](https://forum.phoscon.de/user_avatar/forum.phoscon.de/smanar/32/60_2.png) [@Smanar](https://forum.phoscon.de/u/Smanar)\
**Post date:** [May 12, 2022, 1:16pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/2 "2022-05-12T13:16:01Z")

</div>

> [@Finne75](#):
>
> ```auto
> "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 ?

---

<div class="post-metadata">

**Author:** ![Finne75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/finne75/32/1538_2.png) [@Finne75](https://forum.phoscon.de/u/Finne75)\
**Post date:** [May 12, 2022, 7:43pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/3 "2022-05-12T19:43:17Z")

</div>

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 🙂 . 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?

```auto
{
  "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"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Smanar](https://forum.phoscon.de/user_avatar/forum.phoscon.de/smanar/32/60_2.png) [@Smanar](https://forum.phoscon.de/u/Smanar)\
**Post date:** [May 13, 2022, 4:09pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/4 "2022-05-13T16:09:55Z")

</div>

```auto
"bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0006"

```

This is just a bind

```auto
      "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](https://github.com/dresden-elektronik/deconz-rest-plugin/pulls)

---

<div class="post-metadata">

**Author:** ![dimitripb](https://forum.phoscon.de/user_avatar/forum.phoscon.de/dimitripb/32/3386_2.png) [@dimitripb](https://forum.phoscon.de/u/dimitripb)\
**Post date:** [May 21, 2023, 8:17pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/5 "2023-05-21T20:17:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BabaIsYou](https://forum.phoscon.de/user_avatar/forum.phoscon.de/babaisyou/32/3079_2.png) [@BabaIsYou](https://forum.phoscon.de/u/BabaIsYou)\
**Post date:** [May 22, 2023, 10:58am UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/6 "2023-05-22T10:58:05Z")

</div>

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](https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/xiaomi/xiaomi_mccgq11lm_openclose_sensor.json). Just updating the existing one seems the best solution to me 😉

---

<div class="post-metadata">

**Author:** ![dimitripb](https://forum.phoscon.de/user_avatar/forum.phoscon.de/dimitripb/32/3386_2.png) [@dimitripb](https://forum.phoscon.de/u/dimitripb)\
**Post date:** [May 29, 2023, 10:05am UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/7 "2023-05-29T10:05:46Z")

</div>

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:

> <https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6919>
>
> \## Xiaomi special attribute
> Create a number of dummy companion items (e.g \`stat…e/temperature\_bis\` for \`state/temperature\`), so the item can be updated from a regular Zigbee attribute and from the Xioami special attribute. In time, the dummy items will become dynamic items, and can be removed from the C++ code.
> 
> Added logic to \`handleSensorEvent()\` to reset automatically \`state/presence\` or \`state/vibration\` on managed devices with \`config/duration\` \> 0. Note that \`config/duration\` should be exposed only on devices that don't send "no more presence" or "no more vibration" events.
> 
> I have been converting the DDFs for all Xiaomi devices in my possession, double-checking with the sniffer that these are handled correctly. I won't touch DDF for devices not / no longer in my possession.
> 
> \### \`lumi.airmonitor.acn01\`
> This is the Aqara TVOC Air Quality Monitor VOCKQJK11LM from #6867.
> 
> Changes:
> \- Delete \`fcc0\_airmonitor\_acn01.js\` in favour of \`eval\` per dummy item.
> 
> \### \`lumi.motion.ac01\`
> This is the Aqara FP1 Human Presence Sensor RTCZCGQ11LM from #6900.
> 
> Changes:
> \- Remove \`config/allowtouchlink\` in favour of \`config/reportgrid\`, which can be updated from the API. The grid data is not yet exposed by the API.
> 
> \### \`lumi.sensor\_magnet.aq2\`
> This the square-ish Aqara Door and Window Sensor MCCGQ11LM that exposes the contact state through an \_On/Off\_ cluster, as well as through the special attribute. The special attribute also reports device temperature and battery voltage.
> 
> Changes:
> \- Rename file to \`lumi.sensor\_magnet.aq2.json\`;
> \- Parse special attribute to update \`config/battery\`, \`config/temperature\`, \`state/open\`;
> \- Base \`swversion\` on \_Application Version\_, in line with the Aqara app though the Aqara M2.
> 
> \### \`lumi.sensor\_wleak.aq1\`
> This is the round Aqara Water Leak Sensor SJCGQ11LM from #263.  
> It reports water leak detection through \_IAS Zone\_, but doesn't support enrolling.  
> It also reports leak detection though the Xiaomi special attribute, as well as device temperature, battery voltage, and firmware version.
> 
> Changes:
> \- New DDF file.
> \- Remove the non-functional \`config/enrolled\`, \`config/pending\`, \`state/lowbattery\`, and \`state/tampered\` that the legacy code exposed.
> \- \`swversion\` now shows \`0.0.0\_0006\`.
> 
> \### \`lumi.vibration.aq1\`
> This is the Aqara Vibration Sensor DJT11LM.
> 
> Changes
> \- Rename file to \`lumi\_vibration\_aq1.json\`;
> \- Normalise \`config/sensitivity\` from 0 (low) to 2 (high), with matching \`config/sensitivitymax\`;
> \- Add \`config/duration\` with fixed value of 65 to reset automatically \`state/vibration\`;
> \- Remove \`config/pending\`;
> \- Fix JavaScript to compute orientation and rename to \`0101\_orientation.js\`. Note that Javascript internally uses int32 for bitwise operators, hence the magic to extract x, y, and z as (signed!) int16 from the int48 attribute value.
> \- Set \`state/tiltangle\` to 230 on drop (same as legacy code);
> \- Fix generic items for \`state/orientation\_x\`, \`state/orientation\_y\`, \`state/orientation\_z\` and remove \`state/orientation\`.
> 
> \### \`lumi.weather\`
> This is the square(-ish) Aqara Temperature and Humidity Sensor WSDCGQ11LM.  
> It carries a Xiaomi special attribute, but without the software version and device temperature. It also reports temperature, humidity, and air pressure over regular attributes, but no battery voltage.
> 
> Changes:
> \- Rename file to \`lumi\_weather.json\`;
> \- Parse special attribute to update \`config/battery\`, \`state/temperature\`, \`state/humidiy\`, \`state/pressure\`; remove parse from \`config/battery\`
> \- Base \`swversion\` on \_Application Version\_, in line with the Aqara app though the Aqara M2.
> \- Remove \`config/temperature\` as device doesn't report this;
> \- Remove \`awake\` setting for \`manufacturername\` as it doesn't report \_Manufacturer Name\_ on pressing the button (only \_Model Identifier\_ and the Xiaomi special attribute).

---

<div class="post-metadata">

**Author:** ![Swoop](https://forum.phoscon.de/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@Swoop](https://forum.phoscon.de/u/Swoop)\
**Post date:** [May 29, 2023, 5:48pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/8 "2023-05-29T17:48:54Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![dimitripb](https://forum.phoscon.de/user_avatar/forum.phoscon.de/dimitripb/32/3386_2.png) [@dimitripb](https://forum.phoscon.de/u/dimitripb)\
**Post date:** [May 29, 2023, 8:29pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/9 "2023-05-29T20:29:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Swoop](https://forum.phoscon.de/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@Swoop](https://forum.phoscon.de/u/Swoop)\
**Post date:** [May 29, 2023, 9:49pm UTC](https://forum.phoscon.de/t/xiaomi-aqara-mccgq11lm-window-and-door-sensor/1986/10 "2023-05-29T21:49:07Z")

</div>

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.
