From 7f673c7fffc5d47752d9d5c6914a6eb35b6ad364 Mon Sep 17 00:00:00 2001 From: Oleksandr Kurbatov Date: Tue, 24 Dec 2019 17:44:35 +0200 Subject: [PATCH] add optional iface parameter to btle --- mikettle/mikettle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mikettle/mikettle.py b/mikettle/mikettle.py index 1465e7f..4d75a3b 100644 --- a/mikettle/mikettle.py +++ b/mikettle/mikettle.py @@ -55,7 +55,7 @@ class MiKettle(object): A class to control mi kettle device. """ - def __init__(self, mac, product_id, cache_timeout=600, retries=3, token=None): + def __init__(self, mac, product_id, cache_timeout=600, retries=3, iface=None, token=None): """ Initialize a Mi Kettle for the given MAC address. """ @@ -72,13 +72,14 @@ def __init__(self, mac, product_id, cache_timeout=600, retries=3, token=None): self.lock = Lock() self._product_id = product_id + self._iface = iface # Generate token if not supplied if token is None: token = MiKettle.generateRandomToken() self._token = token def connect(self): - self._p = Peripheral(self._mac) + self._p = Peripheral(deviceAddr=self._mac, iface=self._iface) self._p.setDelegate(self) def name(self):