Commit Graph

81 Commits

Author SHA1 Message Date
J. Nick Koston
1d833d3795 Avoid storing Bluetooth scanner in hass.data (#117074) 2024-05-08 16:08:12 -05:00
J. Nick Koston
c07f02534b Migrate bluetooth to use the singleton helper (#116629) 2024-05-02 19:35:16 -05:00
J. Nick Koston
6ccb165d8e Fix bluetooth adapter discovery delaying startup and shutdown (#116335) 2024-04-28 08:57:31 -05:00
J. Nick Koston
bb2bd086bc Add missing adapter data to Bluetooth config entry titles (#115930) 2024-04-23 21:52:55 +02:00
J. Nick Koston
1d6ae01baa Handle Bluetooth adapters in a crashed state (#115790)
* Skip bluetooth discovery for Bluetooth adapters in a crashed state

* fixes

* fixes

* adjust

* coverage

* coverage

* fix race
2024-04-18 15:06:53 -05:00
J. Nick Koston
fbdef7f5cd Bump habluetooth to 2.8.0 (#115789)
* Bump habluetooth to 2.8.0

Adds support for recovering some adapters that fail to initialize
due to kernel races

* bump lib

* tweak
2024-04-18 10:37:20 -04:00
J. Nick Koston
7a67304301 Bump habluetooth to 2.6.0 (#115724) 2024-04-17 09:41:42 -05:00
J. Nick Koston
ca5ed274cb Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
J. Nick Koston
5e8265d8a4 Add run_immediately to bluetooth listeners (#113659) 2024-03-16 19:03:14 -10:00
Marc Mueller
ff3a801936 Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
J. Nick Koston
3c25e2a4bd Small speed up to Bluetooth setup (#111677) 2024-02-27 12:43:44 -10:00
J. Nick Koston
b9b52b5e6d Reduce Bluetooth setup time (#111304) 2024-02-24 11:31:45 -10:00
J. Nick Koston
ff0e0b3e77 Convert debouncer async_shutdown to be a normal function (#111257)
* Convert debouncer async_shutdown to be a normal function

nothing was being awaited here and the shutdown call was only used
in integrations marked internal and other internals. Its possible
that a custom component might have been using the method but it
seemed uncommon enough that it did not warrent marking as a breaking
change. The update coordinator is no longer awaiting anything in
async_shutdown either now but it seemed likely that this use
would get subclassed.

* fix
2024-02-24 08:37:33 +01:00
J. Nick Koston
b60ca4260c Fix bluetooth manager stop missing callback decorator (#111232) 2024-02-23 12:58:55 -10:00
J. Nick Koston
e50fe79911 Update habluetooth to 2.0.0 (#106145) 2023-12-20 20:37:39 -10:00
J. Nick Koston
5dbd0dede1 Refactor Bluetooth scanners to avoid the need to pass a callback (#105607) 2023-12-13 09:17:48 +01:00
J. Nick Koston
f002a6a732 Refactor all Bluetooth scanners to inherit from BaseHaRemoteScanner (#105523) 2023-12-12 21:28:43 +01:00
J. Nick Koston
e890671192 Relocate Bluetooth manager to habluetooth library (#105110)
* Relocate Bluetooth manager to habluetooth library

* Relocate Bluetooth manager to habluetooth library

* Relocate Bluetooth manager to habluetooth library

* fixes

* fix patching time

* fix more tests

* fix more tests

* split

* Bump habluetooth to 0.7.0

changelog: https://github.com/Bluetooth-Devices/habluetooth/compare/v0.6.1...v0.7.0

This is the big change that will move the manager so the HA
PR that will follow this will be a bit larger than the rest of them
since the manager is connected to everything

* fix types

* fix types

* fix types

* fix patch targets

* fix flakey logbook tests (will need another PR)

* mock shutdown

* bump again

* value can be a float now

* Revert "value can be a float now"

This reverts commit b7e7127143.

* float
2023-12-11 15:42:00 -05:00
J. Nick Koston
3c635fdbf2 Split bluetooth manager so it can be extracted into the habluetooth lib (#105015) 2023-12-05 19:54:50 +01:00
J. Nick Koston
b6245c834d Move local bluetooth scanner code into habluetooth library (#104970) 2023-12-05 07:19:02 -10:00
J. Nick Koston
28584ad240 Relocate base Bluetooth scanner code into an external library (#104930) 2023-12-03 10:00:11 -10:00
J. Nick Koston
dd9c22672a Refactor bluetooth scanners for better seperation of concerns (#104909) 2023-12-02 13:20:06 -10:00
Jc2k
f0375eb97e Expose bluetooth availability tracking interval controls to integrations (#100774) 2023-09-24 10:45:25 +02:00
J. Nick Koston
56257b7a38 Restore passive bluetooth entity data at startup (#97462) 2023-08-06 20:25:18 -10:00
J. Nick Koston
2a5ffa9a5b Fix timestamps for bluetooth scanners that bundle advertisements (#94511)
#94138 added support for raw/bundled advertisements. We should use the
same monotonic time for all advertisements in the bundle if not time
is passed, or calculate the timestamp and pass it if its known
2023-06-14 21:47:00 -04:00
J. Nick Koston
17d1c0733d Remove outdated HAOS check from bluetooth (#93809) 2023-05-30 19:41:51 +02:00
Erik Montnemery
8053073a77 Add empty config schema to integrations a-c (#93608) 2023-05-29 14:38:33 -04:00
epenet
62d38b49bc Fix lingering timers in bluetooth (part 1) (#91673)
* Fix lingering timers in bluetooth (part 1)

* Use a local var
2023-04-20 18:07:38 +02:00
David Buezas
112b2c22f7 Expose async_scanner_devices_by_address from the bluetooth api (#83733)
Co-authored-by: J. Nick Koston <nick@koston.org>
fixes undefined
2023-01-08 14:06:32 -10:00
J. Nick Koston
070aa714a0 Switch to a different local Bluetooth adapter when one runs out of connection slots (#84331) 2022-12-23 08:58:33 -10:00
J. Nick Koston
9008006ac8 Restore remote discovered devices between remote scanner restarts (#83699) 2022-12-11 09:02:55 -10:00
J. Nick Koston
d6e287f47a Add manufacturer and model to bluetooth adapter device (#82769)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-11-27 15:44:44 -05:00
J. Nick Koston
a7caa038be Accept advertisements from alternate scanners when a scanner stops scanning (#82448) 2022-11-21 21:23:07 -05:00
J. Nick Koston
3f5649092e Break out bluetooth apis into api.py (#82416)
* Break out bluetooth apis into api.py

Like #82291 this is not a functional change.

* cleanups
2022-11-20 12:33:03 -05:00
J. Nick Koston
7801cd96de Split bluetooth models into base_scanner and wrappers (#82291) 2022-11-20 08:44:28 -06:00
J. Nick Koston
47c66dbed4 Offload platform specific bluetooth code to bluetooth-adapters (#82196)
* Offload platform specific bluetooth code to bluetooth-adapters

* adjust

* fix some more patch targets

* more test fixes

* almost there

* may not be setup yet

* more fixes

* fixes

* fix test

* fix merge
2022-11-17 14:34:19 -05:00
J. Nick Koston
f584efa0c2 Move bluetooth remote scanner implementation into a base class (#82012) 2022-11-13 14:18:36 -06:00
J. Nick Koston
89959e7cda Reduce complexity of bluetooth scanners for local adapters (#81940)
This is a small refactor to align the bluetooth scanner class
to the same design used in the esphome scanner to pass the
callback for new service infos in the constructor.

The original thinking was that multiple callbacks would
be needed to send the service infos to different paths,
however with the creation of a central manager, this
designed turned out to not be needed and can be
simplified
2022-11-11 14:59:06 +01:00
J. Nick Koston
78180b2ad8 Fix bluetooth adapters with missing firmware patch files not being discovered (#81926) 2022-11-10 14:14:37 -06:00
J. Nick Koston
0c76e3a97e Automatically determine the advertising interval for bluetooth devices (#79669) 2022-10-14 14:39:18 -04:00
J. Nick Koston
2768b2445a Remove call to deprecated bleak register_detection_callback (#79558) 2022-10-03 21:15:09 -04:00
J. Nick Koston
1b144c0e4d Update to bleak 0.18.0 (#79008) 2022-09-23 15:09:28 -10:00
J. Nick Koston
12856dea05 Create an issue when Bluetooth is active on old HAOS (#78430)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-09-19 21:02:13 -04:00
J. Nick Koston
18eef5da1f Restore history from bluetooth stack at startup (#78612) 2022-09-17 16:58:19 -05:00
J. Nick Koston
085abc74ee Reduce overhead to update passive bluetooth devices (#78545) 2022-09-16 12:24:20 +02:00
J. Nick Koston
40e8979951 Add bluetooth api to get the count of connectable and non-connectable scanners (#77427) 2022-08-29 10:21:30 -04:00
J. Nick Koston
61d5ed1dcf Index bluetooth matchers to resolve performance concerns with many adapters/remotes (#77372) 2022-08-26 23:07:51 -04:00
J. Nick Koston
d1486d04d9 Add support for bleak passive scanning on linux (#75542) 2022-08-24 12:17:28 -05:00
J. Nick Koston
c76dec138a Discover new bluetooth adapters when they are plugged in (#77006) 2022-08-22 15:45:08 -10:00
J. Nick Koston
3938015c93 Add support for scanners that do not provide connectable devices (#77132) 2022-08-22 14:02:26 -04:00