Skip to content

Commit

Permalink
fix: check if async adapter in use in RuuviTagReactive
Browse files Browse the repository at this point in the history
  • Loading branch information
ttu committed Nov 21, 2024
1 parent cc8e811 commit 09fbac9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* ADD: Install Bleak automatically on all platforms
* CHANGE: Async Bleak adapter as default adapter on all platforms
* CHANGE: Support only Python 3.9 and above
* FIX: Check if async adapter in use in RuuviTagReactive

## [2.3.1] - 2024-03-10
* ADD: Bluez as option to RUUVI_BLE_ADAPTER environment variable
Expand Down
6 changes: 3 additions & 3 deletions ruuvitag_sensor/ruuvi_rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from reactivex import Subject

from ruuvitag_sensor.adapters import is_async_from_env
from ruuvitag_sensor.ruuvi import RunFlag, RuuviTagSensor
from ruuvitag_sensor.adapters import is_async_adapter
from ruuvitag_sensor.ruuvi import RunFlag, RuuviTagSensor, ble


async def _run_get_data_background_async(macs: List[str], queue: Queue, shared_data: DictProxy, bt_device: str):
Expand Down Expand Up @@ -86,7 +86,7 @@ def __init__(self, macs: List[str] = [], bt_device: str = ""):

# Start background process

if is_async_from_env():
if is_async_adapter(ble):
loop = asyncio.get_event_loop()
loop.create_task(_run_get_data_background_async(macs, q, self._shared_data, bt_device))
else:
Expand Down

0 comments on commit 09fbac9

Please sign in to comment.