zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Reconnect device

Open kaelsaes opened this issue 8 years ago • 23 comments

Hi,

sometimes a Xiaomi device (temp sensor) doesn't send values anymore although it worked for many days without a problem.

How can i reconnect this device? Do i have to bind it again? With coordinator or router?

Thanks.

kaelsaes avatar Sep 09 '18 11:09 kaelsaes

Hi all, I have the same problem. Would be interested in any advice how to proceed. Thanks.

57k avatar Sep 09 '18 11:09 57k

Hi, crazy, just had this problem the first time. Never had a connection/not reporting problem with WSDCGQ01LM. Just yesterday, my WSDCGQ11LM stopped working. I'm using this sensor outside but rain-covered. So i pressed the button for 1 second to manually report the values but that didn't work. Then, I took the sensor inside, close to my coordinator and long pressed the button (without removing the device before), now the sensor work again.

AnhDuc85 avatar Sep 09 '18 11:09 AnhDuc85

When I pair the device a second time following message appears: spinlock: false device already in network

kaelsaes avatar Sep 11 '18 18:09 kaelsaes

I found this to be usually a signal problem. Usually triggering a device wakeup (like blow hot hair in it) will send new reports, but I had to adjust position sometimes for better signal. If nothing works you can try adding routers to get around this.

ciotlosm avatar Sep 27 '18 13:09 ciotlosm

I've the same issue; I think.

The device wasn't sending messages anymore.

  1. Replaced the battery. To no avail.
  2. Then removed it through MQTT option by sending ID to topic to remove device
  3. restart.
  4. re-pair. Sheppard says: "device allready in network"
  5. checked: device is in configuration.yaml and in database.db
  6. Nothing seems to help to receive messages from the sensor.

Please advice what to try next (,not looking for reflashing the cc2531 since It would let me re-pair 30+ devices).

Thanks.

basmeerman avatar Sep 30 '18 20:09 basmeerman

the pairing process is such an hassle with zigbee2mqtt, It tooks me all afternoon yesterday to try to repair 30ish devices. And I still have some I can't pair for no reason... There must be something very wrong with the hardware/firmware/software/dunno, cause the pairing works like a charm with another zigbee coordinator (JN5168) even with the device is far from the coordinator.

tricks used to manage to pair:

  • stopping router
  • restarting zigbee2mqtt
  • removing the device I want to reconnect with mqtt
  • removing all the instances of the device in database.db
  • waiting and trying again

lolorc avatar Oct 01 '18 08:10 lolorc

Update: It seemed the pairing was incomplete and the network address (int) of the device changed on re-pairing (due to that I removed it before).

I edited the database.db file and made the following changes:

  • device information updated to fix the incomplete binding. Example: the field model was not set. I copied the values from another sensor on a different line in the file.

  • To have messages processed by zigbee2mqtt/zigbee sheppard I changed the nwkaddr field of the sensor (based on id) to the srcaddr that showed up in the Zigbee Sheppard logging (messages received where not recognized, transformed, and dispatched).

This all took me about 4/5 hours of analyzing logs, code, and debug info. Finally fixed it within 5 minutes argggg. The great part is I gained a lot of insight into the internal workings of it all.

@lolorc question: with regards to your zigbee coordinator (JN5168) does this work with Xiaomi/Aqara sensors (I have about 30 sensors installed and I'm looking to extend this to about 60, but are hesitant with regards to the pairing difficulties)? Why did you switch zigbee coordinator? Thanks.

FYI: I have 1 coordinator and 3 routers running CC2531 currenlty.

basmeerman avatar Oct 01 '18 09:10 basmeerman

@basmeerman funny we both end up changinfg database.db by hand :-)

jn5168 is the chipset used by the zigate gateway (french project, zigate.fr) There's very useful information about devices on the website. yes it does work with xiaomi/aqara.

I moved from zigate/jn5168 to zigbee2mqtt/cc253x for several reasons:

  • zigate firmware is closed source. It should be opened but I think it won't happen cause it will let people use a simple aqara device(jn5169) as coordinator
  • zigate support is not existent atm
  • userbase very low
  • a lot of devices support is done in the firmware, here the support is done with zigbee-sheperd-converters

What I don't like at all with zigbee2mqtt/cc253x is the pairing process, again I really think there's something very wrong somewhere. I really hope the upgrade to z stack 3 will fix all this weirds issues. (too many zigbee2mqtt weird github issues as well)

lolorc avatar Oct 01 '18 09:10 lolorc

