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

Automatically generate device definitions #20173

Closed
wants to merge 2 commits into from
Closed

Automatically generate device definitions #20173

wants to merge 2 commits into from

Conversation

ffenix113
Copy link

@ffenix113 ffenix113 commented Dec 11, 2023

I am working on a project which is a mix between PTVO & ESPHome. It allows to create Zigbee firmware with custom set of sensors attached, based on yaml configuration.

To test it I need to add custom device to the Zigbee network and see if defined sensors work or not.
Unfortunately defining external convertor each time sensors change is not an option.

This MR introduces ability to generate device definition based on device reported clusters, which in turn allows to test custom/unsupported device without need to touch Zigbee2mqtt convertors.

I would like to know if the approach in this MR is something that possibly could be merged, and if yes - what (apart for tests 🙂 ) should be changed to merge it.

Add support for generating device definitions
for unknown devices.

Generated definition includes only "safe", generally known clusters.
@Koenkk
Copy link
Owner

Koenkk commented Dec 12, 2023

Hi @ffenix113!

I'm already preparing to add such feature. The first step here is the modernExtend. The idea is that findByDevice() always returns a definition even if not supported. You can help by extending the modernExtend with the types you need.

@ffenix113
Copy link
Author

Hello @Koenkk,

Amazing that there is already work on this being done. For sure I will jump on it, thank you!

Do you mind if I also change findByDevice signature: findDefinition(device: Zh.Device): Definition => findDefinition(device: Zh.Device, generateUnknown: boolean = false): Definition to conditionally allow generating definitions? And add a boolean flag to the settings of Z2M to set if generation should be enabled?

@Koenkk
Copy link
Owner

Koenkk commented Dec 13, 2023

This can be done unconditionally, the part that still needs to be worked out is how people can then "submit" these dynamically generated definitions such that they become officially supported (and listed on zigbee2mqtt.io)

@ffenix113 ffenix113 deleted the feature/basic-definition-generator branch December 13, 2023 19:58
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

Successfully merging this pull request may close these issues.

2 participants