Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check if async adapter in use in RuuviTagReactive #259

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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