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

RSSI data missing with the Bleson adapter #233

Closed
sevesalm opened this issue Nov 25, 2023 · 4 comments
Closed

RSSI data missing with the Bleson adapter #233

sevesalm opened this issue Nov 25, 2023 · 4 comments
Labels

Comments

@sevesalm
Copy link
Contributor

sevesalm commented Nov 25, 2023

Describe the bug

When using the default BlueZ adapter, the RSSI level is included in the data. When using Bleson, the rssi property has the value None.

Simple sample code shows the issue.

import sys
import os

os.environ["RUUVI_BLE_ADAPTER"] = "bleson" # Remove this line to make RSSI appear in the data

from ruuvitag_sensor.ruuvi_rx import RuuviTagReactive
from reactivex import operators as ops

ruuvis = RuuviTagReactive(['TODO_MAC']) # Add your MAC here
ruuvi_emissions = ruuvis.get_subject()
sensor_data = ruuvi_emissions.pipe(
        ops.scan(lambda acc, x: acc | {x[0]: x[1]}, {}),
        ops.first()
        ).run()
ruuvis.stop()
print(sensor_data)
sys.exit()

Environment (please complete the following information):

  • OS: Debian GNU/Linux 11 (bullseye) on Raspberry Pi 3B+
  • ruuvitag_sensor package version: 2.3.0
  • RuuviTag firmware version: 3.31.1+default
  • Data format: 5
@sevesalm sevesalm added the bug label Nov 25, 2023
@ttu
Copy link
Owner

ttu commented Nov 27, 2023

Hi! I don't have a working Linux setup available at the moment and it seems that Bleson doesn't work with my macOS.

Could you enable debug logging and send me what data Bleson has in Advertisement which is logged here.

It is possible that RSSI should be added to our own payload same way as in Bleak-adapter.

@sevesalm
Copy link
Contributor Author

I think this is the correct data:

2023-11-30 20:38:11,756 DEBUG -                bleson.py: 26 - _run_get_data_background(): Data: Advertisement(flags=0x06, name='None', txpower=None, uuid16s=[], uuid128s=[], rssi=-50, mfg_data=b'\x99\x04\x05\x10vJ;\xc3\xa0\xff\xc4\xff\xfc\x03\xfc]\x96<t\x14\xc7\xdaE\xd2E\xbb')
2023-11-30 20:38:11,770 DEBUG -                bleson.py: 26 - _run_get_data_background(): Data: Advertisement(flags=0x06, name='Ruuvi 45BB', txpower=None, uuid16s=[], uuid128s=[UUID128('6e400001-b5a3-f393-e0a9-e50e24dcca9e')], rssi=-50, mfg_data=None)

So, the rssi seems to be there. When I have time, I'll see if I can find a way to extract that data.

@sevesalm
Copy link
Contributor Author

sevesalm commented Dec 2, 2023

I created a PR for this in #235 .

@sevesalm
Copy link
Contributor Author

sevesalm commented Dec 6, 2023

Closed by #235

@sevesalm sevesalm closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants