shimmeringbee / zda

Adapter to convert ZCL frames and queries into Shimmering Bee abstractions, written in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic example of a Zigbee gateway

jamislike opened this issue · comments

commented

Hello, first of all, thank you for all your hard work in creating this open source project. I am looking for library to manage Zigbee devices and came across you zstack library however on reading other issues in the shimmeringbee project it seems this library may be better suited to my needs.

I was wondering if you have a basic example (similar to the code snippets in the zstack readme) of how to create and configure a gateway from this project, some things I have not figured out:

  • How to create a gateway
  • How to set the serial device path for the gateway
  • Where to register callbacks for join, leave and zcl messages

@jamislike i think you need to check https://github.com/shimmeringbee/zstack to register callbacks for messages. There are examples how to do it.
Also i used zstack lib for zcl to mqtt converter. You can check it here: https://github.com/supby/gigbee2mqtt

Hello @jamislike! Apologies for not seeing this earlier, I've been a bit ill and am getting ready to change job. So it's all a bit hectic.

zda is very much an abstraction designed to hide you away from Zigbee, this may or may not be a good thing depending on your use case. The shimmeringbee/zda implements a whole suite of interfaces defined by shimmeringbee/da.

If you want access to ZCL messages, and similar, then as @supby has said, zstack is the abstraction you want. da and zda very much exist for the controller project. It is not abandoned, but I have a lot of projects and only so much personal free time.

The APIs for da/zda are not stable, they will change over time as though the intent is that existing interfaces will be added to, rather than existing functions changed.

For an example of starting zda see this:
https://github.com/shimmeringbee/controller/blob/master/gateway_mgmt.go#L78

zda requires something that implements a standard set of zigbee calls, which in this case is zstack. zstack starts the network up, then zda listens to zstack events to provide the heigher level of abstraction.

However all said, you say "Where to register callbacks for join, leave and zcl messages" - you want zstack, not zda. Though it's not callback based, it's event based. You call ReadEvent on zstack and wait for a Join, Leave or IncommingMessage (ZCL) event.