mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix lingering timer in usb (#91800)
This commit is contained in:
parent
609a7ccda8
commit
9665bc61f2
@ -205,11 +205,17 @@ class USBDiscovery:
|
|||||||
"""Set up USB Discovery."""
|
"""Set up USB Discovery."""
|
||||||
await self._async_start_monitor()
|
await self._async_start_monitor()
|
||||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, self.async_start)
|
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, self.async_start)
|
||||||
|
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
|
||||||
|
|
||||||
async def async_start(self, event: Event) -> None:
|
async def async_start(self, event: Event) -> None:
|
||||||
"""Start USB Discovery and run a manual scan."""
|
"""Start USB Discovery and run a manual scan."""
|
||||||
await self._async_scan_serial()
|
await self._async_scan_serial()
|
||||||
|
|
||||||
|
async def async_stop(self, event: Event) -> None:
|
||||||
|
"""Stop USB Discovery."""
|
||||||
|
if self._request_debouncer:
|
||||||
|
await self._request_debouncer.async_shutdown()
|
||||||
|
|
||||||
async def _async_start_monitor(self) -> None:
|
async def _async_start_monitor(self) -> None:
|
||||||
"""Start monitoring hardware with pyudev."""
|
"""Start monitoring hardware with pyudev."""
|
||||||
if not sys.platform.startswith("linux"):
|
if not sys.platform.startswith("linux"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user