Hi. I am using Ruuvi tags in combination with a Minew gateway and openHAB.
Getting this string in json from Minew Gateway:
“rawData”: “0201061BFF99040511863E1FBEE3FFF4FFD40438B2D636062DDB3FDE305BF6”
which means in your case you need to omit this part from the beginning:
0201061BFF
A crude implementation could just be hardcoded to discard that from the beginning since its very unlikely to change, but if you want to “properly parse it” yourself, you need to parse the advertisement structs from that data and look for the struct containing the manufacturer specific data.
Each advertisement struct starts with a length byte followed by a struct type byte, followed by the data specific to that struct type. In your case you seem to have two structs (which is typical) and the bytes in your case are:
02 Struct length (after the length byte), in this case two bytes
01 Struct type, 01 means flags. You are not interested in this so you can discard this struct entirely
06 A byte containing the flags, you can ignore this (note: this is the 2nd byte after the “struct length” byte so the first struct ends here)
1B Struct length (again, after this length byte), in this case 0x1B = 27 bytes
FF Struct type, FF means manufacturer specific data, so this struct contains the data you want
remaining bytes are the manufacturer specific data payload, starting with the ruuvi company identifier of 9904. This is what you feed to the library.
Do note that the library expects a raw byte[] so you need to convert the hex string into a byte array (not just the bytes of the utf-8 string you have), for example like this.