dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 498 forks source link

Add Support for lumi.magnet.agl02 (Not lumi.senor_magnet.agl02) #7276

Closed iDragonfighter closed 10 months ago

iDragonfighter commented 11 months ago

Is there already an existing issue for this?

Product name

Aqara Door and Window Sensor T1

Manufacturer

Aqara

Model identifier

lumi.magnet.agl02

Device type to add

None

Node info

Hi, there is already support for "lumi.senormagnet.agl02". #4428 But somehow my device shows. "lumi.magnet.agl02" (without the "sensor"). Therefore it will not show in the app after connecting.

Like the other device it says "Aqara Door and Window Sensor T1" on the box. The Box is beige other than my other devices wich came in an blue box.

Endpoints and clusters

Bildschirmfoto 2023-10-04 um 19 36 44

Basic

Bildschirmfoto 2023-10-04 um 19 35 42

Further relevant clusters

Power Configuration

On/Off

Level Control

Color Control

Thermostat

Simple Metering

Electrical Measurement

Any other cluster of relevance/interest

Mimiix commented 11 months ago

Looks like a new one :)

Can you please add all screens?

SwoopX commented 11 months ago

Sorry, but it's a duplicate of #4343

Mimiix commented 11 months ago

Sorry, but it's a duplicate of #4343

As far as I can see it is the sensor_magnet instead of magnet in your issue.

SwoopX commented 11 months ago

Sorry, but it's a duplicate of #4343

As far as I can see it is the sensor_magnet instead of magnet in your issue.

You might want to look again closely 😉

EDIT Nevermind, the referenced implementation is incorrect and I mixed it up. It's been a long day... #4343 is the device request (being identical), #4428 is the implementation (being incorrect).

Mimiix commented 11 months ago

Sorry, but it's a duplicate of #4343

As far as I can see it is the sensor_magnet instead of magnet in your issue.

You might want to look again closely 😉

You mean your edit on #4428? Now it's fine. Thanks

Yay!

iDragonfighter commented 11 months ago

Sorry, i usually don‘t use github and the terminology here and in the deconz Program is a bit too much for me 😂

You‘re right. It is the Same Device as mentioned in the request #4343 So if needed, you can take the Screenshots from there. But in the „commit?“ (in the changed Code) #4428 Ist says „sensor_magnet“ instead of „magnet“.

again, sorry if that was clear already.

iDragonfighter commented 8 months ago

Thank you for implementing the T1 Sensor. The sensor is now identified as "lumi.magnet.agl02". However, it seems to be malfunctioning as very few details are displayed in the Deconz App, and there is no Open/Closed state. Bildschirmfoto 2024-01-10 um 22 51 50 Using Version 2.25.1

SwoopX commented 8 months ago

Have you re-paired it?

iDragonfighter commented 8 months ago

Yes, a few times. i also did some restarts.

SwoopX commented 8 months ago

@iDragonfighter Conbee 3?

iDragonfighter commented 8 months ago

No, RaspBee II

SwoopX commented 8 months ago

Hm, very odd. However, I also pleayed around with an E1 sensor and experienced the very same. The device was stuck in some strange state I have to say. It seemingly paired correctly (I had the sniffer running) but it just kept quiet while moving the magnet, literally zero response, but all that was with a Conbee 3.

I'll see that have another look with the T1 on Conbee 2 within the next few days.

sirinveen commented 7 months ago

I've just bought this sensor and it works very well, just modify the DDF so that it takes on/off cluster. And also re-pair is always a good idea.

image

image

{
  "schema": "devcap1.schema.json",
  "manufacturername": "$MF_LUMI",
  "modelid": "lumi.magnet.agl02",
  "vendor": "Xiaomi",
  "product": "Aqara T1 open/close sensor MCCGQ12LM",
  "sleeper": true,
  "status": "Gold",
  "path": "/devices/xiaomi_mccgq12lm_t1_openclose_sensor.json",
  "subdevices": [
    {
      "type": "$TYPE_OPEN_CLOSE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0500"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0402",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0x0001",
          "0x0500",
          "0xFCC0"
        ]
      },
      "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": "0x00f7",
            "ep": 1,
            "fn": "xiaomi:special",
            "idx": "0x01",
            "mf": "0x115f",
            "script": "xiaomi_battery.js"
          },
          "default": 0
        },
        {
          "name": "config/enrolled",
          "public": false,
          "default": 1
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/pending"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/open",
          "refresh.interval": 5,
          "read": {
            "at": "0x0000",
            "cl": "0x0006",
            "ep": 0,
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0000",
            "cl": "0x0006",
            "ep": 0,
            "eval": "Item.val = Attr.val",
            "fn": "zcl:attr"
          }
        }
      ]
    }
  ]
}
chc88 commented 7 months ago

The adjusted ddf by @sirinveen works for me

SwoopX commented 7 months ago

The DDF has already been amended in this regard. However, I'd recommend to take code from here https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/xiaomi/xiaomi_dw-s03d_t1_openclose_sensor.json to prevent the device being hammered with unnecessary requests.

iDragonfighter commented 7 months ago

I don't know what I'm doing wrong, but unfortunately, it still doesn't work for me. Not with the DDF from @sirinveen, and not even with the DDF file provided by @SwoopX. Same behavior as here. I now believe that my sensor is simply broken... I think I am going to toss it out.

But thanks for the support.

chc88 commented 7 months ago

@SwoopX thanks, only changing the parse element does the trick as well.

@iDragonfighter what have you tried? did you restart deconz (or the docker image) after changing the ddf, and did you save the ddf in the correct place? Or when all is loaded, opened/closed the sensor to send a trigger from the device?

I had the same output as well.

Mechazawa commented 5 months ago

I just got these thinking they were the same ones as I had before and sadly I'm having the same amount of luck. I've tried changing the DDF but due tot the permissions in the docker container I can't really replace the file. I'm not a fan of turning /opt/deCONZ/devices into a volume since I'm afraid it won't update its contents when the container updates