From 24f8878d44845c2eedca45e43c225774137b721d Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 12 Feb 2024 21:36:47 +0100 Subject: [PATCH] More lint fixes --- RFXtrx/__init__.py | 4 +++- RFXtrx/lowlevel.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RFXtrx/__init__.py b/RFXtrx/__init__.py index 35c186b..ef536a2 100644 --- a/RFXtrx/__init__.py +++ b/RFXtrx/__init__.py @@ -1034,12 +1034,13 @@ def __init__(self, device, event_callback=None, self._sensors = {} self._status = None self._modes = modes + self._thread = threading.Thread(target=self._connect, daemon=True) self.event_callback = event_callback self.transport: RFXtrxTransport = transport_protocol(device) def connect(self, timeout=None): + """Connect to device.""" self.transport.connect(timeout) - self._thread = threading.Thread(target=self._connect, daemon=True) self._thread.start() if not self._run_event.wait(timeout): self.close_connection() @@ -1052,6 +1053,7 @@ def _connect(self): _LOGGER.info("Connection lost %s", exception) except Exception: _LOGGER.exception("Unexpected exception from transport") + raise finally: if self.event_callback and self._run_event.is_set(): self.event_callback(ConnectionLost()) diff --git a/RFXtrx/lowlevel.py b/RFXtrx/lowlevel.py index 0e91d45..6200e64 100644 --- a/RFXtrx/lowlevel.py +++ b/RFXtrx/lowlevel.py @@ -2278,7 +2278,7 @@ def load_receive(self, data): (data[10] << 8) + data[11]) self.prodwatthours = ((data[12] * pow(2, 24)) + (data[13] << 16) + (data[14] << 8) + data[15]) - self.tarif_num = (data[16] & 0x0f) + self.tarif_num = data[16] & 0x0f self.voltage = data[17] + 200 self.currentwatt = (data[18] << 8) + data[19] self.state_byte = data[20] @@ -2378,7 +2378,7 @@ def set_transmit(self, subtype, seqnbr, id1, id2, sound): self.id2 = id2 self.sound = sound self.rssi = 0 - self.rssi_byte = (self.rssi << 4) + self.rssi_byte = self.rssi << 4 self.data = bytearray([self.packetlength, self.packettype, self.subtype, self.seqnbr, self.id1, self.id2, self.sound,