Repository: custom-components/ble_monitor

Issue #811: [Bug]: Door events are missing from the N100 lock sensors
Created: 2022-04-03T00:07:42Z
What happened?
When I was debugging the N100 lock sensors with #797, I've found the door lock sent out a new packet message with meaningful information. The script does not capture it.
Please refer to the packet code below. The event 0007 should be a door event, which tells whether or not the door is closed or open etc. according to the documentation.
The code returns the following payload:
{'rssi': -58, 'mac': 'F7AAF9527653', 'type': 'ZNMS16LM', 'packet': 218, 'firmware': 'Xiaomi (MiBeacon V4)', 'data': True}
Sensor type
Lock
Relevant log output
043E2602010001537652F9AAF71A020106161695FE50449E06DA537652F9AAF70700050275324062C6

Duplicate issue #797: [Bug]: Aqara N100 with firmware MiBeaconV4
Created: 2022-03-25T23:14:20Z
What happened?
I have the Aqara N100 door lock with a the latest firmware. It seems to be the new MiBeaconV4 instead of V2 in the previous one. Therefore, I provided the token to the setting. However, the status of the device was not updated completely. For example, the lock status is always locked. The corresponding logs from ESPHome are attached.

Sensor type
Lock N100
Relevant log output
[10:05:48][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2602010001537652F9AAF71A020106161695FE50449E06F8537652F9AAF70A100532C74A3E62AE
[10:05:48][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2602010001537652F9AAF71A020106161695FE50449E06F8537652F9AAF70A100532C74A3E62A8
[10:05:49][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06F9537652F9AAF72D0100AD
[10:05:49][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06F9537652F9AAF72D0100A9
[10:06:09][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06F9537652F9AAF72D0100AC
[10:06:13][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06F9537652F9AAF72D0100AA
[10:06:29][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FB537652F9AAF72D0100AB
[10:06:43][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FB537652F9AAF72D0100A9
[10:06:53][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FD537652F9AAF72D0100A9
[10:06:58][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FD537652F9AAF72D0100AB
[10:06:58][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FD537652F9AAF72D0100AD
[10:07:08][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E06FD537652F9AAF72D0100AA
[10:08:49][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2602010001537652F9AAF71A020106161695FE50449E0604537652F9AAF70A1005327B4B3E62AD
[10:08:50][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2A02010001537652F9AAF71E0201061A1695FE50449E0606537652F9AAF70B0009A4000000007D4B3E62AA
[10:08:51][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2A02010001537652F9AAF71E0201061A1695FE50449E0606537652F9AAF70B0009A4000000007D4B3E62B2
[10:10:42][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E060E537652F9AAF72D0100A7
[10:10:47][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E060E537652F9AAF72D0100A9
[10:10:47][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E060E537652F9AAF72D0100AF
[10:11:02][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E0610537652F9AAF72D0100AA
[10:11:03][D][ble_gateway:063]: [F7:AA:F9:52:76:53] Packet 043E2102010001537652F9AAF715020106111695FE30449E0610537652F9AAF72D0100AE

Closing comment (2022-04-03T00:08:23Z): It seems to be mainly due to the lock sending intermittent ble signal for events (sometimes the unlock packet is missing from the esphome log). I haven't tried the direct connection to ble_monitor for troubleshoot. So I cannot tell if it is the esphome issue or the issue with the N100 lock. However, other event-based ble sensors (e.g., motion) are working OK using the same configuration.
During the debug, I've found the N100 lock is also sending the door events. This is reported in #811. Thanks for the hints for troubleshooting.