I use Node-Red on a Raspberry Pi 3 and i want to Read out Typrepressure Sensors via BLE.
So i decided to use the node "BLE Bacon Scanner":
The output gives me many messages from many BLE devices in the debug window around me:
Now i want to filter out only this object (marked yellow) and ignore all other messages for example with a function or whatever between the scanner and the debug node:
Have a look at the switch node - it will let you route messages based on properties/values - looks for the Object ID you want and route that to the next stage of your flow
The hard part is coming yet.... decode the eighten hex values in decimal kPa and °C....
till yet i know that buffer nr. 12&13 are Temperature in °C (divided by 100) -> for example:
12: 0x41
13: 0xa
= a41 (hex) -> 2625(decimal) -> 26.25°C (divided by 100)
and buffer nr. 8&9 are pressure in kPa (divided by 1000) -> for example:
8: 0xea
9: 0x23
=23ea (hex) -> 9194(decimal) -> 9.194 kPa (divided by 1000)
OK So to grab the value - the easiest way is a 2nd switch node based on the property you are interested in - if you highlight the value in the debug window that you are interested in - there is a small popup to the right - this gives you 3 options - the first option lets you capture the full "path" to the object to insert into your switch
Then do a basic function node - and perform the maths as you have listed above - grab the hex value, multiply by 16 to get decimal and divide by 100