-
Notifications
You must be signed in to change notification settings - Fork 2k
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
BTHome: New feature #20996
base: master
Are you sure you want to change the base?
BTHome: New feature #20996
Conversation
After talking to @BOZHENG001, I think the problem is that Skald is implementing an older BLE version than BTHome expects and thus fields (such as TXAdd which is used as part of the nonce for encryption) are not in the place Home Assistant expects them to be. Will try to confirm this somehow. |
adea8cd
to
5d6f27b
Compare
|
||
/* start advertising */ | ||
_sched_next(ctx); | ||
#if IS_USED(MODULE_SKALD_UPDATE_PKT_CB) | ||
event_loop(&ctx->queue); |
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.
What's the rationale for introducing an event queue here? This will prevent the skald_adv_start
function from returning, which should at least be documented somewhere for the user.
But I would rather call the user-provided callback within ISR context and shift thread-safety and the onus of having an event queue to the user side.
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.
instead of starting and running a queue exclusiv for skald a already exiting one might be used either given by parameter to skald_adv_start
or CONFIG_SKALD_QUEUE
or just depending on event_thread
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.
just depending on
event_thread
That'd sound more sensible to me. Also, I think this dependence would then only be needed for skald_bthome_saul
and not for skald_update_pkt_cb
.
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 think I just copied that behavior from the other skald “daemons” (that's what I see them as). I can have a look, if I find some time.
Contribution description
Little weekend (or rather Thursday and Friday night) project of mine. This extends Skald, who advertises to the world with BTHome, "an energy efficient but flexible BLE format for devices to broadcast their sensor data and button presses". The main use case is to integrate BLE-powered devices into Home Assistant.
Most of the spec is supported, except "Trigger based advertisements" (since Skald at the moment only advertises periodically). For encryption, I was able to confirm with the spec examples that at least from the generated output
is the expected one, given the example input, but Home Assistant is for some reason not able to decrypt the message (even the one in the examples)... So further investigation is needed.
TODOs:
Testing procedure
So far only tested by flashing a node and seeing the device pop-up in Home Assistant:
Issues/PRs references
None