Skip to content

Commit c5f0a86

Browse files
committed
Try to be more careful with imports
1 parent e1b7c8f commit c5f0a86

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tion/s3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
_LOGGER = logging.getLogger(__name__)
1313

14+
1415
class s3(tion):
1516
uuid = "6e400001-b5a3-f393-e0a9-e50e24dcca9e"
1617
uuid_write = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"
@@ -29,14 +30,13 @@ class s3(tion):
2930
command_SET_PARAMS = 2
3031

3132
def __init__(self, mac: str):
32-
self._btle = btle.Peripheral(None)
33-
self._mac = mac
33+
super().__init__(mac)
3434

3535
def __try_get_state(self) -> bytearray:
3636
return self._btle.getServiceByUUID(self.uuid).getCharacteristics()[0].read()
3737

3838
def pair(self):
39-
def get_pair_command(self) -> bytearray:
39+
def get_pair_command() -> bytearray:
4040
return self.create_command(self.command_PAIR)
4141

4242
self._btle.connect(self.mac, btle.ADDR_TYPE_RANDOM)

tion/tion.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
import logging
33
from typing import Callable
44

5+
from bluepy import btle
6+
57
_LOGGER = logging.getLogger(__name__)
68

9+
710
class TionException(Exception):
811
def __init__(self, expression, message):
912
self.expression = expression
@@ -17,6 +20,7 @@ class tion:
1720

1821
def __init__(self, mac: str):
1922
self._mac = mac
23+
self._btle: btle.Peripheral = btle.Peripheral(None)
2024

2125
@abc.abstractmethod
2226
def _send_request(self, request: bytearray) -> bytearray:

0 commit comments

Comments
 (0)