@@ -254,11 +254,10 @@ def all_temperatures_none(self):
254
254
class CometBlue :
255
255
"""CometBlue Thermostat """
256
256
257
- def __init__ (self , address , pin , device_getter = None ):
257
+ def __init__ (self , address , pin ):
258
258
super (CometBlue , self ).__init__ ()
259
259
self ._address = address
260
260
self ._device : BLEDevice | None = None
261
- self ._get_device = device_getter
262
261
self ._pin = pin
263
262
self .available = False
264
263
self ._handles = dict ()
@@ -274,8 +273,6 @@ def __init__(self, address, pin, device_getter=None):
274
273
self ._expected_disconnect = False
275
274
self .loop = asyncio .get_event_loop ()
276
275
# btle.Debugging = True
277
-
278
-
279
276
async def _ensure_connected (self ):
280
277
"""Ensure connection to device is established."""
281
278
if self ._connect_lock .locked ():
@@ -293,14 +290,11 @@ async def _ensure_connected(self):
293
290
return
294
291
_LOGGER .debug ("%s: Connecting; " , self ._address )
295
292
if self ._device is None :
296
- if self ._get_device is None :
293
+ self ._device = await BleakScanner .find_device_by_address (self ._address , 60.0 )
294
+ if self ._device is None :
297
295
self ._device = await BleakScanner .find_device_by_address (self ._address , 60.0 )
298
296
if self ._device is None :
299
297
raise Exception ("could not discover device" )
300
- else :
301
- self ._device = self ._get_device (self ._address )
302
- if self ._device is None :
303
- raise Exception ("could not discover device" )
304
298
305
299
client = await establish_connection (
306
300
BleakClientWithServiceCache ,
0 commit comments