I still can’t get it to work. Let me show the details of what I am doing:
-
I have a Modbus client reading succesfully. It has a variable named “Corriente”, as you can see in the picture.
-
I created a Data to Server instance with a Lua script format type with the following very simple code trying to read “Corriente” tag and formating it with my own JSON:
function handle_format_request(data)
local tag1 = tonumber(data[“Corriente”]) or 0
return string.format(‘{ “sum”: %d }’, tag1)
end
-
It looks like the code is not catching the value of “Corriente” from the
tonumber(data[“Corriente”])because in the MQTT broker shows the value of zero (0) -
Whats missing? Does Teltonika have a complete and detailed LUA scripting guide for accessing and managing all this internal data?


