Skip to main content

PyPi Status

Harvest data from RuuviTag BLE Sensor Beacon with MicroPython Bluetooth enabled micro controller like the pycom devices.

micropython-ruuvitag supports Data Format 2, 3, 4 and 5.

This package comes with a scanner and a tracker. The scanner scans for RuuviTags in a pre defined time and return the result. The tracker continuously scans for RuuviTags and call a callback for each tag found.

Installation

The easiest way to install the package is via upip:

>>> import upip
>>> upip.install('micropython-ruuvitag')

For manual installation copy the ruuvitag directory with all files to your device lib directory.

Install with mpfshell

$ mpfshell ttyUSB0 -s install.mpf

Scanner

RuuviTagScanner scans for RuuviTags and decode the data format. The result is a list with named tuples.

Scan 10 seconds for RuuviTag sensors and print the result:

from ruuvitag.scanner import RuuviTagScanner

rts = RuuviTagScanner()

for ruuvitag in rts.find_ruuvitags(timeout=10):
    print(ruuvitag)

Tracker

RuuviTagTracker scans for RuuviTags, decode the data format and call a callback with a named tuple if recieved data from tag.

from ruuvitag.tracker import RuuviTagTracker

def cb(ruuvitag):
    print(ruuvitag)

rtt = RuuviTagTracker()
rtt.track_ruuvitags(cb)

Whitelist devices

You can collect data from only the devices you want by define a whitelist with mac addresses. Other Devices then will be ignored. Whitelists can be used with RuuviTagScanner and RuuviTagTracker.

whitelist = (b'aa:bb:cc:dd:ee:21', b'aa:bb:cc:dd:ee:42',)
rts = RuuviTagScanner(whitelist)

Blacklist persistence

If the data from a Bluetooth device can not be decoded, the device get on a blacklist as long the MicroPython device is not resetted. For a persistent device blacklist the list should be saved and reloaded.

>>> from ruuvitag import RuuviTagScanner
>>> rts = RuuviTagScanner()
>>> # add back blacklisted devices
>>> rts.blacklist = [b'aa:bb:cc:dd:ee:21', b'aa:bb:cc:dd:ee:42']
>>> # run a new scan
>>> rts.find_ruuvitags(timeout=10)
>>> # get blacklisted devices
>>> rts.blacklist

Named tuple formats

Data Format 2 and 4 (Eddystone-URL)

RuuviTagURL = namedtuple('RuuviTagURL', (
    'mac',
    'rssi',
    'format',
    'humidity',
    'temperature',
    'pressure',
    'id',
))

Data Format 3 (RAWv1) and 5 (RAWv2)

RuuviTagRAW = namedtuple('RuuviTagRAW', (
    'mac',
    'rssi',
    'format',
    'humidity',
    'temperature',
    'pressure',
    'acceleration_x',
    'acceleration_y',
    'acceleration_z',
    'battery_voltage',
    'power_info',
    'movement_counter',
    'measurement_sequence',
))

Metadata

Release files for micropython-ruuvitag 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micropython-ruuvitag 0.6.0
File Size Uploaded Provenance
micropython-ruuvitag-0.6.0.tar.gz 4.1 kB Without provenance Details

Release files / micropython-ruuvitag-0.6.0.tar.gz

Download URL micropython-ruuvitag-0.6.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
525ec6d71c47a1dba430b862973b61c25d559aa5e168eb1fd85d350405581336
BLAKE2b-256 checksum
How to use checksums
046f571cfbac3910317ebb474495e0f0ed9e09e3b893b1de83689b00f3a9e916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4

Security for micropython-ruuvitag 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page