UDP message -> get the value


i got a issue: iam getting a UDP massage from a DDC controller.
the massage looks like this:
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



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.



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:
Bleu is the float value.. (60)
if i change this to 40 it shoud look like this:

but that doesn't work...

any idea?


You are sending an ascii string... image

you need to send a binary packet


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.


the injection writes the 60 but not the 40 value.

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

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



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.