Ruuvi sensors -> Ruuvi Gateway -> Home Assistant (Easy!)

Hey everyone!

Let’s discuss about easy to use Ruuvi integration on Home Assistant (and Home Assistant Core).

If you’re not yet familiar with the HA, these videos help to understand the concept:

See also a HA demo in action:

HA is continuously getting better and bigger and recently it has made sense to separate the open source core and the complete out of the box installation that’s set up requires as little knowledge as possible. These are the main differences between HA and HA Core:

“Home Assistant Core is a Python program, in simple words. It can be run on various operating systems and provide the ability to track, control and automate your devices. When people talking about Home Assistant Core they usually refer to a standalone installation method.”

Home Assistant is a combination of Home Assistant Core and tools which allows one to run it easily on a Raspberry Pi and other platforms without setting up an operating system first. Home Assistant is an all-in one-solution and has a management user interface that can be used from the Home Assistant frontend. This interface is not present in a Home Assistant Core setup. Be aware that add-ons are only available in regular Home Assistant installations.”

HA has several add-ons that make it convenient to build different kinds of integrations that would work easily on the HA.

These are the official add-ons maintained by the HA team:

It’s worth to notice that “Add-ons are only available if you’ve used the Home Assistant installer. If you installed Home Assistant using any other method then you cannot use add-ons (but you can achieve the same result manually).”

Additionally, there are many HA Community Add-ons available:

Then, there are more than 1700 integrations available (but no Ruuvi):

As far as I know, the project started by @sergioisidorois the most complete set up right now. It listens Ruuvi broadcasts using computer’s (for example Raspberry Pi) Bluetooth connectivity, and that has some problems. Not so easy to set up, range is not really good and message reception is not always reliable.

What we’d like to offer Ruuvi and Home Assistant users with help of Ruuvi Gateway, is easy and quick way to set up and use Ruuvi sensors on the Home Assistant and Home Assistant Core.

Don’t get me wrong, it’s not a bad thing to support also other Bluetooth receivers, but because they tend to have issues, Ruuvi Gateway can definitely make things much easier and more reliable as it’s actually designed to do the job (to receive Bluetooth broadcasts) in the first place.

So, let’s get this project started, shall we? :sunglasses:

Tagging here @sergioisidoro @io53 @peltsippi @Scrin @ojousima @henri @Nerdaxic


An official Ruuvi integration in Home Assistant would be awesome!

You can also give a try to :wink:
There’s a post in the forum about the add-on: RuuviTag Discovery: web interface to see and send measures (MQTT, databases, Home Assistant)

It would be a pleasure to help the development of the integration :slight_smile:

1 Like

Can ruuvi gateway run influxdb database? If yes, all you need is to have homeassistant running in same network and configuring influxdb sensor to homeassistant.

I am not sure how the user experience is with hassio. But some kind of auto-discover implementation for ruuvi gateway might make configuration at least almost plug and play:

Home Assistant auto discovery works with MQTT. So, if Ruuvi Gateway implement a MQTT broker, it should be possible to use it :slight_smile:

I explained here how HA use “Devices” (Ruuvi Tags) and “Entities” (measures of tags):

And here is my implementation of the auto discovery (presentation of the “Device” on /config topic and broadcast measures on /state and /attributes topics):

1 Like

This will be great! Even for us that already have ruuvitag data in homeassistant, this will give far better range than a normal bluetooth dongle/rpi and take a way the hassle that bluetooth dongles can bring :slight_smile:

I guess the easiest way to get this going would be to have the gateway expose and API from where a Ruuvi integration could be polling data, or even better, subscribe to data to get it in real-time :thinking:

There is actually already a /metrics http endpoint for monitoring the gateway health and status programmatically. This same metrics endpoint could perhaps include the tag readings as well for a simple “pull based” integration. This would also allow Prometheus to scrape the tag readings at the same time, offering yet another way to get Ruuvitag data to Grafana.

On the other hand, a more “real-time” integration would be a “push based” integration, easiest probably being with MQTT, which the gateway already uses/supports.

Perhaps this “official ruuvi integration” could even support both modes; the pull-based for the most simple setup, only configuration needed would be giving the gateway address (or perhaps even some sort of auto discovery could work?), and the push-based for more advanced users who already have a MQTT broker or specifically need faster “response times”.

