Ruuvitag integration to homeassistant (hass.io)

Hi,

Short intro: hass is home automation software for raspberry pi. It has a lot of functionality with bunch of stuff but ruuvitag reading was not implemented so I decided to do it myself.

Just got reading values from two weather station ruuvi beacons working.
Screenshot from hass ui (fought with sensors, that is why measurement data history is pretty patchy)

If someone has idea how things could be handled smarter than having one copy of python file per beacon and/or value that needs to be read I would be grateful.

Link to github:
https://github.com/peltsippi/ruuvi-hass

1 Like

Finally figured out how stuff should work.

Updated python script yesterday. Now there are 3 modes:

  • Batch - just put list of ruuvitag MACs and measurements from each are returned separated by :
  • Measurements from single ruuvitag, values are separated by :
  • Single measurement of single ruuvitag, define temp/pressure/humidity and only single value is returned

Added also configuration help to github for homeassistant. You need to get all the data with single command line execution in order to keep homeassistant environment happy. So you’ll add one sensor that includes all of the values and create a template which separates all the value to separate sensors.

ruuvipic
Don’t mind the readings, they are accurate only after 15:00 today when all started finally working well.

Disclaimer: there might be issues with homeassistant web ui. Probably full reboot of raspberry due to power outage might have something to do with it. Or then not. Don’t know.

2 Likes

Hello…the simplest solution is obviously just door sensors configured to send notifications when the doors are opened in the time window when they typically arrive home from school. However, that will trip unnecessarily if my wife arrives home in that time window on her days off and wouldn’t tell me if each individual child has arrived home, just that someone entered.

pcb assembly x-ray inspection

Thanks to other contributor I got ruuvitags detected through ha custom components. See https://github.com/JonasR-/ruuvi_hass

And please look my bug report that should describe way to fix the sensor for post 0.91 homeassistant.

1 Like

Do you plan to include the acceleration detection also at some point?

You must ask from the plugin author: https://github.com/JonasR-/ruuvi_hass

I personally have no need for it.

Ruuvitag lakkasi toimimasta Home Assistant 0.115 päivityksen jälkeen, Nyt 0.115.2.
Ruuvitag did not work after Home Assistant 0.115 updating.

Forgot to post here. Currently I am using ruuvi friends sensor from https://github.com/ruuvi-friends/ruuvi-hass.io

Edit: that approach has at least almost all possible sensors from ruuvitag covered and uses bleson which is worlds apart from previous approaches with its reliability.

I have python venv installation and installed dependencies manually.

Snips from my installation notes, newest one on top:

  • Add groups

  • Add rest of the sensors into configuration

  • Edit configuration and test if it works
    -> config error because of missing dependencies
    -> hope for the best and restart hass
    -> works god dammit on first try!

  • Git clone ruuvi hassio https://github.com/ruuvi-friends/ruuvi-hass.io -> Symlink to correct folder (ln -s ./ruuvi-hass.io/custom_components ./ in conf folder -> Fight with git -> settle so that syncing the symlink only works

  • Install bleson https://github.com/TheCellule/python-bleson -> Permissionerror (expected) -> Add bleson group [useless] -> Put homeassistant user there [useless] -> Which python3 [in venv] -> /srv/homeassistant/bin/python3 -> readlink -f /srv/homeassistant/bin/python3 -> /usr/bin/python3.8 -> sudo setcap cap_net_raw,cap_net_admin+eip add_path_here -> Aaand it works!

  • Install automatic start systemd stuff

  • Install python virtual environment homeassistant
    with dedicated homeassistant username etc…

  • Set specific fixed ip for nuc to router dhcp server

  • Install Ubuntu LTS Server to new old nuc

Oh it seems homeassistant core or similar has changed

ImportError: cannot import name ‘UNIT_PERCENTAGE’

So sensor.py needs to be modified. I’ll see if I get it patched myself tomorrow.

Modified couple rows and works for me now:

Edit: Just made pull request for the main branch also so it should update eventually also.

Hi,

just reinstalled hass.io, and this integration to clean installation. And now I get this error:
Platform error: sensor

Sitaatti
Platform error: sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config.py”, line 815, in async_process_component_config
platform = p_integration.get_platform(domain)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 401, in get_platform
cache[full_name] = importlib.import_module(
File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/ruuvi/sensor.py”, line 8, in
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE, PRESSURE_HPA
ImportError: cannot import name ‘UNIT_PERCENTAGE’ from ‘homeassistant.const’ (/usr/src/homeassistant/homeassistant/const.py)

Sitaatti

I’m really lost…

Where did you install the sensor.py from? If you use the version from my github branch, it should work. It seems that author has not yet accepted my pull request to official branch.

1 Like

Works like a charm… Thanks.

I installed it from main branch. And after it didn’t work, I found this thread. Your version works.

1 Like

Hi,

I used to have working raspberry Hass.io system with Ruuvitag add-on version 0.3.0. After Hass.io system update (now HassOS 4.14 and Supervisor 249) Ruuvitag add-on is not working anymore.

I request simple and precise instructions how to get Ruuvitags working again. Instructions in this thread are too complex for me…

Or is somewhere working add-on version for HassOs / raspberry system?

Hi Zuup. Have you tried https://github.com/balda/ruuvitag-discovery/ ? :wink:

Do you have a RPI3?

A temporary solution in the issue comments:

Downgrade to 4.13 helped.
Terminal command: ha os update --version=4.13
You can use Web UI of add-on “Terminal & SSH”

Fix is ready, so it will be ok with next release

Oh no…

Downgrading… it didn’t come to my mind. And yes system works again.

Yes I have RPi3 and I will try that one also https://github.com/balda/ruuvitag-discovery/

Thank you balda for your quick reply. :+1:

1 Like

@Zuup I tried the 4.15 and it works again :slight_smile:
Still not in update, so you can make a manual one:
ha os update --version=4.15

IMHO you should always wait before updating homeassistant if you are not able to immediately troubleshoot after installing the update. There can be major changes to configuration yaml logics also and similar during the updates.

They are moving really fast with the platform doing major updates and improvements all the time with small team. It means some things outside core stuff will break down occasionally for a while.