Javascript Function to Process Modbus Values not Running on Edge Compute

Hi Losant Team: I have a need to process incoming 16bit ints from a modbus device into 32bit integers and floats. I have put together a Javascript function that works in the application workflows, but times out when run on the edge.

Is this a bug or intended behavior? If intended, why does the edge workflow timeout overall (not the function node)?

This can be tested with the following function simply using a virtual button, function node, and a debug node.

let measuredValueLowWord = 18417; // 16-bit value at offset 4
let measuredValueHighWord = 8293; // 16-bit value at offset 5
let measuredValue32Bit = (measuredValueHighWord << 16) | measuredValueLowWord;

let buf = new ArrayBuffer(4)
let ints = new Uint16Array(buf)
ints[0] = measuredValueHighWord
ints[1] = measuredValueLowWord
let convertToFloat = new Float32Array(buf)
let measuredValue32Float = convertToFloat[0]


Hi @Michael_Murdy !

I am able to execute this script (using a Virtual Button → Function Node → Debug workflow) in both an Application and an Edge workflow without it timing out. The Edge workflow completes in about 9ms.

To clarify, is it timing out on your Edge device with just a Virtual Button → Function Node → Debug workflow, or do you have other nodes preceding the Function Node?

Interesting. Thank you for testing @Sebastian_Turner. Correct - no other preceding nodes. I pulled everything to a separate path. I also just tried on a clean workflow and deployed it to the device. It is running version 1.39. Not sure if that might be an issue.

I’ll follow up with you by email with the device specifics in case you want to check it out further.