Long story short, I finally got my hands on a Ruuvi Gateway and I wanted to use it as a drop-in replacement for my RuuviCollector setup, with better support for Home Assistant so I created this project called RuuviBridge which acts as a “data bridge” between various sources and consumers of data. You can use this software without having a physical Ruuvi Gateway device by using a compatible gateway software, such as the ruuvi-go-gateway.
The basic idea is that there are configurable sources of data, right now it supports polling the Ruuvi Gateway directly (if you don’t have a MQTT server), or subscribing to a MQTT topic where the Ruuvi Gateway is configured to feed the received data (recommended option), but I may add more in the future.
Data from each source is then parsed into a “common format” and optionally processed, by default the processing includes calculating “extended values” such as dew point, absolute humidity, air pressure, total acceleration and so on, which is the same as with RuuviCollector.
After the processing step the data is sent to each configured consumer of data, which include InfluxDB (in RuuviCollector format), Prometheus, and MQTT. The MQTT part optionally includes creating Home Assistant MQTT Discovery topics for automatically configuring the tags as devices with all available values as sensors, with properly configured names, units, icons and other attributes.
The automatically created devices in Home Assistant have data that look like this:
My GW publishes under ruuvi/<gwmac>/<tagmac>. With mqtt_listener.topic_prefix = ruuvi it subscribes to ruuvi/+ which doesn’t match this scheme. So I configured mqtt_listener.topic_prefix = ruuvi/+ and that worked (subscribes to ruuvi/+/+).
Good catch, that was a slight oversight in parsing the tag mac address from the topic, the logic didn’t really account for the use of wildcards in the prefix. That should be fixed now, which should also fix the names and named filter mode not working.
I’ve published a new version, please give it a go and see if it now works properly
Thanks a lot, the new version now works as expected. And thanks for adding proper logging, that makes it easier to so what is going on, although for debugging purposes a few more logs would help.
Two things:
The gateway produces a lot of measurements, every few seconds (that might be the interval the tags send their measurements). This is too much for my use case, I’d only need a measurement every few minutes. Should there be a way to only forward measurements every few minutes (configurable) to sinks, maybe configurable per sink?
While I understand that the main idea behind the project is to forward messages from the gateway, would you also consider adding a bluetooth source? My use case would be to replace the heavy (Java) RuuviCollector at places where I don’t have a gateway running. I’m using ruuvitag-gollector there, but would love to use RuuviBridge to have the same data format available. Running RuuviCollector on a Raspberry Pi Zero is possible, but a pain.
Thanks for the feedback. I’ve released a new version with the ability to limit the update interval for each sink separately. I also did a few improvements in logging, but in general logging will be improved over time as the code structure “stabilizes” and I figure out useful things to log.
A bluetooth source is a bit tricky, as it’s totally platform dependent (depends on the OS, the bluetooth stack used, and in some cases even the bluetooth hardware) and I’d like to keep RuuviBridge as platform-agnostic as possible to allow running it on (almost) any OS.
However I do plan on adding support for some lightweight “3rd party software gateway” implementations, or possibly even implement my own if I can’t find any feasible ones. Requirements being lightweight and publishing the raw, unparsed data like the Ruuvi Gateway does.
Edit:
Actually… I figured a software replica of the Gateway would be rather easy to implement, since it would be just forwarding the raw data without needing to parse it or do any other complicated logic, so I went ahead and created ruuvi-go-gateway
I’m now running v0.1.4, and it looks perfect to me! Thank you very much. I’ll give ruuvi-go-gateway a try when I find time, that’s exactly what I was looking for.
I’m totally new to Home Assistant. I just received the Ruuvi Gateway and a Ruuvitag Pro 2-in-1 sensor. I tried to follow the steps on the following website.
However, since I don’t know anything about python, I was only able to follow up to step 2. I need someone to guide me in details on how to do steps 3 & 4.
Please forgive me for asking dumb questions. I really need to get this going. I’m using Home Assistant as a vm on a Windows 10 host. I have installed HACS and pyscript.
I’m running Windows 10 64 bit on Intel.
I tried to install and or run “ruuvibridge.exe” after downloading “ruuvibridge-v0.1.16-windows-amd64.zip” and i cannot get it to do anything.
Is this only for AMD processors?
How is this to be run and or installed on Windows 10?
Thanks
The “amd64” in the name refers to the architecture which is also known as “x86-64” or “x64”, which is also for 64bit intel CPU’s.
For ruuvibridge to run, it needs to have the config.yml file in the current working directory (as noted in the Configuration section of the readme). It should print an error and exit if it can’t find the file or another equally severe error is encountered.
If you are just doubleclicking the exe on your windows machine without a config file present, the window likely disappears before you can see it. In such case it might help if you open cmd or powershell in the directory where you have the exe and run it through there to prevent the window from disappearing when the process exits, allowing you to see the error.
Thank You for the fast reply!!
Sorry for the delay, was on the road for work.
Thank you for explaining the “amd64” I normally expect to see that as the “x64” but I guess I’m just sheltered.
I now have the bridge up and running.
I don’t see the names of the tags in the data, just the mac address, is that normal?
Again, Thank You.
If you mean the names you have set in ruuvi station, then that is expected, since the names are not actually saved on the tags, but on the ruuvi station, and there is no reasonable way to automatically get them from there.
However, RuuviBridge allows you to specify the names in the config, allowing you to have the names in InfluxDB, homeassistant, or whatever you are using. For this, see the tag_names section in the config. Remember to restart RuuviBridge after updating the config.