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.

Modbus slave address/bit
#8
Use this, fill the bits table as needed (keys are from 0 to 15 for a single register):
Code:
bits = {
  [0] = '0/0/1',
  [1] = '0/0/2',
  [2] = '0/0/3',
}

res = 0

for nr, addr in pairs(bits) do
  val = grp.getvalue(addr)
  if val then
    res = res + bit.lshift(1, nr)
  end
end

grp.checkwrite('0/0/5', res)

Add a common tag to all input group addresses and map an event script to this.
Reply


Messages In This Thread
Modbus slave address/bit - by Novodk - 25.06.2025, 09:34
RE: Modbus slave address/bit - by Daniel - 25.06.2025, 09:37
RE: Modbus slave address/bit - by Novodk - 25.06.2025, 09:48
RE: Modbus slave address/bit - by Daniel - 25.06.2025, 09:53
RE: Modbus slave address/bit - by admin - 26.06.2025, 07:07
RE: Modbus slave address/bit - by admin - 26.06.2025, 07:56

Forum Jump: