dresden-elektronik / deconz-rest-plugin

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

Xiaomi Aqara FP1E #7885

Closed thomasgolda closed 2 months ago

thomasgolda commented 2 months ago

Is there already an existing issue for this?

Product name

Aqara Millimeter Wave Presence Sensor FP1E

Manufacturer

aqara

Model identifier

lumi.sensor_occupy.agl1

Device type to add

Sensor

Node info

screenshot_03

Endpoints and clusters

screenshot_02b

Basic

screenshot_01

Further relevant clusters

screenshot_04a screenshot_04b
SwoopX commented 2 months ago

@thomasgolda could you please change the model identifier and manufacturer as per our template? Thanks!

thomasgolda commented 2 months ago

@SwoopX I updated both as given in the basic cluster. Hope that's correct.

SwoopX commented 2 months ago

Looking good, thanks a lot! Helps finding the issue again 👍

ebaauw commented 2 months ago

Note that it uses Manufacturer Code 0x1234, and consequently, that version of the 0xFCC0 cluster (with generic attributes).

Sniffing the device while connected to the Aqara Hub M1 reveals the following attributes:

Attr DT R W Description
0x00E8 bool - W Restart device.
0x010C u8 - - Motion Sensitivity (got a report, but no corresponding setting in the Aqara app).
0x0142 u8 R - Presence.
0x0157 u8 - W Reset Presence (app sets this on AI Learning).
0x0159 u8 R W Unknown (value 1).
0x015A u32 R W Unknown (value 600).
0x015B u32 R W Detection Range (in cm, Aqara app sets from 0 .. 600, in increments of 30).
0x015C u8 R W Unknown (value 1).
0x015D u8 R W Unknown (value 1).
0x015E u8 R W Unknown (value 1).
0x015F u32 R - Position (distance of detected human, in cm).
0x0160 u8 R - Unknown (seeing values 2 (when no presence), and 3, 4 (when presence)).

0x0142, 0x015F and 0x0160 are reported frequently, as soon as changes occur. The other attributes where reported only on device restart.

Also got a Xiaomi special attribute 0x00F7:

                     1 2  3  4 5  6 7  8 9  0 1  2 3  4 5  6 7  8  9 0  1  2 3  4  5 6  7  8 9  0
     attr tp  l    temp   RSSI dB  firmware    parent       ?       ?       ?       ?       ?
         ---- -- -- ------- --------- --------- --------- ------- ------- ------- ------- -------
fp1e:    00f7 41 1e 0328 22 0521 0400 0821 1c01 0a21 0000 0c20 14 1020 01 1220 00 6520 00 6620 01
                 30                  0.0.0_0028

This seems to be sent only on restart, not after occupancy changes.

Note that I got a firmware update to 0.0.0_0028.

Also note that the device reacts to Identify.

ebaauw commented 2 months ago

The DDF results in the following resource:

{
  "config": {
    "detectionrange": 600,
    "on": true,
    "reachable": true,
    "resetpresence": false
  },
  "etag": "87b6a6502dc209729465632492469ebf",
  "lastannounced": null,
  "lastseen": "2024-08-23T20:18Z",
  "manufacturername": "aqara",
  "modelid": "lumi.sensor_occupy.agl1",
  "name": "Presence 155",
  "state": {
    "distance": 30,
    "lastupdated": "2024-08-23T20:18:45.196",
    "presence": true
  },
  "swversion": "0.0.0_0028",
  "type": "ZHAPresence",
  "uniqueid": "54:ef:44:10:00:db:19:b1-01-0406"
}

Note that the cluster in the uniqueid is a blatant lie, just as for the FP1.

Set config/resetpresence to true to activate AI Learning. The attribute is read-only, so the item resets to false, as soon as state/presence changes. I'm quite impressed by this feature: after running it, the sensor no longer gives false positives on my ceiling fans. I can deprecate the aluminum foil above my FP1!

Note that config/detectionrange needs the (trivial) C++ changes to be updatable from the API.