tlaukkan / zigbee4java

Zigbee API for Java provides simple Java interface to ZigBee network.
Apache License 2.0
144 stars 68 forks source link

Support for hardware from multiple vendors #22

Open tlaukkan opened 9 years ago

tlaukkan commented 9 years ago

Which would be good USB connected ZigBee controller devices to integrate to zigbee4java?

What are software design options to support multiple devices with completely different serial interfaces or another integration technology altogether considering current implementation approach?

d1g2w3 commented 9 years ago

Hi Tommi,

Proof of concept projects like integration with a home assistant (on github) type gateway.

Also a good idea having two serial devices that access the HA and Smart energy network.

A project I like the idea of is a media centre that changes the colour of lights depending on the most common colour of the video e.g. A horror film with red blood that changes the lights to red.

Maybe trying to integrate with xbmc.

Just a random idea that I thought would be cool

Kind regards,

Danny Watson On 25 Mar 2015 17:40, "Tommi S.E. Laukkanen" notifications@github.com wrote:

Which would be good USB connected ZigBee controller devices to integrate to zigbee4java?

What are software design options to support multiple devices with completely different serial interfaces or another integration technology all together considering current implementation approach?

— Reply to this email directly or view it on GitHub https://github.com/tlaukkan/zigbee4java/issues/22.

tlaukkan commented 9 years ago

Lets focus first on dongle hardware. If you have come across good ZigBee dongles which can act as controllers then please post a link here.

Best regards, Tommi

tlaukkan commented 9 years ago

XBee Explorer USB with XBee Pro ZB S2B Wire Antenna would be one interesting option at least.

Did NXP have ZigBee Pro dongle with serial interface, HA profile support and ability to act as controller?

d1g2w3 commented 9 years ago

Hi Tommi,

We do have an internal source for Zigbee pro stack device but it's just that, internal which means I can't release it.

We have another device but it has the ZCL on the device. If integration was to happen the ZCL from zigbee4java may have to be bypassed.

