-
Notifications
You must be signed in to change notification settings - Fork 151
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
Zigbee improvements #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @oleo65 that's fantastic. Thank you! I was looking forward to discuss this PR with someone. I've made some comments mostly about naming. Looking forward to your thoughts.
BTW out of curiosity, did you manage to test this with either Zigbee2MQTT or something else?
endif # BOARD_BPARASITE_NRF52840 | ||
|
||
config CORE_LOG_LEVEL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👌. I'd suggest PRSTLIB_DEFAULT_LOG_LEVEL
to be more descriptive. Do you know if we can set the default to one of the enum values? E.g.: LOG_LEVEL_WRN
. Looking at 2 I'm not sure what the default is. If not, I'd leave a comment that 2 corresponds to WRN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also wondering where this config should live. It seems less of property of each board and more of a property of the project that uses the different boards.
What do you think of moving these to the project's Kconfig
? And I'm not sure how, but it would be great if there's an easy way to provide a default for prstlib
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about the enum values but would guess not because the Kconfig is resolved first before any C code is compiled. But I did not research this further...
I thought about the config hierarchy and did not come up with a nice solution without duplicating code, since there is no real common ancestor in the device tree. I don't know if it is maybe possible to have more than one ancestor (like a mixin) and maybe have a common b-parasite
mixin with common configuration flags for both MCU variants. I would really like that as it might help to reduce configuration errors and feature drifts...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick test:
config PRSTLIB_DEFAULT_LOG_LEVEL
int "Default log level for prstlib"
default LOG_LEVEL_INF
And unfortunately that doesn't work :( (LOG_LEVEL_INF
is undefined at this point). It seems like Zephyr implements the following strategy for subsystem logging:
Each subsystem defines their own choices. I'm not sure if this is overkill for us, but it would perfect if we could just add a Kconfig
file to prstlib
and do it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the naming of the config flag as discussed.
+1 The same core application for Zigbee should in theory be reusable for Matter standard over Thread (Project CHIP), see -> #87 |
@rbaron I set the sensor up via nativ Home Assistant ZHA integration. as all my other devices. It basically worked straight out of the box. If you already run a Zigbee2MQTT gateway, that might also be a valid solution, but I like to keep my setup simpler without relying on an additional (MQTT) component. I got away with it so far... 😉 As for the naming of variables etc. I am quite torn in half. To me it felt almost all the time redundant to name something with I am fine to rename any variables in this pull request so that it complies with the rest of the project to move this forward. But I would love to start a general refactoring branch with more separations of concerns within the different code files to make it easier for new people (including me) to comprehend which code part does what. 😃 |
I am pretty sure that I will eventually move to Matter over Thread. And I am happy that all the improvements to zigbee and the move to zephyr pay directly towards a Matter/Thread implementation. At the moment I simply do not have the infrastructure to test any of this myself... |
Agreed, naming is subjective and personal and I also like it as simple and short as possible, but no simpler. I think even in our simple setup there's already room for confusion: does |
Removed specific Kconfig values from prj*.conf files.
I pushed changes with the discussed config namings and some slight improvements to the power cluster. This should resolve the discussions. I did not change the |
LGTM. Let me know if you have any thoughts on the conversation I just unresolved:
Also okay to merge as is and I'll try some ideas. Tks! |
For the latter: 2 equals WRN. I found the values in the docstring of the zephyr library and I will add a comment to the config value and a reference where to find more. 😉 The problem with the location of the prstlib log flag is tricky. If you put it within the sample Kconfig and reference it in the common prstlib, you need to "duplicate" the value in all samples (ble, blinky, etc.) otherwise they won't compile. We can definately do that but it feels also clunky to me. Edit: I might have found a specific solution via the |
Moved prst lib log level config to application layer with prst lib default fallback behaviour.
I think that's better, thanks. I will take a stab at setting up a proper Tks once again! |
I contributed to a zigbee firmware fork in the past and tried to migrate some concepts / bugfixes I experienced there. I personally really like the idea here, that the core libraries are reused no matter what protocol stack is used. This seems to me the right approach and I am happy to push the zigbee firmware forward.
In the long run, I believe even more configuration could be centralized. The Zephyr configuration system is quite powerful. Let me know what you think. 😃