doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Is it possible to force remove device? #67

Closed Xavier-M closed 4 years ago

Xavier-M commented 4 years ago

Hi,

I don't really know if my problem is related to your plugin or the zigate itself (or my device). Since a few days I have some Xiaomi Aqara devices being "lost", but i already know that it is quite typical. But this time I cannot make them rejoin the network. it started with a door sensor and now 2 temperatures sensors have the same issue.

To make it short, I would like to remove the device completely so the Zigate forget about it. And then I would like to make it rejoin and be discovered. But I tried to spam the remove command and at the same time to press regulary the reset button of the device but in the end the device is always there (even with cleanup_devices).

This is the log of a remove:

2019-08-10 22:27:38 DEBUG (SyncWorker_14) [zigate] REQUEST : 0x0026 b'\x00\x15\x8d\x00\x01\xed\xe9\xa0\x00\x15\x8d\x00\x02\xfbI\x84'
2019-08-10 22:27:38 DEBUG (SyncWorker_14) [zigate] Msg to send b'00260010a700158d0001ede9a000158d0002fb4984'
2019-08-10 22:27:38 DEBUG (SyncWorker_14) [zigate] Encoded Msg to send b'01021026021010a70210158d02100211ede9a00210158d02100212fb498403'
2019-08-10 22:27:38 DEBUG (SyncWorker_14) [zigate] Waiting for status message for command 0x0026
2019-08-10 22:27:38 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15\xa3\x02\x10\x02\x10\x02\x10&\x02\x10\x03'
2019-08-10 22:27:38 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:27:38 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'00000026'
2019-08-10 22:27:38 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:38, error:b'', lqi:0
2019-08-10 22:27:38 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:27:38 DEBUG (SyncWorker_14) [zigate] STATUS code to command 0x0026:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:38, error:b'', lqi:0
2019-08-10 22:27:54 DEBUG (SyncWorker_14) [zigate] REQUEST : 0x0026 b'\x00\x15\x8d\x00\x01\xed\xe9\xa0\x00\x15\x8d\x00\x02\xfbI\x84'
2019-08-10 22:27:54 DEBUG (SyncWorker_14) [zigate] Msg to send b'00260010a700158d0001ede9a000158d0002fb4984'
2019-08-10 22:27:54 DEBUG (SyncWorker_14) [zigate] Encoded Msg to send b'01021026021010a70210158d02100211ede9a00210158d02100212fb498403'
2019-08-10 22:27:54 DEBUG (SyncWorker_14) [zigate] Waiting for status message for command 0x0026
2019-08-10 22:27:54 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15\xa3\x02\x10\x02\x10\x02\x10&\x02\x10\x03'
2019-08-10 22:27:54 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:27:54 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'00000026'
2019-08-10 22:27:54 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:38, error:b'', lqi:0
2019-08-10 22:27:54 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:27:54 DEBUG (SyncWorker_14) [zigate] STATUS code to command 0x0026:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:38, error:b'', lqi:0

If I try to reset the sensor to rejoin I have this:

