Setting up Ruuvi sensors

A little product review here, but It’s because I think the product can make it easier for FarmOS users to integrate sensor data.

Got my Ruuvi-tag’s today.
My intention is to monitor temperature and humitidy in my pig barn. 6 rooms. One sensor pr room.
@Farmer-Ed made me aware of these, and I just had to try them. Many use cases for these sensors.

Everything is open source :heart: and I plan on feeding the sensor data to FarmOS.

(Cap is for size comparison)

The black Ruuvi tag is more robust than the white.

So far I’m very impressed with the simplicity of setting this up. I just unpacked a sensor, and pulled out the plastic strip protecting the battery. Then I tapped add sensor on the Ruuvi mobile app.
And that’s that. Sensor data started to materialize in the app.

Then I powered up the gateway and connected my laptop to it’s wifi. Super simple setup in the browser, and the sensor was reachable from the Ruuvi cloud. It even checked for the latest firmware.

I know the gateway can redirect where it post it’s data. But not sure if FarmOS can take it directly.
Propably need some tinkering… Maybe custom firmware, but I hope not. (I’m propably lost then…)
We’ll see


Cool @pat !

I know the gateway can redirect where it post it’s data. But not sure if FarmOS can take it directly.

Yea so farmOS sensor/data streams will open up endpoints that data can be posted to, but it expects a specific format. If you create a sensor asset, you’ll see a “Developer information” box when you’re viewing it with examples.

So… depending on what the data looks like coming out of your sensor, you may need to pre-process it before relaying it to farmOS. Maybe this could happen via Node Red?

Or… the other option is to build a new module in farmOS specifically for this type of sensor, which expects data in the same format. Maybe you can convince the makers of these sensors to sponsor that work. :wink:



1 Like

Oh cool,

I haven’t even ordered mine yet.
I don’t plan on using their gateway, I’ll probably use ESP32’s as Bluetooth proxies for HA.

I don’t believe you will need any custom firmware, it is my understanding that the gateway you got can relay sensor data via MQTT which means that Node-Red will be ideal to process the sensor data for farmOS. (you may need to setup an MQTT broker)


I bet you will soon… :slight_smile:

I threw in the gateway just to make sure I got it up and running very easy. And to my suprise, it really was.

The gateway has a redirect option:
Data forwarding url: https://…
And a device identifier

So all sensors are sendt in one post I guess.

We’ll make it work, I’m sure.


Ok, if it just posts all sensors as a single payload it may be even simpler. Just create an endpoint with a http in node.


Maybe… Have to test…

I just asked Ruuvi for a module sponsorship too…
That would be an easy out of the box experience with FarmOS and sensors.


That would be handy.

Check out for tutorials, I see a node red one, haven’t looked too closely yet.

1 Like

Another BLE Tag worth looking at, with a different selection of on board sensors and IO pins to add custom. Not necessarily an alternative, but potentially complementary for different tasks.

1 Like

Cool. With light sensor too.

Wonder, if they would work with your gateway. (they are both open source, so should be possible even if a little tweaking is needed) Shouldn’t be an issue with my planned ESP32/RPi gateways.

Hmm… maybe :thinking:

Just in case anyone else is following this or will in future, myself and @pat have started some Node-Red experimenting with RuuviTags and found they deliver sensor data in HEX value which needs some decoding.

From this document Data format 5 (RAWv2) - docs , I’ve put together a little Javascript to decode the payload and a test flow here. GitHub - Farmer-Eds-Shed/RuuviTag-Node-Red-Hex-Data-Parser: Node-Red Flows for parsing RuuviTag data

let str =;
const data = {};

let part1 = "0x" + str[14] + str[15] ;
data.type = parseInt(part1);

let part2 = "0x" + str[16] + str[17] + str[18] + str[19];
temperature = parseInt(part2);
if (temperature > 32767) temperature -= 65534; // two's complement
data.temperature = temperature * 0.005;

let part3 = "0x" + str[20] + str[21] + str[22] + str[23];
data.humidity = parseInt(part3) / 400.0;

let part4 = "0x" + str[24] + str[25] + str[26] + str[27];
data.pressure = parseInt(part4) + 50000;

let part5 = "0x" + str[28] + str[29] + str[30] + str[31];
accelerationX = parseInt(part5);
if (accelerationX > 32767) accelerationX -= 65536; // two's complement
data.accelerationX = accelerationX /1000;
let part6 = "0x" + str[32] + str[33] + str[34] + str[35];
accelerationY = parseInt(part6);
if (accelerationY > 32767) accelerationY -= 65536; // two's complement
data.accelerationY = accelerationY /1000;
let part7 = "0x" + str[36] + str[37] + str[38] + str[39];
accelerationZ = parseInt(part7);
if (accelerationZ > 32767) accelerationZ -= 65536; // two's complement
data.accelerationZ = accelerationZ /1000

let part8 = "0x" + str[40] + str[41] + str[42] + str[43];
let power = parseInt(part8).toString(2);
voltage = power.substr(0, 11);
TXdbm = power.slice(-5);
data.voltage = (parseInt(voltage, 2) + 1600) / 1000;
data.TXdbm = (parseInt(TXdbm, 2) & 0b11111) * 2 - 40;

let part9 = "0x" + str[44] + str[45];
data.movementCounter = parseInt(part9);

let part10 = "0x" + str[46] + str[47] + str[48] + str[49];
data.measurementSequenceNumber = parseInt(part10);

//mac address
let part11 = str.slice(-12);
data.mac = part11;

msg.payload = data
return msg;


@pat also has a flow to retrieve the data from the RuuviTag Gateway.

So just a few bits to be put together and then fed into farmOS.

Ruuvitag integration being added to next release of Home Assistant, may be of interest to some.

1 Like

Oohh… nice
FarmOS next :upside_down_face:

1 Like

Perhaps eventually…
But it should simplify adding the tags to farmOS for anyone using Home Assistant anyway.

1 Like

I received my tags in the post this morning.
I powered one up and it showed up as discovered by Home Assistant instantly.

But only exposed some of the on board sensors.

I guess the Node-Red solution is still best for now.

1 Like

oh… actually the signal strength and movement counter are there too but disabled by default.

but XYZ accelerometers are not listed

Nice. Plug&play :slight_smile:

1 Like

Yes, as long as you don’t need accelerometers, but Ruuvi integration is new so hopefully they’ll be added. If not I Might have a look at Github and maybe open a PR to add them myself, but will finish the Node-Red flow for now.

1 Like