This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

troubleshooting modbus script to control fornius inverter
#3
Thanks, that was an error as well. If someone what's to set the softlimit from a fronius inverter depending on the enery prices, this is the clean code: 
Code:
t = os.date ("*t")
value = grp.getvalue('34/1/' .. t.hour)

require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.1.111', 502)
res, err = mb:connect()
mb:setslave(1)

if res then
    if (value <35) then
        mb:writeregisters(40236, 0)
        log('PV softlimit')
   
    else
    mb:writeregisters(40236, 0)
      mb:writeregisters(40232, 10000)
      mb:writeregisters(40236, 1) 
      log('PV unlimited')
      
    end
    mb:close()
 
else
  log('failed', err)
end
Reply


Messages In This Thread
RE: troubleshooting modbus script to control fornius inverter - by cgn - 15.04.2024, 15:37

Forum Jump: