Looking for 3: Downstairs (EF:7E:86:D7:3C:6E)
Encoded value: (2, âBIQdAMZwSâ) not valid
Traceback (most recent call last):
File â/home/pi/ruuvitag-sensor/ruuvitag_sensor/decoder.pyâ, line 72, in decode_data
decoded = bytearray(base64.b64decode(encoded, â-_â))
File â/usr/lib/python3.5/base64.pyâ, line 81, in b64decode
s = _bytes_from_decode_data(s)
File â/usr/lib/python3.5/base64.pyâ, line 46, in _bytes_from_decode_data
"string, not %r" % s.class.name) from None
TypeError: argument should be a bytes-like object or ASCII string, not 'tupleâ
Data received: None
Traceback (most recent call last):
File â./ruuvitag-logger.pyâ, line 99, in
for sensor, value in data.items():
AttributeError: âNoneTypeâ object has no attribute âitemsâ
I think this might be the problem. convert_data function returns a tuple, which has data format type and data
Pass only data value from the tuple to decode function.
If there is still some problem, can you paste the failed part from your source code so it is easier to see where the problem might be. Although usually error message is already enough
Hi! Iâve noticed that when my Python code is executed from rc.local (i.e. at startup) the RuuviTagSensor.get_data_for_sensors() is fireing off new processes that are not terminated. I.e. each time RuuviTagSensor.get_data_for_sensors() is called hcitool lescan and hcidump are executed again. This memory leak fills up the RAM⊠From top I identified the processes and the looked up the pid:s.
pi@raspberry:~ $ ps 2188
PID TTY STAT TIME COMMAND
2188 ? S 0:00 hcitool lescan --duplicates
pi@raspberry:~ $ ps 2231
PID TTY STAT TIME COMMAND
2231 ? S 0:00 sudo -n hcidump --raw
Note: This does not happen when I execute my Python code on the command line using nohup, doesnât matter if the user is pi or root. Does anyone have any idea why, or has been able to reproduce it? I guess the error lies in: def stop(hcitool, hcidump):
in ble_communication.py but I have not looked further for now.
⊠just received my first three brand new RuuviTags!
Great library (!) - everythingâs working fine so far except that I am wondering how to check if a certain RuuviTag is present. I tried something like this:
from ruuvitag_sensor.ruuvitag import RuuviTag
sensor = RuuviTag('F3:61:D0:6E:2B:9C')
state = sensor.update()
if not state is None:
print('Temp = {0:0.1f}*C'.format(state["temperature"]))
If the RuuviTag is up and running everything is fine but if the device is switched off (or out of reach) the script does not terminate (seems that there is no timeout).
Sorry for this simple questions - I am pretty sure I have overseen something. I am using Python 3.6.0 on a Raspberry Pi Zero W.
Sorry for delay in approving the message, it got held in moderation queue for some reason. Please ping us at Slack if the automoderation gives you any further issues
from ruuvitag_sensor.ruuvi import RuuviTagSensor
mac = "F3:61:D0:6E:2B:9C"
data = RuuviTagSensor.get_data_for_sensors(mac, 5)
if mac in data:
print(data[mac])
else:
print("no data found")
Sorry for the late reply and thanks for bringing this up. Sometimes it is easy to forget to add some basic functionality when you donât need those on your own applications
Unfortunately the package doesnât provide any simple way to check if Tag is present and both checks that you have implemented are valid.
Maybe we could add these kind of helper functions to the package, so there is no need for everyone to figure these things out on their own. I created a new issue to GitHub: https://github.com/ttu/ruuvitag-sensor/issues/33. You can comment there or to this thread if you have some suggestions for other features.
ruuvitag-sensor package must use the development version of Bleson, so module needs to be installed from Blesonâs GitHub repostitory (therefore process-dependency-links is required)
Recently, I have get pi3 B+ model. Configured everything working fine. When I put my ruuvitag inside my freezer, sometime i can detect but most the time I canât get it. Apparently, I have another pi zero w, configure same thing, but without any issue. I can get sensor data all the time. Anyone experience this?
I have 2 ruuvitag
**I believed it could be the RPi3 B+ antenna limitation. I took the sd card move to pi zero w it work perfectly.
please forgive the naive question, but it would be an immense help if someone would advise whether or not it is possible to install this on a Pi that does not have internet access.
Could I point it at, or get the files off of another Pi in my environment that does have the package installed?
any ideas or help with direction at all would be greatly appreciated.
thanks
I can run it with Raspberry Pi Zeroâs crontab but I cannot start it with rc.local together with boot. I will get error with rc.local that ruuvitag_sensor not found.
How to fix this to have possibility to start these in boot?
Here is the status from rc.local after boot:
pi@raspberrypi:~ $ sudo systemctl status rc-local.service
Warning: The unit file, source configuration file or drop-ins of rc-local.service changed on disk. Run âsystemctl daemon-reloadâ to reload units.
â rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
Drop-In: /lib/systemd/system/rc-local.service.d
ââdebian.conf
/etc/systemd/system/rc-local.service.d
ââttyoutput.conf
Active: failed (Result: exit-code) since Fri 2020-09-11 05:59:38 BST; 54s ago
Docs: man:systemd-rc-local-generator(8)
Process: 474 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
Sep 11 05:59:38 raspberrypi systemd[1]: Starting /etc/rc.local CompatibilityâŠ
Sep 11 05:59:38 raspberrypi rc.local[474]: Traceback (most recent call last):
Sep 11 05:59:38 raspberrypi rc.local[474]: File â/home/pi/ruuvit.pyâ, line 1, in
Sep 11 05:59:38 raspberrypi rc.local[474]: from ruuvitag_sensor.ruuvi import RuuviTagSensor
Sep 11 05:59:38 raspberrypi rc.local[474]: ModuleNotFoundError: No module named âruuvitag_sensorâ
Sep 11 05:59:38 raspberrypi systemd[1]: rc-local.service: Control process exited, code=exited, status=1/FAILURE
Sep 11 05:59:38 raspberrypi systemd[1]: rc-local.service: Failed with result âexit-codeâ.
Sep 11 05:59:38 raspberrypi systemd[1]: Failed to start /etc/rc.local Compatibility.
I added cross-platform support with Bleak and a few asynchronous methods for it, get_data_async and get_fist_raw_data_async. Support for Python < 3.7 was dropped in ruuvitag_sensor package version 2.0.0, which now allows using async methods.
As this is not yet thoroughly tested or documented, Bleak is not automatically installed with the package and must be manually installed. Installation instructions are in README.
Bleak adapter has been tested with Windows 11, but not with macOS. I would appreciate if someone would have time to try it.
If this works well, this could replace the current default adapter, which uses deprecated hciconfig , hcitool and hcidump tools.