Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ZStack driver for CC253x dongles #101

Merged
merged 6 commits into from Apr 10, 2020

Conversation

agendek78
Copy link
Contributor

@agendek78 agendek78 commented Feb 14, 2019

Initial version of CC253x driver

Fixes #152

@dhylands
Copy link
Contributor

I have a couple cc2531 dongles. What firmware do I need to flash on them in order to test this?

@agendek78
Copy link
Contributor Author

I tested with latest ZStack 3.0.2. See https://github.com/agendek78/zigbee-adapter/tree/master/firmware
This firmware is without bootloader.

@dhylands
Copy link
Contributor

I've been really busy in the past little bit, and I just wanted to let you know that I should get a chance to try this out/review the code in the next week.

@itsmepetrov
Copy link

Any updates?

I’ve tried it with xiaomi devices (with zstack 3.0.2 firmware), devices are able to join to the network but they leave after about 5 seconds.

With zstack 1.2. firmware (from this repo https://github.com/Koenkk/Z-Stack-firmware/tree/dev) devices don’t leave the network but I noticed some delay after sending first two or three on/off commands to plug, and after that all next commands send immediately

@dhylands
Copy link
Contributor

dhylands commented Apr 8, 2019

Sorry - I've been totally swamped. The xiami devices are "special" and don't completely adhere to the spec. From the research I've done online, the parent sends a NWK Leave request with rejoin flag set, and the xiami devices don't rejoin. Apparently there are some outlets which they work with, and I believe that the ConBee zigbee dongle has special code to deal with them.

So I generally avoid the xiami devices. With the Digi dongle, all of my battery powered xiami devices are gone within 24 hours.

@itsmepetrov
Copy link

@dhylands I'm not sure that issue with devices leaving is only related to Xiaomi/Aqara, I have the same problems with Tradfri Bulbs on 3.0.2 firmware, with 1.2. firmware almost everything works fine

@itsmepetrov
Copy link

itsmepetrov commented Apr 8, 2019

I've fixed the issue with devices leaving, it turned out that we need to add TP2_LEGACY_ZC to preprocessors symbols to allow legacy devices to join the network (we must allow legacy devices to join Zigbee 3.0 network, they are being rejected because of the new Zigbee 3.0 security scheme)

New firmware: CC2531ZNP-3.0.2.zip

@itsmepetrov
Copy link

I've also notices the following warning:

handleExplicitRx: Unrecognize frame received
{ sof: 254,
  len: 1,
  type: 2,
  subsys: 5,
  cmd: 192,
  payload: <Buffer 09>,
  fcs: 141,
  csum: 141,
  id: undefined }

I receive this message on every start and, as I understand, it's related to permit join event (subsys: 5)

@candardo
Copy link

Any updates? I've got a CS2531 dongle, a Raspberry and an IKEA bulb and I was hoping CS2531 support would happen sooner or later to try it out.

@Horstx3
Copy link

Horstx3 commented Aug 4, 2019

Also have problems with the CS2531 dongle.
Error is "zigbee: Failed to load zigbee-adapter - No Zigbee dongle found"

But the line before it says it is found..
"USB Serial Device 0451:16a8 Vendor: Texas Instruments Serial: __0X00124B00194A0664 found @ /dev/ttyACM0" and "Serial Device found @ /dev/ttyAMA0"

Flashed the stick but still not working..

@damianon
Copy link

Is there any progress on this PR?

@agendek78 agendek78 force-pushed the master branch 3 times, most recently from ff16b68 to 5aa2ab5 Compare November 7, 2019 20:13
@agendek78
Copy link
Contributor Author

Question to @dhylands : I added property notification in zb-driver.js in RESOLVE_SET_PROPERTY command - is this correct? Without this change setting property of zigbee light didn't work as gateway core wasn't notified about successful change of it. I have only CC2531 dongle to check - but don't see also reason why it should work for other dongles without this change.

@davehylands
Copy link

Normally, when you set a property, there would be a config report setup and a binding done. Setting the property should then report a change.

There are some devices which don't support config reports and/or don't report the changes. You can set the attribute fireAndForget to true on a property, and that will "fake" a notification when setting the value of a property.

So far, this has been device specific and not driver specific. So if you look through the zb-classifier.js file you'll see devices where fireAndForget gets set.

Having RESOLVE_SET_PROPERTY do a notification would be like setting fireAndForget for all properties (so putting the notification there isn't correct). The purpose of RESOLVE_SET_PROPERTY is that when you call setValue on a Property, it returns a promise that is resolved once the value has been "set". Since the command to set a value is queued, this can happen sometime in the future. Setting a value queues up a command to set the value, wait for an acknowledgement that the command was actually set and then resolve the Promise.

The zigbee device should then send back a notification that the value changed, which is what normally triggers the notification (or the fake notification if fireAndForget is set).

@zx-ecco
Copy link

zx-ecco commented Dec 5, 2019

has this been merged into the main repo? If not, how do I integrate this into the raspberry pi gateway image?

@agendek78
Copy link
Contributor Author

There still must be fixed property changed notification, because current implementation is not correct.

@zx-ecco
Copy link

zx-ecco commented Dec 6, 2019

any estimate on when that will be ready? or anything I can do to help?

@bram209
Copy link

bram209 commented Jan 14, 2020

Would love to be able to use this adapter, anybody still working on this?

@agikea
Copy link

agikea commented Jan 15, 2020

Currently I'm involved in different project. Maybe in Feb/2020 I will look at this issue.

@agendek78
Copy link
Contributor Author

Please check now this PR. There was problem with parsing destination address of the BIND request and bind operation was not successful. Now it works as expected - bind succeeds and reports are sent by device on attribute change.

@mrstegeman
Copy link
Contributor

One request: can you create a README.md in this repo and add info about flashing a dongle with the required firmware?

@agendek78
Copy link
Contributor Author

firmware for cc2531 dongle is included in this PR

@mrstegeman
Copy link
Contributor

@agendek78 I know, but not everybody knows how to flash that firmware (myself included), so instructions would help.

@MikeSPtr
Copy link

CC2531 flashing instruction
I've verified and @agendek78 changes work fine, thank you.

@mrstegeman mrstegeman merged commit 2c645e4 into WebThingsIO:master Apr 10, 2020
@flatsiedatsie
Copy link
Contributor

Has onyone gotten this to work ok? I bought a $4 preflashed Itead dongle from Aliexpress. It would rock if a $4 dongle could replace an almost ten times more expensive Conbee II dongle.

@davidhitchins
Copy link

Hello all. I too would love to see the CC2531 dongles supported. Or are they already?

@mrstegeman
Copy link
Contributor

Already supported. 🙂

@davidhitchins
Copy link

Thanks @mrstegeman I realised this five seconds after posting but could not find my post to delete it for some reason (just vanished) :-)

@flatsiedatsie
Copy link
Contributor

Is there anything I need to do to get the dongle to work? Should it be plug and play?

@agendek78
Copy link
Contributor Author

flash included on the repo firmware

@flatsiedatsie
Copy link
Contributor

Ah, but I was hoping a commercially available $4 pre-flashed dongle could work. That would lower the barrier for beginners (both financially and technically).

@agendek78
Copy link
Contributor Author

From description on the itead.cc, I see, the dongle they sell, should have proper firmware to work with this plugin.

@flatsiedatsie
Copy link
Contributor

I just tried it again with an IKEA power socket that had never connected to another network. At the fourth attempt.. it worked!!

Brilliant!

Are there any major downsides to using this $4 dongle over the $40 Conbee 2? Can it handle less devices? Is it less compatible somehow?

@benfrancis
Copy link
Member

Cool, would you mind adding it to the list of supported Zigbee dongles on the wiki, along with any firmware version you need to flash onto it in order for it to work? https://github.com/WebThingsIO/wiki/wiki/Supported-Hardware

(I don't have one myself so can't provide any feedback on how reliable it is).

@flatsiedatsie
Copy link
Contributor

I suspect that the reason my other devices don't work was because I tried devices that are 'sibling' devices. For example, the IKEA motion sensor is designed to be paired with a lamp directly. I believe the Conbee USB stick uses some trickery to make these devices believe they are paired with a lamp. Am I correct in my assumption that these USB sticks might not support this trickery?

@agendek78
Copy link
Contributor Author

You're probably thinking about touchlinking - in that case devices that are commissioned this way, have separate network and won't work because USB dongle is acting as a coordinator and it forms another network itself (with own channel, PANID, etc...) - this applies at least to CC253x adapter implementation. To make those devices work in this setup you have to use 'classic join' commissioning method on all devices and then use 'bind' function to connect specific remotes/sensors with lamps/switches.

@Astiolo
Copy link

Astiolo commented Nov 10, 2020

I believe the Conbee USB stick uses some trickery to make these devices believe they are paired with a lamp.

Yes, the Conbee can simulate another device in order for switches and that motion sensor to connect. I'm not sure which others can do it but the Digi Xstick definitely can't (found out the hard way) and I can't see anything suggesting the CC253x dongles could do it.

@flatsiedatsie
Copy link
Contributor

@Astiolo Thanks. So there's still a good reason to keep using the more expensive Conbee stick I guess.

@farooqhasny
Copy link

CC2531 flashing instruction I've verified and @agendek78 changes work fine, thank you.

broken link

@flatsiedatsie
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cc2531 Support