51 Commits
Author SHA1 Message Date
J. Nick Koston f47f49c9a1 Reduce overhead to check bluetooth logging (#92512) 2023-05-07 01:30:54 +02:00
epenet c01b1eb013 Adjust async_track_time_interval name argument (#90838)
Adjust async_track_time_interval naming
2023-04-05 10:58:02 -04:00
J. Nick Koston 02ef7d445d Allow passing an optional name to async_track_time_interval (#90244)
* Allow passing an optional name to async_track_time_interval

This is the same idea as passing a name to asyncio.create_task which
makes it easier to track down bugs

* more

* short

* still cannot find it

* add a few more

* test
2023-03-25 10:11:14 -04:00
J. Nick Koston 331102e592 Dismiss discoveries when the underlying device disappears (#88340)
* Implement discovery removals

Bluetooth, HomeKit, SSDP, and Zeroconf now implement
dismissing discoveries when the underlying discovered
device disappears

* cover

* add zeroconf test

* cover

* cover bluetooth

* fix rediscover
2023-02-17 15:51:19 -05:00
J. Nick Koston 34e2751f14 Retrigger Bluetooth discovery when calling async_rediscover_address (#87884)
* Retrigger Bluetooth discovery when calling async_rediscover_address

* Retrigger Bluetooth discovery when calling async_rediscover_address

* tweak
2023-02-11 16:59:51 +01:00
J. Nick Koston d0c7f42559 Fix Bluetooth discoveries missing between restarts (#86808)
* Fix Bluetooth discoveries missing between restarts

* do not load other integrations

* coverage
2023-01-27 22:16:16 -05:00
epenet 25c451832b Remove pragma: no cover when not raising (#86706) 2023-01-26 16:34:05 +01:00
Felix TandJ. Nick Koston 42a4dd98f1 Use fallback advertising interval for non-connectable Bluetooth devices (#85701)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-11 12:11:25 -10: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
Franck NijhofandJ. Nick Koston 487782a6d1 Code styling tweaks to Bluetooth (#85448)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-08 11:20:02 -10:00
J. Nick Koston 8c70e5aaad Try the next best adapter after a BLE connection fails (#84512)
* Try the next best adapter after a BLE connection fails

* add cover

* tweak

* tweak

* Update homeassistant/components/bluetooth/wrappers.py

* bump

* small tweak

* tweak logic
2022-12-23 20:48:47 -05: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
Franck NijhofandErik Montnemery b0cee0bc46 String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
J. Nick Koston bb3feceb57 Fix connectable Bluetooth devices not going available after scanner recovers (#84172) 2022-12-19 13:37:29 +01: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 a7caa038be Accept advertisements from alternate scanners when a scanner stops scanning (#82448) 2022-11-21 21:23:07 -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 682187541f Move BluetoothServiceInfoBleak to home_assistant_bluetooth (#82064) 2022-11-15 14:00:52 -06:00
J. Nick Koston 5b09ab93dc Immediately prefer advertisements from alternate sources when a scanner goes away (#81357) 2022-11-01 13:07:03 -04:00
J. Nick Koston 1589c06203 Significantly reduce clock_gettime syscalls on platforms with broken vdso (#81257) 2022-10-31 09:35:08 -04:00
J. Nick Koston 95d6859cb7 Log bluetooth advertisement before firing bleak callbacks (#80800)
The debug log was confusing because the bleak callbacks
were firing before we were logging the advertisements
2022-10-23 11:34:03 +02:00
J. Nick Koston 91c5aac8ba Add homekit notifications to the list of allowed apple bluetooth start bytes (#80733) 2022-10-21 13:54:02 -05:00
J. Nick Koston a708fc9984 Bump bleak-retry-connector to 2.3.1 (#80549) 2022-10-18 11:48:52 -05:00
J. Nick Koston f70f972d88 Fix connectable Bluetooth devices not being seen if the nearest scanner is non-connectable (#80388)
If we saw the non-connectable scanner advertisement first we would reject
the connectable scanner advertisement because it had worse signal strength.

In this case we need to check both
2022-10-17 21:13:26 -04:00
Joakim Plate 9eb4faf037 Fire bluetooth listener for all matching devices (#80440)
* Fire listener for all matching devices

* Add test case for seen device

* Avoid looping all data if we have address match

* Initialize to empty list
2022-10-16 21:49:12 +02:00
J. Nick Koston d12cbab6c4 Bump bleak to 0.19.0 (#80349) 2022-10-15 13:57:23 -04: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 c798723c27 Fix bluetooth diagnostics on macos (#79680)
* Fix bluetooth diagnostics on macos

The pyobjc objects cannot be pickled which cases dataclasses
asdict to raise an exception when trying to do the deepcopy

We now implement our own as_dict to avoid this problem

* add cover
2022-10-06 04:32:29 +02:00
Marc Mueller 4a432db611 Remove type ignore from bluetooth (#79146) 2022-09-28 10:29:55 +02:00
J. Nick Koston 75f6f9b5e2 Improve performance of Bluetooth device fallback (#79078) 2022-09-26 09:12:08 -04:00
J. Nick Koston 1b144c0e4d Update to bleak 0.18.0 (#79008) 2022-09-23 15:09:28 -10:00
J. Nick Koston 488b04fc8b Handle default RSSI values from bleak in bluetooth (#78908) 2022-09-21 17:03:50 -04:00
J. Nick Koston d4181aa911 Fix bluetooth callback matchers when only matching on connectable (#78687) 2022-09-18 10:22:54 -05:00
J. Nick Koston 18eef5da1f Restore history from bluetooth stack at startup (#78612) 2022-09-17 16:58:19 -05:00
J. Nick Koston 98dd84f535 Ensure bluetooth callbacks are only fired when advertisement data changes (#78609) 2022-09-17 10:26:02 +02:00
J. Nick Koston 085abc74ee Reduce overhead to update passive bluetooth devices (#78545) 2022-09-16 12:24:20 +02:00
Alex Thompson 45b69618d3 Add iBeacon start byte to allowed Apple Bluetooth advertisements (#78088) 2022-09-08 18:21:58 -05:00
J. Nick Koston 0e369d5b2e Add RSSI to the bluetooth debug log (#77860) 2022-09-06 09:54:52 +02:00
J. Nick Koston 804e4ab989 Prefilter noisy apple devices from bluetooth (#77808) 2022-09-04 20:57:40 -04:00
Jc2k 93a8aef4cc Fix async_all_discovered_devices(False) to return connectable and unconnectable devices (#77670) 2022-09-01 12:57:49 -04: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 a28aeeeca7 Hide bluetooth passive option if its not available on the host system (#77421)
* Hide bluetooth passive option if its not available

- We now have a way to determine in advance if passive
  scanning is supported by BlueZ

* drop string
2022-08-27 19:18:54 -04:00
J. Nick Koston 8e88e039f7 Add diagnostics to bluetooth (#77393) 2022-08-27 16:41:49 -05: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 3938015c93 Add support for scanners that do not provide connectable devices (#77132) 2022-08-22 14:02:26 -04:00
J. Nick Koston ced8278e32 Auto recover when the Bluetooth adapter stops responding (#77043) 2022-08-20 11:58:14 -10:00
J. Nick Koston cd59d3ab81 Add support for multiple Bluetooth adapters (#76963) 2022-08-18 21:41:07 -04:00
J. Nick Koston 071cae2c0b Implement auto switching when there are multiple bluetooth scanners (#76947) 2022-08-17 12:38:04 -10:00
J. Nick Koston 3bcc274dfa Rework bluetooth to support scans from multiple sources (#76900) 2022-08-17 10:51:56 -10:00