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

Example minimum viable ZHA gateway file #183

Open
97Cweb opened this issue Aug 28, 2024 · 12 comments
Open

Example minimum viable ZHA gateway file #183

97Cweb opened this issue Aug 28, 2024 · 12 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@97Cweb
Copy link

97Cweb commented Aug 28, 2024

Good morning
I am trying to make my own zigbee network for a project I am working on. Due to this I need to have a gateway/router system. I have spent the better part of a day getting various zigbee libraries to load, only to end up here, at the one they all point to. I am hoping that I can make my project with this as the gateway, where I can send messages to a zigbee object through this.

THe issue I am facing is that there is no documentation and that the code, being so complex, is very difficult to parse.
So far, I have only managed the following, which does not work, as I dont have the config parameter, which I don't know how to populate

from zha.application.gateway import Gateway
zbgateway = Gateway()

Any help would be greatly appreciated
Thank you

@dmulcahey
Copy link
Contributor

Documentation is on my list to work on soon. For now you can reference the HA component that leverages the library to see how things work together.

This shows how to set up the gateway and initialize the devices
https://github.com/home-assistant/core/blob/af8131e68f95ebb33fdb9f0dbc826143fe323cab/homeassistant/components/zha/__init__.py#L126

This shows the structure of the config object needed to create the gateway.
https://github.com/home-assistant/core/blob/af8131e68f95ebb33fdb9f0dbc826143fe323cab/homeassistant/components/zha/helpers.py#L1178

The ZHA integration in HA is a lot less complex than the code in the lib is. Hopefully this helps a bit. I'll try to set up a small self contained example outside of HA soon for you.

@dmulcahey dmulcahey added documentation Improvements or additions to documentation question Further information is requested labels Aug 28, 2024
@97Cweb
Copy link
Author

97Cweb commented Aug 31, 2024 via email

@97Cweb
Copy link
Author

97Cweb commented Aug 31, 2024 via email

@TheJulianJES
Copy link
Contributor

You cannot attach files on GitHub via email by the way. You need to do that in the web UI.

@97Cweb
Copy link
Author

97Cweb commented Aug 31, 2024

gatewaytest.zip
sorry about that, here it is

@dmulcahey
Copy link
Contributor

you can also peek at this: https://github.com/zigpy/zha-websocket-server/blob/dev/zhaws/server/__main__.py and this: https://github.com/zigpy/zha-websocket-server/blob/dev/zhaws/server/websocket/server.py#L32

this is an older attempt before we has the ZHA lib. This will be updated at some point to leverage the ZHA lib.

@97Cweb
Copy link
Author

97Cweb commented Sep 11, 2024 via email

@dmulcahey
Copy link
Contributor

I guess help me understand what you are trying to accomplish? This project handles a bunch of what you are asking about…. If you want to see how you would interact with the objects provided by the lib you can peek at the ZHA integration in HA: https://github.com/home-assistant/core/tree/dev/homeassistant/components/zha

If you could explain what you are attempting to do I may be able to provide better assistance.

documentation is nearly non existent at the moment. We’ll get to it at some point as time allows 😬

@97Cweb
Copy link
Author

97Cweb commented Sep 11, 2024 via email

@prairiesnpr
Copy link
Contributor

I don't think this is the appropriate library for the application you speak of. This is focused on Zigbee Home Automation, so devices like switches, lights, thermostats, etc. You honestly probably want something like the Digi Xbee platform, assuming you are set on Zigbee, where it will take care of the Zigbee side of things, and you can send serial packets back and forth. Adding all the complexity of the ZCL is going to be frustrating for such a simple application.

@97Cweb
Copy link
Author

97Cweb commented Sep 11, 2024 via email

@prairiesnpr
Copy link
Contributor

The other option would be to just use Home Assistant, we don't know what hardware you have, but if you can build an end device on it, then you would only have to worry about the train side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants