Skip to content

Commit a1b0514

Browse files
committed
Fix Bluetooth support
1 parent 591f625 commit a1b0514

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

hass_win/__main__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ async def wrapper(hass, domain, config):
8080
return wrapper
8181

8282

83+
def wrap_bleak_winrt(func):
84+
def wrap(self, address_or_ble_device, **kwargs):
85+
kwargs.setdefault("winrt", {})
86+
return func(self, address_or_ble_device, **kwargs)
87+
88+
return wrap
89+
90+
8391
def fix_requirements(requirements: list):
8492
for req in requirements:
8593
req = req.split("==")[0].lower()
@@ -102,6 +110,17 @@ class Serial(protocol_socket.Serial):
102110

103111
protocol_socket.Serial = Serial
104112

113+
elif req == "bluetooth-adapters":
114+
import bluetooth_adapters
115+
from bluetooth_adapters import dbus
116+
117+
bluetooth_adapters.get_dbus_managed_objects = dbus.get_dbus_managed_objects
118+
119+
elif req == "bleak":
120+
from bleak.backends.winrt.client import BleakClientWinRT
121+
122+
BleakClientWinRT.__init__ = wrap_bleak_winrt(BleakClientWinRT.__init__)
123+
105124

106125
def wrap_after_pip(func):
107126
def wrapper(integration: Integration):

0 commit comments

Comments
 (0)