I managed to intergrade my Huawei solar inverter and communicate over TCP modbus.
Unfortunately, what I haven't manage to do, is send values to the inverter over register 40120,
which is the one controlling the active power of the inverter.
Attached you can see the profile I created for the inverter and the documentation from the manufacturer.
Have you created the device again from scratch after modifying the profile? You should use the Modbus profiler app which allows editing existing devices.
(07.08.2026, 08:56)admin Wrote: Have you created the device again from scratch after modifying the profile? You should use the Modbus profiler app which allows editing existing devices.
I changed it over the Modbus profiler app.
BTW on my initial configuration I had it as a register and I only changed it after I realized it didn't work properly
Run this script once and post what you get in LM Logs tab. Change Modbus device IP if needed.
Code:
mb = require('luamodbus').tcp()
mb:open('192.168.99.141', 502)
res, err = mb:connect()
if res then
mb:setslave(2)
res, err = mb:writeregisters(40120, 300)
if res then
log('write ok')
else
log('write failed', err)
end
else
log('connection failed', err)
end
mb:close()
(07.08.2026, 11:49)admin Wrote: Run this script once and post what you get in LM Logs tab. Change Modbus device IP if needed.
Code:
mb = require('luamodbus').tcp()
mb:open('192.168.99.141', 502)
res, err = mb:connect()
if res then
mb:setslave(2)
res, err = mb:writeregisters(40120, 300)
if res then
log('write ok')
else
log('write failed', err)
end
else
log('connection failed', err)
end
mb:close()
I set it to run every 5 seconds and I get these messages
Are you sure that the IP address is correct? Increase the interval to 60 seconds.
You might need to temporarily delete the device from LM Modbus tab to free up a connection. Are you using persistent connection in the device settings?
(07.08.2026, 11:58)admin Wrote: Are you sure that the IP address is correct? Increase the interval to 60 seconds.
You might need to temporarily delete the device from LM Modbus tab to free up a connection. Are you using persistent connection in the device settings?
IP is correct
Interval changed to 60 seconds, but the messages are still the same
I was not using a persistent connection. I changed it to persistent, but still I get the same messages
09.08.2026, 07:35 (This post was last modified: 09.08.2026, 07:35 by Chandrias.)
(08.08.2026, 16:07)CristianAgata Wrote: Hi Chandrias,
I think before write this register you must set some parameters before. Have you done?
Best regards Cristian Grassi
Yes I did. I also tested writing on that using another software "modbustester" and it works fine
(07.08.2026, 13:12)Daniel Wrote: Did you reboot inverter?