Modbus connect with Victron Venus GX controller - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus connect with Victron Venus GX controller (/showthread.php?tid=2087) |
Modbus connect with Victron Venus GX controller - mooselight - 21.05.2019 Good morning ! I'm trying to read battery State Of Charge from a Victron Venus GX controller with that LUA script : Code: require('luamodbus') I think the connection is not working, because I get the following message in log : Venus GX 21.05.2019 09:56:05 * nil Modbus TCP communication of the Venux GX is working well from my Mac with that Python script : Code: #!/usr/bin/env python It's my first time with Modbus TCP on LogicMachine .. so I should have miss something .. Any help is welcome ! Thanks PS/ Here are the Modbus register adresses and types from Victron documentation : RE: Modbus connect with Victron Venus GX controller - Daniel - 21.05.2019 Hi Why didn't you try to create profile and use modbus mapper? Here are some examples. https://forum.logicmachine.net/showthread.php?tid=839 BR RE: Modbus connect with Victron Venus GX controller - mooselight - 21.05.2019 Creating a profile seems too complicated to me .. but I'll take a look if I got time. For now, my simple script generate the following error on the Venus GS log : 2019-05-21 09:03:09.810056500 ERROR 2019-05-21T09:03:09.809 "Error processing function code 3, unit id 255, src 192.168.1.100, start address 843, quantity 2 :" "Unit id not found" I don't see where the set a different unit id .. and which one ? RE: Modbus connect with Victron Venus GX controller - admin - 21.05.2019 255 is default slave ID for TCP. Most TCP devices do not care about slave ID. You can set it manually by calling mb:setslave(123) after connect, change 123 as needed. RE: Modbus connect with Victron Venus GX controller - Daniel - 21.05.2019 And try using r1 = mb:readinputregisters(843) RE: Modbus connect with Victron Venus GX controller - mooselight - 21.05.2019 Yes ! it works now with slave ID set to 0 : Code: require('luamodbus') Venus GX 21.05.2019 16:10:46 * arg: 1 * number: 95 * arg: 2 * number: 265 * arg: 3 * number: 149 So I'll now be able to process those data the way I want. Thanks for you help ! |