diff --git a/workers/linakdesk.py b/workers/linakdesk.py index cd0849d..620a52f 100644 --- a/workers/linakdesk.py +++ b/workers/linakdesk.py @@ -18,7 +18,7 @@ class LinakdeskWorker(BaseWorker): return [MqttMessage(topic=self.format_topic('height/cm'), payload=self._get_height())] def _get_height(self): - with timeout(SCAN_TIMEOUT, exception=TimeoutError('Retrieving the height from {} device {} timed out after {} seconds'.format(repr(self), self.mac, SCAN_TIMEOUT))): + with timeout(self.SCAN_TIMEOUT, exception=TimeoutError('Retrieving the height from {} device {} timed out after {} seconds'.format(repr(self), self.mac, self.SCAN_TIMEOUT))): self.desk.read_dpg_data() return self.desk.current_height_with_offset.cm diff --git a/workers/miscale.py b/workers/miscale.py index 5d8c00a..c6e9258 100644 --- a/workers/miscale.py +++ b/workers/miscale.py @@ -22,9 +22,9 @@ class MiscaleWorker(BaseWorker): scan_processor = ScanProcessor(self.mac) scanner = btle.Scanner().withDelegate(scan_processor) - scanner.scan(SCAN_TIMEOUT, passive=True) + scanner.scan(self.SCAN_TIMEOUT, passive=True) - with timeout(SCAN_TIMEOUT, exception=TimeoutError('Retrieving the weight from {} device {} timed out after {} seconds'.format(repr(self), self.mac, SCAN_TIMEOUT))): + with timeout(self.SCAN_TIMEOUT, exception=TimeoutError('Retrieving the weight from {} device {} timed out after {} seconds'.format(repr(self), self.mac, self.SCAN_TIMEOUT))): while scan_processor.weight is None: time.sleep(1) return scan_processor.weight