That sounds like a good way to go about it. With the way home assistant store data it does not even make sense to store all sensor data, so polling at n interval will be preferred in most cases anyway.

I agree that for real time data MQTT is probably the best way to go. That would not even need any special ruuvi integration or setup (at least not if the gateway supports mqtt auto discovery). If we where to push data via HA’s rest or websocket api there would have to be extra setup so might as well spin up a mqtt broker at that point.

I implemented a merge between few MQTT projects that had not been implemented to support Ruuvi -> raspberry -> MQTT -> Homeassistant with autodiscovery:


The installation instructions and code available here:

So if you are running Homeassistant at server that doesn’t have bluetooth, it means that you need to push it to another format through network. MQTT works very nicely, as it is very efficient packet format. Also autodiscovery means that you don’t need to configure the sensor at homeassistant at all after installation.


Is there away to name tags? Now they show up in HA by their mac-addresses.

Found it! It was in config.json. :slight_smile:

Hey there,

Small update here, that the Ruuvi home assistant custom component for is now also on the official HACS store:

A major step to also make this component available as an official component of Home Assistant :slight_smile:

1 Like

Really neat project!
I’ve been playing around a bit with home-assistant for the gateway and in the end it would be quite similar to your component. Just instead of getting data from BT it gets it from the gateway API.

I’ve been using HA for years, but only made my own “integration” done via MQTT so I’m not too familiar with native integrations :slight_smile:
Do you think it would make sense to have the gateway a separate integration or do you think it could be added into yours?

The gateway api (http://history?time=<time-since-last-poll (optional)> returns data like this:

	"data":	{
		"coordinates":	"",
		"timestamp":	"<timestamp>",
		"gw_mac":	"<mac>",
		"tags":	{
			"<mac>":	{
				"rssi":	<rssi>,
				"timestamp":	"<timestamp>",
				"data":	"0201061BFF990405..."

So all it would have to do is poll the gateway api at some defined interval, parse the data and publish the new states to HA.
As the gateway dns is RuuviGateway<2-last-bytes-of-mac> I think it would be possible to have HA auto-discover it, that’d be very cool and user friendly :slight_smile:

1 Like

Good question. I don’t know. The component I’ve been working on uses the domain “ruuvi” which would be nice to use for the GW as well. But on the other hand, there’s no point loading ble dependencies if the GW is purely network based. If that’s not a problem, it’s totally doable to keep them in the same integration :slight_smile:

Making a component for HA is easy at first, but then I experienced a slowdown in the learning curve when it comes to testing and the details of some of the internals :slight_smile: I could try to share the knowledge I’ve gathered so far.

Btw, I’ve created that Ruuvi Friends organisation in Github to be able to move faster with the Ruuvi related projects. In a lot of cases maintainers get busy and projects grind to a complete halt because PRs don’t get reviewed or merged. In an organisation other people can help and collaborate to get things forward.

If you’d like I could invite you to the org, and we could setup something together there for the GW, and go the same “route” as the previous component:

  1. Start with a “manual” custom component
  2. Set it up in HACS store
  3. Move towards a full official integration

However I don’t have a GW, so I can’t test things myself.

1 Like

I don’t see a problem with having the bluetooth dependencies there unless they cause problems for installs that does not need them. So I suggest we try to keep it as one component and see how it goes, we can always split it up later if needed :).
Sure throw in an invite :). I think that we would be cool to eventually have the project under . Thoughts on the repo and combined integration @otso @lauri ?

So basically we need to just make a scheduled http get call, looks fairly simple . The parsing could be done with the decoder in the simple-ruuvitag library.

Do you have any suggesting how to cleanly being able choose between using bluetooth/gateway as data source? (in the yaml config)

We can throw together a script that simulates the gateway until you get your hands on one, should be easy.

Thanks @sergioisidoro for your contribution so far! If you haven’t already, you should receive your Gateway today.

All this sounds good to me. Like @io53 suggested, a combined integration could be a good way to start with and if needed, that can be split later. Development can be under the Ruuvi Friends repo for sure and we can discuss later if it’d make sense for all the parties to have it under the official Ruuvi organisation later.

1 Like

Here is a small snippet that polls and parses the data from the gateway, using simple_ruuvitag Fetch and parse data from Ruuvi Gateway · GitHub

So there is not much extra stuff needed over what already exists in your integration :slight_smile: