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

Hi, I created an extended fetch data script with authentication, types etc. Thanks to @io53 for a good snippet to get me started fast.

Authentication logic is ported from Ruuvi Gateway’s web interface.

I added the script to GitHub - ruuvi-friends/ruuvi-gateway-fetch-data-script: Python script for fetching and parsing sensor data from Ruuvi Gateway.

It is pretty complex for a simple script, as it is also a test code for decoder types and for a Python package code.

Hi oiv,

Would you please show me what to do to get the Ruuvi Gateway discovered by the MQTT integration? I followed your instructions in your Github and made the Ruuvitag MAC changes in “parsetag” function node and set up the MQTT broker information. But the Gateway does not show up under the MQTT integration. I have enabled auto-discovery in the MQTT broker. Oh, the “Ruuvi” and “send to ha” nodes show connected.

BTW, The MQTT broker is receiving messages from the Ruuvi Gateway when I listen to the ruuvi/# topic.

Please help. Thanks!

Hi gcshum,

Can you see the config message being sent correctly for each tag/measurement_type? Should be in a topic like
homeassistant/sensor/ruuvitag_xxxxxxxxxxxx_type
MQTTexplorer is a good tool to see what messages are flowing in your broker.

Also did you check your HA config/integrations MQTT if you have the entities without devices. I did end up in this situation while developing the script. If I remember correctly I had to remove the “orphan” ruuvi entities before I got the devices shown correctly.

Sorry. Hard to give exact help with this info. Hope you get it running.

Otto

Thanks Otto,

I made a mistake on putting ruuvi/# as the topic in the “send to ha” node. I removed it and it’s working!

This is great as I can now continue on with making an automation.

Hi gcshum,

great! Glad you solved it. I know the instructions could be better. Sorry for that :slight_smile:

Hi Otto,

I have a few questions.

  1. Can this flow listen to more than 1 Ruuvi Gateway? Instruction on how please.
  2. How often does the Ruuvitag sensor broadcast it’s bluetooth data? Can that be changed?
  3. How often does the Ruuvit Gateway broadcast it’s MQTT data? Can that be changed?

I’m thinking of running Home Assistant vm on a server. I wonder if that will work. Guess I’m going to test it.

Thanks for all your help.

Hi and sorry for late reply.

  1. Can this flow listen to more than 1 Ruuvi Gateway? Instruction on how please.
  2. How often does the Ruuvitag sensor broadcast it’s bluetooth data? Can that be changed?
  3. How often does the Ruuvit Gateway broadcast it’s MQTT data? Can that be changed?
  1. I see no reason why listening several gateways would not work.
  2. That I am not sure. It depends on the firmware. I found this link to ruuvi lab which says.

The 2.5.9 firmware has 3 modes:
RAWv2-fast (broadcast every 1285ms, green LED blinks, theoretical battery life 4 years)
RAWv2-slow (broadcast every 6425ms, green LED blinks, theoretical battery life 6 years)
RAWv1-fast (broadcast every 1285ms, red LED blinks, theoretical battery life 4 years)

  1. I did not find any info on how often the gateway sends the info. I have limited the node-red flow to send the info once / minute. This can be changed by changing this line

if (lastmsg+60<ms) {

The value 60 here is the number of seconds to wait before allowing the next message to pass thru for the device. Hmm… This should be a parameter… Maybe in next version :smiley:

Features, firmware 3.30.x
– 10 days internal history logging (one measurement every 5 min)
– Broadcasting interval 1,29s (measurement interval interval 2,57s)
– Connectable mode (required by Ruuvi Station alerts feature on iOS)
– Theoretical battery lifetime ~3 years

Hi! I published a ruuvi gateway client package to PyPI. Functionality is the same as in the script.

1 Like

Hello,

Would it be possible to get step by step instructions for installing the Gateway client package?

Have tried unsuccessfully install the package in HA OS terminal, Installed Pyscript in HACS, made pyscript integration and copied package files to python folder. None of these seems to do the trick…

Is there any plans to get official integration or HACS integration?

We are looking into how we could support RuuviTags in HA, either through the official Bluetooth Sensor integration or through Gateway and MQTT / HTTP. I cannot promise a schedule for the support yet.

Seconded, I’ve tried to get my 10 Ruuvitags and the gateway to work in HA for a few times already and just can’t do it. It’s getting to the point where I’m considering selling everything and buying sensors from a Chinese manufacturer that has official HA support. I’m sure the Ruuvitags are far more accurate but it doesn’t matter if I can’t get them to work.

1 Like

Thank you for the reply!

It would be a good start to get beginner proof introductions, how to get existing solution to work in HA (If solution is doable for “average Joe”).

Have been really happy with my Ruuvi tags and Gateway, but it is a big con that I only get sensors visible in HA via iFrame-card in Lovelace. That solution shows me the temperatures, but does not allow me to use data further and off course it is cloud dependent.

Hopefully we see HA supported solution in the future for Ruuvi tags and Gateway.

You can also join to our Telegram channel as there are lots of users who are Pro’s in HASS and RuuviTags. You will get much faster support there :slight_smile:

I finally managed to get it working, it was an issue with pyscript configuration. Just out of curiosity, is there any way to limit the rate of MQTT messages the gateway is sending? With just nine Ruuvitags my CPU usage goes from 1% to 14% even though my J5005-based HA server is far more powerful than a Raspberry Pi. I could see that becoming an issue with a low-powered system and a lot of Ruuvitags.

We don’t have a rate limit on MQTT, original idea is to let the subscribers to decide how much they want to process. We have rate limiting built in HTTP which batches the messages.

We’ll consider rate limit on MQTT as a feature, but we might also decide that once we support multiple HTTP targets only HTTP is used as a rate-limited data transfer mechanism.

I just received my gateway yesterday, and configured it to send sensor data to my local HA MQTT broker.

I just bought 12pcs of Ruuvi sensors and 1pcs of Ruuvi Gateway and I’m really enjoying using them.

I configured them to the Home Assistant with Mosquitto + MQTT + pyscript-ruuvi-gateway and got it finally working. The instructions weren’t too good in the internet…

Unfortunately now this thing takes 60-80% of my CPU (old Intel Atom 1,46GHz).
So some kind of slowing down parameter option to Ruuvi Gateway or official (more efficient) integration to Home Assistant would be very welcomed indeed.

2 Likes

Thanks for the information about MQTT throttling use-case. @Alexey_Skvortsov let’s keep this in mind when we implement whitelisting, maybe we could add throttling at the same time?

Home Assistant 2022.12 seems to come with Ruuvi integration. Hopefully also for Gateway. :+1:

2 Likes