-
Notifications
You must be signed in to change notification settings - Fork 30
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
ZHA sensor example #37
Comments
If all you need is to send some ZCL commands, If you need full support for a server to discover/enumerate the module, then you need to enable ZDO passthrough (set AO to 7) and handle all of the requests sent by the server. ZDO passthrough to MicroPython isn't supported in the currently released firmware, but it is going to be added in version 100A which is releasing at the end of April. Supporting server discovery will be possible in version 100A, but you'll need to parse and respond to all of the server's commands in MicroPython. An example of how to do this would be useful, as those commands can be hard to find documentation on. Hopefully we can get an example like that soon, once it's fully supported by the firmware. |
Hi, Zigbee2mqtt is just a coordinator, when a new device connects to the network it will send discovery requests and enumerate the endpoints, and then select from the list of supported devices (philips hue, xiaomi, ikea .. any of the usual manufacturers of zigbee enabled devices) how to use each endpoint depending on the announced model, id, vendor, description .. So basically yes, it needs to support server discovery. I didn't realize that wasn't currently possible, but that certainly explains why I haven't been able to make it work, I was wondering why xbee was answering requests on it's own regardless of the mode I was in. Glad to hear it'll be possible at the end of April ! For now I just have one sensor reading to publish so I'll just hardcode everything around it when that new firmware gets released and see how it goes. Examples would be amazing, it has been hard to find much about all of this online, thanks for your answer ! :) |
Thanks for the useful information. An example would be incredibly helpful. I'm currently working my way through the 869 page (!) ZCL spec, along with a bunch of forum threads with bits of information. My goal is to get a simple proof of concept working with an xbee3 and a couple sensors connected to it via I2C, and have it report/publish the sensor data to an existing ZHA network (Home Assistant, in my case). The second step will be to handle commands to switch stuff on and off. So far, I've got the sensors over I2C working in micropython, and I've managed to get the xbee3 connected to Home Assistant, in which the device is shown to have five sensors (analog_input) and 15 switches (on_off). I'm not sure what those all correspond to, however I'm trying to set it up to just report two sensors (and nothing else) right now: temperature and humidity. I gather that will require setting Any pointers on that last part (the micropython event handler) would be really appreciated! Edit: I’m also working through the Digi xbee API docs, though it’s not clear how everything fits together to implement a bridge between MicroPython and Zigbee. Edit 2: It looks like the Home Assistant representation of the xbee is due to the |
I found @Ulrar's StackOverflow post, which was very useful. In particular, the two links (Ulrar's and tomlogic's): The first is a nice introduction to the inner-workings of Zigbee, while the second has an implementation of ZCL that's far easier to follow than the ZCL spec. There are two directories which are especially relevant: include/zigbee and src/zigbee. I've begun sketching out a ZCL library for micropython based on that code, and later on I may extend it using the ZCL spec. One thing to note, though: a full python implementation may be too large to fit on the XBee in text form, so it'll likely have to be compiled to byte-code. Edit: It's not immediately clear to me how the library should be structured, so I'm starting on a proof of concept which should be informative for writing a more comprehensive library. That said, ZCL covers a lot of stuff, and we may not need a lot of it for small IoT projects. Edit 2: There's a followup blog post to the first link above: Both are absolute gold. It's clear to me that there needs to be an event handler, a configuration class to configure the event handler (perhaps programmatically, or maybe YAML, so one can reuse the Home Assistant device spec), and an umbrella class for specific tasks (announce, etc.). |
I was wondering if you'd made any progress on this at all to save some time having to go through something similar? As has been mentioned, a fully working ZHA example would really be a boost for those of us wanting to make end-devices for home automation. I have something cobbled together that work for me for my specific needs, but it isn't pretty and isn't using Zigbee ZCL with proper Cluster ID's and endpoints, as it should. |
I personally gave up, trying to get it to work in micropython I always ran
into space issues just trying to get basic ZCL implemented, not even
including the logic I actually want on top of it.
I ended up going with an esp chip over wifi, at least until someone comes
up with a way to fit enough of the ZCL on xbee.
…On Sun 9 May 2021, 20:59 Jonathan Michaelson, ***@***.***> wrote:
I was wondering if you'd made any progress on this at all to save some
time having to go through something similar?
As has been mentioned, a fully working ZHA example would really be a boost
for those of us wanting to make end-devices for home automation. I have
something cobbled together that work for me for my specific needs, but it
isn't pretty and isn't using Zigbee ZCL with proper Cluster ID's and
endpoints, as it should.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#37 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGVHTYGH7FYFVV3MWSFQ7TTM3STHANCNFSM4MGCSTNQ>
.
|
Funnily enough, once I started working on this I have also moved on to use the ESP32 with very low power options. It would, as you say, be a real advantage for home automation to be able to use the XBee3's to create small Zigbee projects that talk ZCL with HA hubs. |
I also gave up some time ago. There is not much support from Digi unlike the great support that you can find on other Zigbee platforms. |
A standard XBee ZHA quirk will give you access to XBee's internal ADCs. I doubt you can implement a whole new ZCL cluster but you can create a virtual template sensor just in HA on top of the standard quirk if your sensor is analog, no micropython needed. |
Hi Digi,
I've been trying to figure out how to use an xbee to publish data to an existing ZHA network coordinator for a few months now, but the doc doesn't really seem to have anything on that subject.
The digi forum hasn't helped unfortunately, before giving up and using some esp8266 instead, any chance to get an example of a simple ZHA sensor in this repo (or anywhere else) ?
I'm basically just trying to read load cells and send the reading to zigbee2mqtt / homeassistant.
While trying to figure it out myself I've had a few people get back to me because they wanted to do the same, so I think that'd be a very beneficial example, I'm not the only one failing at this.
Thanks !
The text was updated successfully, but these errors were encountered: