Payload format, Ingics gateway, Mqtt, Node Red

Hello All
Yesterday i got the chance to try a Ingics BLE to MQTT Gateway.

My ruuvi payload look like this:

02010611FF990403778E5CC9C8FFBBFFFC040E0B6B when its delivered by the mqtt broker.

Any tips where the values are hiding would be nice ?

PT

Hello,

020106 is a Bluetooth header, I don’t remember the meaning of the bytes.
11FF is “17 bytes of manufacturer specific data”, 0x11 being 17 in base 10 and FF the data type.
9904is manufacturer ID, LSB first. Ruuvi Innovations BLE ID is 0x0499.
03778E5CC9C8FFBBFFFC040E0B6B is the actual payload, data format 3.

The 020106 is the first AD struct, where 02 is the length (=2 bytes after the length byte), 01 is the type (01 = Flags) and 06 is the value for flags, 06 has the 2nd and 3rd bit set (LSB first) which are “LE General Discoverable Mode” and “BR/EDR Not Supported”, respectively.

All AD structs in the raw payload follow the same scheme; first byte is the length that indicates the remaining length of the AD struct, 2nd byte is the type and after that comes the actual data of the struct. One advertisement can (and usually does) contain multiple AD structs.

1 Like

Need some help

Did try this (Node-red)
var t1 = msg.payload.substr(18, 2);
var t2 = msg.payload.substr(20, 2);
msg.t = parseInt(t1+t2 ,16)/100;

Struggling to find the right syntax, can you use parseInt to get the temperature at all ?

Thanks for all help so far :slight_smile:
PT

Hello,

might help you

Example:
Value Measurement
0x0000 0 °C
0x8145 -1.69 °C
0x0145 +1.69 °C

Its the switch between positive and negative i struggle to get right, easy when you know it of course :slight_smile:
PT

I’m not sure if this was a question, but anyway:
If the most significant bit is set, value is negative. i.e. 1-complement signed format.

For reference.

I ended up with this lines:

var t1 = msg.payload.substr(18, 1);
var t2 = msg.payload.substr(19, 1);
var t3 = msg.payload.substr(20, 2);

if (t1 > 7) {
var tn = t1-8;
msg.t = (parseInt(t3 ,16)/100 + parseInt(tn+t2 ,16))*-1;
}
else msg.t = (parseInt(t3 ,16)/100 + parseInt(t1+t2 ,16) );

It work but i guess there are better and more beautiful ways to do it.

PT

1 Like