Node-RED Node

Tein pienen apu muuttujan
let apu = (parseInt((powerInfoString, 16) & 0x001F))
robject.apu = apu;
“txPower”:-8,“apu”:16,
ja se on numero 16 vaikka pitäisi olla 22, onkohan tossa raakadatan sisäänoton järjestyksessä vika?

koska myös jännite ei ole tarkka, Battery 2.959 V (2965 mV)

Joku jekku tässä varmaan on kerran molemmissa numeroissa on 6 liian vähän, patterin pitäisi olla 2959 + 6 ja "apu"n 16 + 6

Sorry wrote in finnish by accident.
I don’t know if you can do this but I made new variable “apu”, where I read in two more bits? from both sides, originally
let powerInfoStart = 30;
let powerInfoEnd = 34;
new is wider 28-36,

let apu = manufacturerDataString.substring(28,36);

and result was 00a9369b whic is in binary
101010010011011010011011
Which doesn’t make sense at all?

No really, it only adds neighboring bytes which have different information

ok, now made with default values (30-34) and i got this a9f6 and in binary
10101001111 10110

it should be this
10101010101 10110

Here more measuring data, battery is ok, it changes but txPower is still the same
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2965,“txPower”:-8,“apu”:“aab6”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2965,“txPower”:-8,“apu”:“aab6”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2965,“txPower”:-8,“apu”:“aab6”
“battery”:2971,“txPower”:-8,“apu”:“ab76”
“battery”:2965,“txPower”:-8,“apu”:“aab6”
“battery”:2965,“txPower”:-8,“apu”:“aab6”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”
“battery”:2959,“txPower”:-8,“apu”:“a9f6”

Wil there be a Node-Red Node for the Ruuvi GW project.
Payload from the GW look like this: (just to make it more easy to use for beginners .
{ “gw_mac”: “94:B9:7E:4E:B1:B4”,
“rssi”: -46,
“aoa”: [],
“gwts”: “1618921036”,
“ts”: “1618921034”,
“data”: 0201061BFF990405140D20EBC5DCFFD0004CFBE0BB1650D393C9AFFA06DF1D",
“coords”: “”}

Something like this could be nice:
image

How can i sort/divide data from three RuuviTag:s? No need to send database. Just to get all three to show up dashboard.

Now it sends all three on same message.payload…

I would think they are identified by the MAC?

msg.tag1 = msg.payload.data.tags[“EA:79:56:CD:18:4E”]
msg.tag2 = msg.payload.data.tags[“FE:AC:DA:20:C5:78”]
msg.tag3 = msg.payload.data.tags[“D2:5E:FA:4E:51:D9”]

I do like this to split up the payload from the Ruuvi-GW

Could you share code?

That code goes funtion node or switch node?

Here is ode for function node, what I use

let measure = JSON.parse(msg.payload);

let msg0 = {};
msg0.payload = (measure.temperature).toFixed(2)
msg0.topic = "Temperature";

let msg1 = {};
msg1.payload = measure.humidity;
msg1.topic = "Humidity";

let msg2 = {};
msg2.payload = (measure.pressure/100).toFixed(2);
// node.warn(msg2.payload)
msg2.topic = "Pressure";

let msg3 = {};
msg3.payload = measure.battery/1000
msg3.topic = "Battery";

let msg4 = {};
msg4.payload = measure.txPower
msg4.topic = "TxPower";

let msg5 = {};
msg5.payload = measure.movementCounter
msg5.topic = "Movement Counter";

let msg6 = {}
msg6.payload = msg.rssi

let msg7 = {}
msg7.payload = msg.peripheralUuid

return [msg0, msg1, msg2, msg3, msg4, msg5, msg6, msg7];
1 Like

ruuvi_gw.zip (2.0 KB)
Her is an example for Node-red, it also check for data type 3 or 5

Already made a new thread as didnt notice this one, but I cannot find ruuvitag -node from node-red pallette manager. Is it not suppirted anymore? I see there is a folder in node_modules called node-contrib-ruuvitag, and even if i try to npm install it from that folder it just tells me that there is something wrong with npm registrations.

Is there a way to get the node shown in GUI nowadays?

As I replied to your other posting, mine is there and it is working

Use Node-Rerd switch
like here

[
{
“id”: “8c28be57.ffdc9”,
“type”: “switch”,
“z”: “6ac4c280.adde7c”,
“name”: “Ruuvitags”,
“property”: “peripheralUuid”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “d6198fe1e407”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “c87aaced7ae9”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “c3162dd2309a”,
“vt”: “str”
},
{
“t”: “eq”,
“v”: “d192a0fa9e13”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 4,
“x”: 600,
“y”: 680,
“wires”: [
[
“f14111c3.713b”,
“ba812a30.a01248”
],
[
“2a358f1d.9c415”,
“ac08d8a6.946838”
],
[
“8d692117.dcc0e”,
“83c110ac.62462”
],
[
“8f2d3b29.5a6c78”,
“5d07b898.d2c858”
]
]
}
]

I have one “production” Rasberry PI and now setting up new “playground” Raspberry PI. for curiosity I looked and couldn’t find ruuvitag node on NR Palette, where you can find most of nodes.
Ofcourse you can installa with this

but for novice users it would be easier if all needed nodes would be available in Palette. Is there any plans for that?

And how about where I could share basic example nodes to split sensors and then get data splitted per sensor?

Could i please have an example of this line of command?

sudo setcap cap_net_raw,cap_net_admin+eip $(eval readlink -f which node)

Im just lost on what it should put in the ‘which node’

Edit: With trial and error, this worked for me
“sudo setcap cap_net_raw+eip $(eval readlink -f /bin/node)”