RuuviTags on Home Assistant


#1

I’m trying to add ruuvitags to my Home Assistant with Rpi3.

I installed Hassbian, then used this guide: https://github.com/ttu/ruuvitag-sensor

But when I run: python ruuvitag_sensor -h
I get following error:
python: can’t open file ‘ruuvitag_sensor’: [Errno 2] No such file or directory

What’s the problem?


#2

Runnable examples are in the example folder, have you tried them?


#3

Where is the examples folder?

I cannot find it under /home/homeassistant/


#4

The examples are within the repository, did you clone it?

If you “only” installed the ruuvitag-sensor from pip you have access to the code within your python program after

from ruuvitag_sensor.ruuvitag import RuuviTag

but you can’t access the examples from the command line. To use the examples from command line you need to clone the repository and run the examples there. The examples might also get installed somewhere under /usr/, but I wouldn’t know the exact path to them


#5

I’ve got it to work now. I’m trying to use MQTT to send ruuvitag data to my Home Assistant as my HA runs on different system.

I have installed: https://github.com/ppetru/ruuvi2mqtt
It only shows:

pi@raspberrypi:~/ruuvi2mqtt $ sudo systemctl status ruuvi2mqtt.service
● ruuvi2mqtt.service - RuuviTag -> MQTT bridge
Loaded: loaded (/etc/systemd/system/ruuvi2mqtt.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-01-09 20:24:26 GMT; 9min ago
Docs: https://github.com/ppetru/ruuvi2mqtt
Main PID: 299 (start.sh)
CGroup: /system.slice/ruuvi2mqtt.service
├─299 /bin/bash /home/pi/ruuvi2mqtt/start.sh
└─350 node index.js

Jan 09 20:24:26 raspberrypi systemd[1]: Started RuuviTag -> MQTT bridge.
Jan 09 20:24:26 raspberrypi ruuvi2mqtt[299]: setterm: $TERM is not defined.
Jan 09 20:24:26 raspberrypi sudo[323]: pi : TTY=unknown ; PWD=/home/pi/ruuvi2mqtt ; USER=root ; COMMAND=/sbin/setcap cap_net_raw+eip /usr/bin/node
Jan 09 20:24:26 raspberrypi sudo[323]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 09 20:24:26 raspberrypi sudo[323]: pam_unix(sudo:session): session closed for user root
Jan 09 20:24:30 raspberrypi ruuvi2mqtt[299]: Config loaded
Jan 09 20:24:31 raspberrypi ruuvi2mqtt[299]: Connecting…
Jan 09 20:24:36 raspberrypi ruuvi2mqtt[299]: Connected
pi@raspberrypi:~/ruuvi2mqtt $

I think that it’s not scanning ruuvitags properly. I can use these commands to see ruuvitags:

pi@raspberrypi:~/ruuvi2mqtt $ alias ruuvitag=‘python3 ~/.local/lib/python3.5/site-packages/ruuvitag_sensor’
pi@raspberrypi:~/ruuvi2mqtt $ ruuvitag -f
Finding RuuviTags. Stop with Ctrl+C.
Start receiving broadcasts (device hci0)
F7:9C:3E:F8:77:10
{‘pressure’: 1004.49, ‘humidity’: 25.0, ‘battery’: 2983, ‘temperature’: 22.12, ‘acceleration_x’: -18, ‘acceleration_z’: 1033, ‘acceleration’: 1033.4592396413127, ‘acceleration_y’: 25}
E5:E8:DA:24:0D:E3
{‘pressure’: 994.37, ‘humidity’: 82.5, ‘battery’: 2941, ‘temperature’: -7.02, ‘acceleration_x’: 9, ‘acceleration_z’: -1020, ‘acceleration’: 1020.216643659571, ‘acceleration_y’: 19}