-
-
Notifications
You must be signed in to change notification settings - Fork 33.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
Reload the ZBT-1 integration on USB state changes #141287
Reload the ZBT-1 integration on USB state changes #141287
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
82bb632
to
8628f3c
Compare
8628f3c
to
84939cc
Compare
Thanks @puddly |
* Reload the config entry when the ZBT-1 is unplugged * Register the USB event handler globally to react better to re-plugs * Fix existing unit tests * Add an empty `CONFIG_SCHEMA` * Add a unit test * Fix unit tests * Fix unit tests for Linux * Address most review comments * Address remaining review comments
Proposed change
All other integrations that communicate with USB devices rely on USB serial communication to be interrupted in order for them to enter a failure state. The ZBT-1 integration does not have the capability to do this, unfortunately, because it does not communicate with any hardware by default.
To replicate this behavior and have the hardware integration match the state of the device, we subscribe to USB events directly from the
usb
integration and reload the ZBT-1 config entry, failing if the serial port is missing. This allows fast reactivity:Screen.Recording.2025-03-24.at.10.13.55.AM.mp4
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: