13.10.2021, 18:21
(This post was last modified: 13.10.2021, 18:28 by Erwin van der Zwart.)
(12.10.2021, 07:38)Kilogica Wrote: Hello Erwin,
I have one question: we have an EVF2S22P44R by SE, is it natively Modbus TCP compatible or not? And if not, is there some add-on to provide for making it compatible?
Thank you for your help
Yes it should have modbus as i already integrated this one on a project.. I disabled the not needed registers but kept them in the script
Code:
require('luamodbus')
mb = luamodbus.tcp()
-- Read Socket 1
mb:open('192.168.1.200', 502)
mb:connect()
mb:setslave(255)
--s1AL1 = mb:readregistervalue(350, 'float32', 'w') -- Current Phase 1
--s1AL2 = mb:readregistervalue(352, 'float32', 'w')
--s1AL3 = mb:readregistervalue(354, 'float32', 'w')
s1ET = mb:readregistervalue(356, 'uint32', 'w') -- Energy Total
--s1PT = mb:readregistervalue(358, 'float32', 'w') -- Current Power
--s1VL1L2 = mb:readregistervalue(360, 'float32', 'w') -- Voltage Phase 1 - Phase 2
--s1VL2L3 = mb:readregistervalue(362, 'float32', 'w')
--s1VL3L1 = mb:readregistervalue(364, 'float32', 'w')
--s1VL1N = mb:readregistervalue(366, 'float32', 'w') -- Voltage Phase 1 - Neutral
--s1VL2N = mb:readregistervalue(368, 'float32', 'w')
--s1VL3N = mb:readregistervalue(370, 'float32', 'w')
--log(s1AL1,s1AL2,s1AL3,s1ET,s1PT,s1VL1L2,s1VL2L3,s1VL3L1,s1VL1N,s1VL2N,s1VlLN)
mb:close()
-- Read Socket 2
mb:open('192.168.1.201', 502)
mb:connect()
mb:setslave(255)
--s2AL1 = mb:readregistervalue(350, 'float32', 'w')
--s2AL2 = mb:readregistervalue(352, 'float32', 'w')
--s2AL3 = mb:readregistervalue(354, 'float32', 'w')
s2ET = mb:readregistervalue(356, 'uint32', 'w')
--s2PT = mb:readregistervalue(358, 'float32', 'w')
--s2VL1L2 = mb:readregistervalue(360, 'float32', 'w')
--s2VL2L3 = mb:readregistervalue(362, 'float32', 'w')
--s2VL3L1 = mb:readregistervalue(364, 'float32', 'w')
--s2VL1N = mb:readregistervalue(366, 'float32', 'w')
--s2VL2N = mb:readregistervalue(368, 'float32', 'w')
--s2VL3N = mb:readregistervalue(370, 'float32', 'w')
--log(s2AL1,s2AL2,s2AL3,s2ET,s2PT,s2VL1L2,s2VL2L3,s2VL3L1,s2VL1N,s2VL2N,s2VL3N)
mb:close()
-- Sum Socket 1 and Socket 2
tET = s1ET + s2ET -- Sum energy total of socket 1 and 2
tETrounded = math.round(tET/1000,0) -- Total S + S2 from Wh to kWh
s1ET = math.round(s1ET/1000,0) -- Socket 1 from Wh to kWh
s2ET = math.round(s2ET/1000,0) -- Socket 2 from Wh to kWh
grp.checkupdate('4/1/22', s1ET) -- Update values
grp.checkupdate('4/1/23', s2ET)
grp.checkupdate('4/1/19', tETrounded)