2019-08-10 22:08:55 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x87\x02\x11\x02\x10\x02\x13U\xd0\x02\x10\x02\x10\x03'
2019-08-10 22:08:55 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:08:55 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8701: b'd000'
2019-08-10 22:08:55 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8701 - Route Discovery Confirmation : status:208, network_status:0, lqi:0
2019-08-10 22:08:55 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:09:07 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x02\x10M\x02\x10\x02\x1cy\xf3\xe7\x02\x10\x15\x8d\x02\x10\x02\x12\xfbI\x84\x80\x02\x10\x03'
2019-08-10 22:09:07 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Received response 0x004d: b'f3e700158d0002fb498480'
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x004D - Device announce : addr:f3e7, ieee:00158d0002fb4984, mac_capability:10000000, lqi:0
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Device Announce RESPONSE 0x004D - Device announce : addr:f3e7, ieee:00158d0002fb4984, mac_capability:10000000, lqi:0
2019-08-10 22:09:07 WARNING (ZiGate-Decode data) [zigate] Device already exists with another addr 428f, rename it.
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device Device  (428f) 00158d0002fb4984
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device Device  (f3e7) 00158d0002fb4984
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_DEVICE_ADDRESS_CHANGED
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update device Device  (f3e7) 00158d0002fb4984
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] discover_device f3e7
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] no endpoints
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] REQUEST : 0x0045 f3e7
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Msg to send b'0045000253f3e7'
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Encoded Msg to send b'010210450210021253f3e703'
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Waiting for status message for command 0x0045
2019-08-10 22:09:07 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15C\x02\x10\x83\x02\x10E\x02\x10\x03'
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'00830045'
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:131, packet_type:69, error:b'', lqi:0
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:09:07 DEBUG (ZiGate-Decode data) [zigate] STATUS code to command 0x0045:RESPONSE 0x8000 - Status response : status:0, sequence:131, packet_type:69, error:b'', lqi:0
2019-08-10 22:09:10 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x02\x10M\x02\x10\x02\x1cy\xf3\xe7\x02\x10\x15\x8d\x02\x10\x02\x12\xfbI\x84\x80\x02\x10\x03'
2019-08-10 22:09:10 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Received response 0x004d: b'f3e700158d0002fb498480'
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x004D - Device announce : addr:f3e7, ieee:00158d0002fb4984, mac_capability:10000000, lqi:0
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Device Announce RESPONSE 0x004D - Device announce : addr:f3e7, ieee:00158d0002fb4984, mac_capability:10000000, lqi:0
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device Device  (f3e7) 00158d0002fb4984
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device Device  (f3e7) 00158d0002fb4984
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_DEVICE_UPDATED
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update device Device  (f3e7) 00158d0002fb4984
2019-08-10 22:09:10 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Auto saving /config/zigate.json
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Saving persistent file
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Acquire Lock to save persistent file
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] File already existing, make a backup before
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Release Lock of persistent file
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] REQUEST : 0x0010 
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Msg to send b'0010000010'
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Encoded Msg to send b'01021010021002101003'
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] Waiting for status message for command 0x0010
2019-08-10 22:09:11 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15\x95\x02\x10\x02\x10\x02\x10\x10\x02\x10\x03\x01\x80\x10\x02\x10\x02\x15\x8f\x02\x10\x02\x13\x02\x13\x1a\x02\x10\x03'
2019-08-10 22:09:11 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:09:11 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'00000010'
2019-08-10 22:09:11 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:16, error:b'', lqi:0
2019-08-10 22:09:11 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8010: b'0003031a'
2019-08-10 22:09:11 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8010 - Version list : major:3, installer:31a, lqi:0, version:3.1a
2019-08-10 22:09:11 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:09:11 DEBUG (Thread-22) [zigate] STATUS code to command 0x0010:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:16, error:b'', lqi:0

As you can see, it just rename the device.

In the end my strange issue is that the discover does not work for the device, even with it next to the Zigate and pressing the button regulary:

2019-08-10 22:25:43 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x87\x02\x11\x02\x10\x02\x13U\xd0\x02\x10\x02\x10\x03'
2019-08-10 22:25:43 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:25:43 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8701: b'd000'
2019-08-10 22:25:43 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8701 - Route Discovery Confirmation : status:208, network_status:0, lqi:0
2019-08-10 22:25:43 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] discover_device 7f39
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] no endpoints
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] REQUEST : 0x0045 7f39
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] Msg to send b'00450002017f39'
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] Encoded Msg to send b'010210450210021202117f3903'
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] Waiting for status message for command 0x0045
2019-08-10 22:26:05 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15^\x02\x10\x9e\x02\x10E\x02\x10\x03'
2019-08-10 22:26:05 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:26:05 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'009e0045'
2019-08-10 22:26:05 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:158, packet_type:69, error:b'', lqi:0
2019-08-10 22:26:05 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:26:05 DEBUG (SyncWorker_18) [zigate] STATUS code to command 0x0045:RESPONSE 0x8000 - Status response : status:0, sequence:158, packet_type:69, error:b'', lqi:0
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] discover_device 7f39
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] no endpoints
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] REQUEST : 0x0045 7f39
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] Msg to send b'00450002017f39'
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] Encoded Msg to send b'010210450210021202117f3903'
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] Waiting for status message for command 0x0045
2019-08-10 22:26:14 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x80\x02\x10\x02\x10\x02\x15_\x02\x10\x9f\x02\x10E\x02\x10\x03'
2019-08-10 22:26:14 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:26:14 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b'009f0045'
2019-08-10 22:26:14 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:159, packet_type:69, error:b'', lqi:0
2019-08-10 22:26:14 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-08-10 22:26:14 DEBUG (SyncWorker_0) [zigate] STATUS code to command 0x0045:RESPONSE 0x8000 - Status response : status:0, sequence:159, packet_type:69, error:b'', lqi:0
2019-08-10 22:26:15 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x87\x02\x11\x02\x10\x02\x13U\xd0\x02\x10\x02\x10\x03'
2019-08-10 22:26:15 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-08-10 22:26:15 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8701: b'd000'
2019-08-10 22:26:15 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8701 - Route Discovery Confirmation : status:208, network_status:0, lqi:0
2019-08-10 22:26:15 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
Xavier-M commented 4 years ago

Now I just removed the battery and will wait 2 days I believe and it should be missing right? That could maybe do it.

Xavier-M commented 4 years ago

With a full reset (memory reset) it is OK. I think this was maybe related to this issue: https://github.com/fairecasoimeme/ZiGate/issues/227 so it's probably not an issue with the plugin itself.