UDP message -> get the value

i got a issue: iam getting a UDP massage from a DDC controller.
the massage looks like this:
image
i know that the value i need is


can somebody tell me how to isolate the value ?
thank you

What is the toFloat node and what have you got the inject node configured to do? In other words what do you need the input message converted to? A buffer containing the relevant bytes or a string or what?

Is it always the bytes 4 to 7 ? Are you ever going to want to decode the first few bytes also ?
The node-red-contrib-binary node can be useful for unpacking various formats of bytes (but does take a bit of getting used to I'll admit). Otherwise I'd just use a simple function node to slice out the required bytes into another buffer before using you toFloat node

https://nodejs.org/api/buffer.html#buffer_buf_slice_start_end

Thank you for the info,
the value is always in buffer 4-8.
i got the isolation of the value now working. but its a float value. the ToFloat function is not working....

now iam fighting to get the isolated hex value in a decimale value.

Using the https://flows.nodered.org/node/node-red-contrib-binary node you can inject the original 8 bytes and get the result you want using the pattern x32,l32f - which means skip the first 32 bits (=4 bytes) - then read the next 32 as a little endian floating point number.

[{"id":"4dab4f20.69247","type":"inject","z":"8eaef9ed.138468","name":"","topic":"","payload":"[\"0xfa\",\"0x41\",\"0x2\",\"0x1\",\"0x41\",\"0x1a\",\"0x25\",\"0x2d\"]","payloadType":"bin","repeat":"","crontab":"","once":false,"onceDelay":0.1,"hide":false,"x":130,"y":560,"wires":[["a067bf73.125a7"]]},{"id":"a067bf73.125a7","type":"binary","z":"8eaef9ed.138468","name":"","pattern":"x32,l32f","x":290,"y":560,"wires":[["a8172873.d7ecf8"]]},{"id":"a8172873.d7ecf8","type":"debug","z":"8eaef9ed.138468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":560,"wires":[]}]

This is magic!! this is working without a function node!

thank you very much!!

now going to check to receive a single bit value...

The binary node can also extract bits - but as I said the pattern "language" used takes a bit of understanding - https://github.com/bigeasy/packet#binary-pattern-fields

reading is not a problem anymore... thanks to you. now i tried to write.
with wireshark i capture the write HEX string.
when i inject this to the UDP port the value is written. but when i change the value it doesn't work.
this works:
image
Bleu is the float value.. (60)
if i change this to 40 it shoud look like this:
image

but that doesn't work...

any idea?

You are sending an ascii string... image

you need to send a binary packet


image

but use all your values instead .. not easy to type I'll admit

ok, but i got a HEX function between de injection and udp.
image

image

the injection writes the 60 but not the 40 value.

when i capture with wireshark a write 40 it looks like this:
image

and that is also working.. but i want to use a dashboard slider for writing a value..

ah - you may need to use the binary node again to re-encode the parts
eg

[{"id":"1da2f63a.0073aa","type":"binary","z":"82738787.0e0338","name":"","pattern":"x32,l32f","x":370,"y":660,"wires":[["f95b989a.bd4358"]]},{"id":"f95b989a.bd4358","type":"debug","z":"82738787.0e0338","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":660,"wires":[]},{"id":"8728002d.7341a","type":"inject","z":"82738787.0e0338","name":"","topic":"","payload":"{\"a\":9.3}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"hide":false,"x":160,"y":660,"wires":[["1da2f63a.0073aa"]]}]```

pow, that goes a bit to fast for me.. can i hook a slider to this and get the correct value?

i got an error..

Sure, you just need to change the data out of the slider into the format the binary node expects.