local USEBROADCAST = false -- sw on off broadcast mode --- OBIS codes -------------------------------------------------------------------- local obisCache = { -- Voltages [3270] = { 0x5, 0x01, 0x02, 0x4F, 0x08 },-- ph 1 [5270] = { 0x5, 0x01, 0x02, 0x50, 0x08 }, [7270] = { 0x5, 0x01, 0x02, 0x51, 0x08 }, -- Currents [3170] = { 0x05, 0x01, 0x02, 0x4b, 0x08 }, -- ph 2 [5170] = { 0x05, 0x01, 0x02, 0x4c, 0x08 }, [7170] = { 0x05, 0x01, 0x02, 0x4d, 0x08 }, -- Active power [170] = { 0x05, 0x01, 0x02, 0x3A, 0x08 }, -- total [171] = { 0x05, 0x01, 0x02, 0x3F, 0x08 }, -- ph 1 [172] = { 0x05, 0x01, 0x02, 0x43, 0x08 }, -- ph 2 [173] = { 0x05, 0x01, 0x02, 0x47, 0x08 }, -- ph 3 -- Acitve energy [180] = { 0x05, 0x01, 0x02, 0x01, 0x08 }, -- total -- R. pos. energy [380] = { 0x05, 0x01, 0x02, 0x03, 0x08 }, -- R. neg. [480] = { 0x05, 0x01, 0x02, 0x04, 0x08 }, -- Freq. [580] = { 0x05, 0x01, 0x02, 0x52, 0x08 }, -- Power factor [581] = { 0x05, 0x01, 0x02, 0x3E, 0x08 }, -- R. power pos. [582] = { 0x05, 0x01, 0x02, 0x3C, 0x08 }, -- R. power neg. [583] = { 0x05, 0x01, 0x02, 0x3D, 0x08 }, [181] = { 0x05, 0x01, 0x02, 0x01, 0x20 } , -- tariff 1 [182] = { 0x05, 0x01, 0x02, 0x01, 0x38 } , -- tariff 2 [183] = { 0x05, 0x01, 0x02, 0x01, 0x50 } , -- 3 [184] = { 0x05, 0x01, 0x02, 0x01, 0x68 } , -- 4 -- Time [100] = { 0x05, 0x06, 0x02, 0x68, 0x08, 0x02, 0x68, 0x18, 0x02, 0x68, 0x20, 0x02, 0x68, 0x28, 0x02, 0x68, 0x30, 0x02, 0x68, 0x38, }, } SRNMsample = {0x7E, 0xA0, 0x0A, -- frame type and length 0x00, 0x00, -- upper HDLC address 0x00, 0x00, -- lower dest address 0x21, -- source address (client) 0x01 0x93, -- frame type SNRM 0x00, 0x00, -- now CRC 0x7E -- HDLC frame closing flag } AARQsample = {0x7E, 0xA0, 0x3A, -- frame type and length 0x00, 0x00, 0x00, 0x00, -- now dest address 0x21, 0x10, 0x0, 0x0, -- HEADER CRC 0xE6, 0xE6, 0x00, -- llc 0x60, 0x29, -- tag and length 0xa1, 0x09, 0x06, 0x07, 0x60, 0x85, 0x74, 0x05, 0x08, 0x01, 0x02, 0xa6, 0x0a, 0x04, 0x08, 0x45, 0x47, 0x4d, 0x30, 0x35, 0x38, 0x32, 0x39, 0xBE, 0x10, 0x04, 0x0E, 0x01, 0x0, 0x0, 0x0, 0x06, 0x5F, 0x1F, 0x04, 0x00, 0x1C, 0x1B, 0x20, 0x0, 0x80, -- 0x0, 0x0, -- CRC 0x7E}; DSCsample = {0x7E, 0xA0, 0x0A, -- frame type and length 0x00, 0x00, 0x00, 0x00, -- now dest address 0x21, 0x53, 0x00, 0x00, -- now CRC 0x7E}; local err_cnt = 0; local step_Ok = 0; local alreadyRead = false; local timeStmp = 0; local POLLTIME = 60; local repliesCache = {} -- copy here meter's replies --------------------------------------------------------------------- function createDevices () addDevice({name = "R", shift = 0, base = 10, xtraFields = {96, 1, 3, 0, 0}}) end -- Turn to your local representative for more information.