Thanks! uint32 worked for reading.
Now to the bigger problem, scripting. I searched the forums and found a similar thread regarding writing a bit, but I'm not sure I understand it? I have edited it to suit me.
Must I first set mode, before I send either of the bool KNX telegrams? This register contains 32 bits, no need store all the other bits?
But I'm not convinced I have done it right, valuue+512=512+512 and so on?
How will the Bool KNX objects be resetted to 0? Otherwise they will be 1 next time the script runs and perhaps set the UPS in ByPass by error?
Now to the bigger problem, scripting. I searched the forums and found a similar thread regarding writing a bit, but I'm not sure I understand it? I have edited it to suit me.
Must I first set mode, before I send either of the bool KNX telegrams? This register contains 32 bits, no need store all the other bits?
But I'm not convinced I have done it right, valuue+512=512+512 and so on?
How will the Bool KNX objects be resetted to 0? Otherwise they will be 1 next time the script runs and perhaps set the UPS in ByPass by error?
Code:
-- 0=set bit 0, 1
-- 1=set bit 1, 2
-- 2=set bit 2, 4
-- 3=set bit 3, 8
-- 4=set bit 4, 16
-- 5=set bit 5, 32
-- 6=set bit 6, 64
-- 7=set bit 7, 128
-- 8=set bit 8, 256
-- 9=set bit 9, 512
mode = grp.getvalue('1/1/1') -- 1-byte unsigned integer
OutputBypass = grp.getvalue('6/1/0') -- boolean
OutputOnline = grp.getvalue('6/1/1') -- boolean
ClearFaults = grp.getvalue('6/1/2') -- boolean
if mode == 4 then
value = 16
elseif mode == 5 then
value = 32
elseif mode == 9 then
value = 512
end
if OutputBypass then
value = value + 16 -- Bit 4
end
if OutputOnline then
value = value + 32 -- Bit 5
end
if ClearFaults then
value = value + 512 -- Bit 9
end
log(value)