It is possible that the ZCL could be ignored and could be used just for a pro stack but I need to look at the serial code and it could be possible that some features are restricted (I'm not full sure yet)

I am planning to look at the application note tomorrow night when I get some time to myself.

A shim layer could be added to catch it before it goes into the java ZCL but then the device goes up a layer and becomes convoluted. It would also lead to inconsistencies between an NXP and TI device which would be awful.

Like I said I will look at this tomorrow and get more information.

Kind regards,

Danny Watson On 26 Mar 2015 18:14, "Tommi S.E. Laukkanen" notifications@github.com wrote:

XBee Explorer USB with XBee Pro ZB S2B Wire Antenna would be one interesting option at least.

Did NXP have ZigBee Pro dongle with serial interface, HA profile support and ability to act as controller?

— Reply to this email directly or view it on GitHub https://github.com/tlaukkan/zigbee4java/issues/22#issuecomment-86653237.

d1g2w3 commented 9 years ago

Hi,

So I have been looking into developing a ZigBee pro stack JN516x device. There's some work that needs doing to get it to a usable state.

I am going to work on doing that preparation tonight so I can then start adding the interface in Zigbee4java.

I'm going to be working on an in house release candidate for our next public release so I cannot release the source on github until the public release. I will be able to release the binary when compiled though. But at least there wouldn't be any porting activity when the release is out.

One step at a time though. I have to remove all ZCL serial protocol out of the current NXP application and add addition low level zigbee pro APIs to the serial protocol.

Let me know if you have any concerns or requests.

Kind regards,

Danny Watson On 26 Mar 2015 18:26, "danny watson" d1g2w3@gmail.com wrote:

Hi Tommi,

We do have an internal source for Zigbee pro stack device but it's just that, internal which means I can't release it.

We have another device but it has the ZCL on the device. If integration was to happen the ZCL from zigbee4java may have to be bypassed.

It is possible that the ZCL could be ignored and could be used just for a pro stack but I need to look at the serial code and it could be possible that some features are restricted (I'm not full sure yet)

I am planning to look at the application note tomorrow night when I get some time to myself.

A shim layer could be added to catch it before it goes into the java ZCL but then the device goes up a layer and becomes convoluted. It would also lead to inconsistencies between an NXP and TI device which would be awful.

Like I said I will look at this tomorrow and get more information.

Kind regards,

Danny Watson On 26 Mar 2015 18:14, "Tommi S.E. Laukkanen" notifications@github.com wrote:

XBee Explorer USB with XBee Pro ZB S2B Wire Antenna would be one interesting option at least.

Did NXP have ZigBee Pro dongle with serial interface, HA profile support and ability to act as controller?

— Reply to this email directly or view it on GitHub https://github.com/tlaukkan/zigbee4java/issues/22#issuecomment-86653237 .

d1g2w3 commented 9 years ago

Quick question. The ZDO classes, are they sending frames in spec format or are they just parameters passed to the TI device for the device to format into the ZDO spec. I'm just trying to work out if i can remove all the ZDO out of the NXP device and be a complete slave to any ZDO and ZCL frames?

presslab-us commented 9 years ago

Look at the Z-Stack Home file \Texas Instruments\Z-Stack Home xxx\Documents\API\Z-Stack Monitor and Test API.pdf. This shows the format that the ZDO classes use to send to the TI Coordinator over the "ZStack MT" protocol. From what I can see most everything is according to ZigBee spec but there are a couple things that are a little different here and there.

d1g2w3 commented 9 years ago

Great stuff, just installed and looked at the document.

Right i understand the big picture now.

zigbee4java.zigbee-api.src.main.java.org.bubblecloud.zigbee.network

will become

zigbee4java.zigbee-api.src.main.java.org.bubblecloud.zigbee.vendor.nxp and zigbee4java.zigbee-api.src.main.java.org.bubblecloud.zigbee.vendor.ti

Under vendor will be an interface class of all the override functions (changed from classes to functions) which will implement there vendor specific protocol.

On 27 March 2015 at 23:32, presslab-us notifications@github.com wrote:

Look at the Z-Stack Home file \Texas Instruments\Z-Stack Home xxx\Documents\API\Z-Stack Monitor and Test API.pdf. This shows the format that the ZDO classes use to send to the TI Coordinator over the "ZStack MT" protocol. From what I can see most everything is according to ZigBee spec but there are a couple things that are a little different here and there.

— Reply to this email directly or view it on GitHub https://github.com/tlaukkan/zigbee4java/issues/22#issuecomment-87120974.

mcous commented 9 years ago

Just stumbled across this repo and this issue, and I figured I mention the CEL MeshConnect ZigBee USB dongle. It uses a Silicon Labs EM357 and a SiLabs UART to USB chip under the hood.

I've been using it as a coordinator from a CLI written in C (and provided by SiLabs) but a Java interface would be really cool (not to mention useful for a certain Scala project I have at work).

cdealti commented 8 years ago

[1] https://github.com/digidotcom/XBeeJavaLibrary [2] http://ismb.github.io/jemma/ [3] http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m/w-series/ieee-802.15.4-packet-sniffer-usb-dongle-form-factor:USB-KW24D512

tlaukkan commented 8 years ago

One approach is to wrap the current implementation with generic ZigbeeAPI layer which would allow designing the lower layers freely when implementing support for other vendors.

cdjackson commented 8 years ago

Why wrap the API? My thought was to refactor lower down to make a clean interface to the lower layers. It's been a little while since I looked at this due to working on other things, but I started refactoring the network manager. I beleive that this should provide a good break?

60

tlaukkan commented 8 years ago

Hi

Certainly one ought to try to maximize code reuse. Wrapper could allow some maneuvering space under it whether one reaches high reuse of code or not. Both approaches work for me though.

Br, Tommi On 2 Apr 2016 16:04, "Chris Jackson" notifications@github.com wrote:

Why wrap the API? My thought was to refactor lower down to make a clean interface to the lower layers. It's been a little while since I looked at this due to working on other things, but I started refactoring the network manager. I beleive that this should provide a good break?

60 https://github.com/tlaukkan/zigbee4java/issues/60

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/tlaukkan/zigbee4java/issues/22#issuecomment-204713732

DuncanvR commented 8 years ago

Hi Tommi,

I noticed that the original ZB4OSGI project lists four supported dongles: the CC2531 that is listed as prerequisite for this project, plus three alternatives based on the CC2530. This eval kit is the cheapest of those, at $18.99, which is significantly less compared to the $49+$49 for the CC2531 dongle plus debugger. Would that CC2530 kit also work with zigbee4java?

Cheers, Duncan

cdjackson commented 8 years ago

You can find 2531 dongles a LOT cheaper than the TI version -:

http://www.gearbest.com/development-boards/pp_63979.html?currency=GBP&gclid=CjwKEAjw3fG4BRDsn9GAv7T2zEkSJACNJdjgdC2zMsV8i-UxeqOOuWPat5i6Jv0XpOP1WlSJZZehhhoCpezw_wcB http://www.gearbest.com/development-boards/pp_63979.html?currency=GBP&gclid=CjwKEAjw3fG4BRDsn9GAv7T2zEkSJACNJdjgdC2zMsV8i-UxeqOOuWPat5i6Jv0XpOP1WlSJZZehhhoCpezw_wcB

DuncanvR commented 8 years ago

@cdjackson wow, thanks! I guess I still need the debugger though, right?

cdjackson commented 8 years ago

Yes - I guess either way you need to program them :(

DuncanvR commented 8 years ago

@cdjackson you wouldn't happen to have a similar cheap address for those, would you? :)

cdjackson commented 8 years ago

Maybe…

I’m far from sure this will do the job, but it looks possible... http://www.ebay.co.uk/itm/Zigbee-Emulator-Debugger-Programmer-Support-CC1110-CC2430-CC2530-CC2540-CC2531-/331681023138?_trksid=p2141725.m3641.l6368 http://www.ebay.co.uk/itm/Zigbee-Emulator-Debugger-Programmer-Support-CC1110-CC2430-CC2530-CC2540-CC2531-/331681023138?_trksid=p2141725.m3641.l6368

And looking at this kind of indicates that it’s ok as well since I think it’s the same device in a box - it says RF04EB which is also mentioned in the TI programmer user manual… http://www.aliexpress.com/store/product/ZIGBEE-emulator-debugger-for-CC1110-CC2530-SmartRF04EB-enterprise-edition/224898_971586481.html http://www.aliexpress.com/store/product/ZIGBEE-emulator-debugger-for-CC1110-CC2530-SmartRF04EB-enterprise-edition/224898_971586481.html

Maybe a bit more of a search will convince you either way… Let me know as all in this lot costs about £15 or $20 which isn’t too bad...

cdjackson commented 8 years ago

Here’s another one that’s likely the same as I posted earlier, but it has more information (pinouts and mentions compatibility with the TI software). My guess is it’s ok, but don’t shoot me if you buy it and it’s not :)

http://www.ebay.com/itm/Zigbee-Emulator-Debugger-Programmer-Support-CC1110-CC2430-CC2530-CC2540-CC2531-C-/300964147673 http://www.ebay.com/itm/Zigbee-Emulator-Debugger-Programmer-Support-CC1110-CC2430-CC2530-CC2540-CC2531-C-/300964147673

cdjackson commented 8 years ago

Or this even... http://www.ebay.co.uk/itm/Bluetooth-Emulator-CC-Debugger-For-Zigbee-Support-2540-2541-2530-Protocol-SA-/391356091605?hash=item5b1ea40cd5:g:TEkAAOSwFqJWijJB

tlaukkan commented 8 years ago

Hi, there is now CommandInterface which is interface for sending and receiving ZNP commands. I am planning to mock it for unit tests. It could be also possible to create implementations for other types of hardware. This would require converting the command packets according to the requirements of the different hardware.

The message sequences for different types of hardware should be similar enough to tackle with pure message conversions. After converting the ZNP serial interface commands the rest should be straightforward as ZDO and ZCL commands are defined ZigBee specifications. The initialization phase may need some work on the sequence level.

tlaukkan commented 8 years ago

You can now implement support for other hardware by implementing ZigBeeDongle interface:

https://github.com/tlaukkan/zigbee4java/blob/master/zigbee-api/src/main/java/org/bubblecloud/zigbee/simple/ZigBeeDongle.java https://github.com/tlaukkan/zigbee4java/blob/master/zigbee-api/src/main/java/org/bubblecloud/zigbee/simple/ZigBeeNetwork.java

This is only supported with experimental SimpleZigBeeApi which is not tightly coupled with the old message serialization implementation:

https://github.com/tlaukkan/zigbee4java/blob/master/zigbee-api/src/main/java/org/bubblecloud/zigbee/simple/SimpleZigBeeApi.java