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

Support for other sensors #17

Open
lucaci32u4 opened this issue Jan 29, 2024 · 3 comments
Open

Support for other sensors #17

lucaci32u4 opened this issue Jan 29, 2024 · 3 comments

Comments

@lucaci32u4
Copy link

lucaci32u4 commented Jan 29, 2024

Hi,
I find your project really useful for building custom home automation on zigbee.

I'd like to contribute by implementing more sensor/actuator support. I'm especially interested in rotary encoders as sensors and light outputs. I suppose interrupt support for encoders would be useful, but will this break any other parts of the application?

Any pointers where I should start to look to implement these?

@Hedda
Copy link

Hedda commented Jan 30, 2024

@ffenix113
Copy link
Owner

ffenix113 commented Jan 30, 2024

Hello,
Thank you for the question and interest in this project!

For now adding new sensors could fall into one of two categories based on the fact if the sensor is supported(or otherwise has drivers) for Zephyr:

  • If it is supported - it could be as simple as adding a sensor definition and its configuration. For example as in Bosch BME280 sensor. It needs to define available clusters, KConfig options(if any), and devicetree definition.
  • If it is NOT supported - it can be a quite a bit more complex:
    • If some open-source drivers are available - they can be added to this repo as a Zephyr module and then used as in point one. Example of commit adding a module can be found here.
    • If drivers are not available - probably the simpler option would be to write implementation in the template definition for sensor, like in this file, for example. It uses Zephyr sensor API, but it is not limited to only use it.

In both cases the sensor should also have Zigbee cluster(s) defined, and that could also be something that should be implemented, if necessary cluster is not yet available.

I will add a section on support for new sensors and will update this issue to add a link to it.

Could sensor components be ported from ESPHome?

Not directly, at least. ESPHome uses C++, while currently this project is C. I also have plans to switch to C++ for zigbee_home, but have higher priorities for now.
I think that with some compatibility layer from ESPHome it should be doable otherwise.

@ffenix113
Copy link
Owner

For near future this will be the doc on supporting new sensors: https://ffenix113.github.io/zigbee_home/sensors/supporting_new_sensors/

It is not complete, as I want to try and describe as much as possible related to supporting sensors, so keep an eye on updates.

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

No branches or pull requests

3 participants