fdbk_ruuvi_reporter
Getting started
Originally published in a Medium post.
Following steps assume that you have some RuuviTags transmitting data near the Raspberry Pi. The steps also require some Raspberry Pi, Unix, and AWS knowledge:
- Setup a Raspberry Pi with a fresh Rasbian, connect it to internet, change your password, and optionally enable SSH.
- Install required software dependencies on the Raspberry Pi:
sudo apt-get update
sudo apt-get install bluez-hcidump python3 python3-pip
sudo pip3 install fdbk_ruuvi_reporter fdbk_dynamodb_plugin
- Create AWS DynamoDB tables and a reporter user with CloudFormation template.
- Create Access key for the reporter user in AWS. Configure the access keys and region to the
~/.aws
directory on the Raspberry Pi. - On Raspberry Pi, create topics for your RuuviTags with
fdbk-ruuvi-reporter --create-topic ${name} ${mac} --db-connection fdbk_dynamodb_plugin
where${name}
is the name for your sensor and${mac}
is the MAC address of the RuuviTag. - Try to run the reporter with
fdbk-ruuvi-reporter -v -i 10 --db-connection fdbk_dynamodb_plugin
, where-v
is for verbose,-i 10
sets data push interval to ten seconds, and--db-connection fdbk_dynamodb_plugin
specifies database connection to be used, here DynamoDB. Check from the AWS console that data is being transmitted. - Configure fdbk-ruuvi-reporter to start on reboot with
crontab -e
. For example, to transmit data every 15 minutes with output directed to file/home/pi/.reporter-log.txt
, the crontab row would be:
@reboot /usr/local/bin/fdbk-ruuvi-reporter -v -i 900 --db-connection fdbk_dynamodb_plugin > /home/pi/.reporter-log.txt
- Reboot the Raspberry Pi and check from the AWS console that data is being transmitted.
To access the data via fdbk development server on your development computer: Install fdbk
and fdbk_dynamodb_plugin
. Configure AWS credentials with read access rights to both topics and data tables. Run fdbk-server
, which is provided by fdbk
package, with DynamoDB plugin as the DB connection: fdbk-server --db-connection fdbk_dynamodb_plugin
. Navigate to http://localhost:8080/overview to access overview of the data.
Development
Installation
Run:
pip install fdbk_ruuvi_reporter
to install from PyPI or download this repository and run
python setup.py install
to install from sources.
Testing
Check and automatically fix formatting with:
pycodestyle fdbk_ruuvi_reporter
autopep8 -aaar --in-place fdbk_ruuvi_reporter
Run static analysis with:
pylint -E --enable=invalid-name,unused-import,useless-object-inheritance fdbk_ruuvi_reporter
Run unit tests with command:
python3 -m unittest discover -s tst/
Get test coverage with commands:
coverage run --branch --source fdbk_ruuvi_reporter/ -m unittest discover -s tst/
coverage report -m