Logic Machine Forum
Read 6 byte dpt - 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: Read 6 byte dpt (/showthread.php?tid=4744)



Read 6 byte dpt - electrokinisi - 30.04.2023

Hello 

I am working in energy meter Hager TXF that it server total input energy in 6 byte .
How to read it in wiser KNX  ? 

Regards .


RE: Read 6 byte dpt - admin - 01.05.2023

Use an event script to split the value. energy is 4 byte signed integer, tariff is 1 byte unsigned integer, tariffvalid / energyvalid are 1 bit booleans.
Code:
energy = busdatatype.decode(event.datahex:sub(1, 8), dt.int32)
tariff = tonumber(event.datahex:sub(9, 10), 16)
status = tonumber(event.datahex:sub(11, 12), 16)

tariffvalid = bit.band(status, 1) ~= 0
energyvalid = bit.band(status, 2) ~= 0

log(energy, tariff, tariffvalid, energyvalid)

grp.checkupdate('1/1/1', energy)
grp.checkupdate('1/1/2', tariff)
grp.checkupdate('1/1/3', tariffvalid)
grp.checkupdate('1/1/4', energyvalid)



RE: Read 6 byte dpt - electrokinisi - 18.06.2023

Hi thank you admin .