@lolorc

ad pairing issues) From what I've read and experienced is the pairing a real headache, but once paired devices seem to be running stable.

ad z stack 3) From what I understand this would only work for new sensors that support z stack 3.0. This support could come either by buying new sensors (With build in support) or somehow having a firmware upgrade on all devices (which I hope for, but deem unlikely). Furthermore from what I've read is that the amount of sensors/devices supported by CC2531 is limited due to memory limits on the cc2531. So unless a new stack would mean either efficiency or 'sourcing' more work from the chip to the software bridge (I haven't read the z stack 3.0 specs) I wouldn't ge my hopes up. But then again I've been mistaken before :-)

Thanks sofar.

basmeerman avatar Oct 01 '18 09:10 basmeerman

@basmeerman I can’t find it now but I’m sure someone knowledgeable said in one issue here that on 3.0 the ‘limit’ is removed as it can be done in software. I thought I would find it in https://github.com/Koenkk/zigbee2mqtt/issues/211 but it’s not in there.

Sent with GitHawk

ryanbeaton avatar Oct 01 '18 10:10 ryanbeaton

@basmeerman what did you use to edit the database by hand?

blakeblackshear avatar Oct 01 '18 11:10 blakeblackshear

on my side I did use vim :-) I also used a script like this:

a=$(date +"%Y%m%d%H%M%S")
cp data/database.db data/database.db-$a
grep -i -v -e 0xieeeAddr1 -e 0xieeeAddr2 -e 0xieeeAddr3 -e 0xieeeAddr4 data/database.db-$a > data/database.db

to remove the devices I couldn't pair

lolorc avatar Oct 01 '18 11:10 lolorc

Thanks. I didn't realize it was plain text.

blakeblackshear avatar Oct 01 '18 11:10 blakeblackshear

@basmeerman I can’t find it now but I’m sure someone knowledgeable said in one issue here that on 3.0 the ‘limit’ is removed as it can be done in software. I thought I would find it in #211 but it’s not in there.

Sent with GitHawk

Thanks, If you find it let me know.

And for what you mentioned it's about the only possible explanation (offloading of the chip) for Z stack 3.0 to fullfill the aforementioned expectation on the same hardware. Or the current firmware is heavily inefficient (what I would not expect since a lot of knowledgeable people worked on it).

Hope to read more about it soon :-)

basmeerman avatar Oct 01 '18 11:10 basmeerman

Found it, it's in https://github.com/Koenkk/zigbee2mqtt/issues/134

Read the link from @kirovilya : https://github.com/Tropicao/zigbridge/blob/master/doc/firmware_instructions.md

That guy is using Z-Stack 3.0.1

ryanbeaton avatar Oct 01 '18 12:10 ryanbeaton

https://github.com/HalleyAssist/zigbee-shepherd is also using Z-Stack 3. their forks (zigbee-shepertd/cc-znp/zcl*) are getting a lot updates. But I don't know what do they use them with. (the software using their zigbeer forks)

lolorc avatar Oct 01 '18 12:10 lolorc

Yeah @splitice and his crew are doing some cool things https://halleyassist.com HalleyAssist supports safe, independent and healthy living in the home.

ryanbeaton avatar Oct 01 '18 13:10 ryanbeaton

yep looks like it's not something I could try at home to see if all the pairing issues and weird behaviors go away with Z-Stack 3 :-)

lolorc avatar Oct 01 '18 13:10 lolorc

Could anyone please help me work item a quick breakdown to test this with zigbee2mqtt... (optimistic_mode=on; maybe I find some time next couple of weeks to work this out in between things)

Few steps to take:

  1. flash new firmware to cc2531 (firmware is located on hallyassist git repo? or do I need to build it? and why?)
  2. run latest version of stack @ halleyassist/zigbee-shepherd // demo should at least recognize messages received. Try to bind a bunch of sensors >20 to the newly flashed cc2531 (see if it overcomes the max device boundry - hypotheses is with Zstack3 this would be solved outside the firmware ).
  3. workout diff between koenk/zigbee-shepherd and halleyassist/zigbee-shepherd to see if any API breaks, fix these.
  4. run and test the new stack.

Am I missing important details? Thanks.

basmeerman avatar Oct 01 '18 15:10 basmeerman

@basmeerman that is very close to what @kirovilya did in https://github.com/Koenkk/zigbee2mqtt/issues/211 . Maybe comment in there and work together.

ryanbeaton avatar Oct 02 '18 00:10 ryanbeaton