Skip to main content

Find RuuviTag sensor beacons and get data from selected sensor and decode data from eddystone url

Project description

Codeship Status for ttu/ruuvitag-sensor

RuuviTag Sensor is a Python library for communicating with RuuviTag BLE Sensor Beacon and for decoding sensord data from broadcasted eddystone-url.


  • RuuviTag with Weather Station firmware

  • Python 2.7 and 3

  • Linux

    • Package’s Windows and OSX supports are only for testing and url decoding

  • Bluez

    • sudo apt-get install bluez bluez-hcidump

  • Superuser rights

    • Package uses internally hciconf, hcitool and hcidump, which require superuser rights


Install latest released version

$ pip install ruuvitag_sensor

Install latest developement version

$ pip install git+
# Or clone this repository and install locally
$ pip install -e .


RuuviTag sensors can be identified using MAC addresses.

Find sensors

from ruuvitag_sensor.ruuvi import RuuviTagSensor

sensors = RuuviTagSensor.find_ruuvitags()
# Prints the mac address and the state of a sensor when it is found

Get data from sensor

from ruuvitag_sensor.ruuvi import RuuviTagSensor

sensor = RuuviTagSensor('AA:2C:6A:1E:59:3D')

# update state from the device
state = sensor.update()

# get latest state (does not get it from the device)
state = sensor.state


Parse data

from ruuvitag_sensor.ruuvi import RuuviTagSensor
from ruuvitag_sensor.url_decoder import UrlDecoder

full_data = '043E2A0201030157168974A5F41E0201060303AAFE1616AAFE10EE037275752E76692341412C3E672B49246AB9'
data = full_data[26:]

decoded = RuuviTagSensor.decode_data(data)

url_decoder = UrlDecoder()
sensor_data = url_decoder.get_data(decoded)


Command line

$ python ruuvitag_sensor -h

usage: ruuvitag_sensor [-h] [-g MAC_ADDRESS] [-f] [--version]

optional arguments:
  -h, --help            show this help message and exit
                        Get data
  -f, --find            Find broadcasting RuuviTags
  --version             show program's version number and exit


Tests use unittest.mock library, so Python 3.3. or newer is required.

Run with nosetests

$ pip install nose
$ nosetests

Run with setup

$ python test


Licensed under the MIT License.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (11.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page