-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Implement a polling fallback for USB monitor #130918
base: dev
Are you sure you want to change the base?
Conversation
Hey there @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Because of our supported environments, this would only be needed during development. Should we make that explicit to avoid a custom image without udev relying on this logic, while it's only intended for development. |
I've just realized that HA OS does not actually use udev itself! Supervisor calls In fact, I think the udev monitor is only used when you're running Core in a virtualenv, since it will not work on HA OS, Supervised, or Container due to the check for Docker! @bdraco You seem to be contributing most to the Should we whitelist non-Supervised container for pyudev monitoring? Or switch all non-Supervised platforms over to a 1s polling period? |
Proposed change
Background: I'm preparing to add a
usb.async_register_port_event_callback
callback that will allow for integrations to register themselves for USB events, namely USB device discovery and removal. This will allow the SkyConnect integration to unload itself when the SkyConnect becomes unplugged, without having to actually use the serial port.The current USB monitor does not work on macOS because it uses udev, which only runs on Linux. We instead can periodically call
_async_scan_serial
as a generic fallback solution for platforms that do not support udev properly.This is intended for development purposes so the 5s polling interval realistically could be reduced to 1s. The only real platform I can see affected by this is WSL, which I don't believe we support for running HA Core.
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: