SpaceLogic KNX Forum
Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.
Link copied. Please paste this link to share this article on your social media post.
Hello,
Does anybody integrate homeLYnk with a an Xenta 701?
There is an existing KNX instalation with homeLYnk and a central heating system/boiller managed by an Xenta 701.
Have a nice day,
Rafael Marculescu
Link copied. Please paste this link to share this article on your social media post.
Hi Rafael, could you please creat a Bfo technical case and ask team to test the integration.
This can be probably interesting for other members of SEC.
best regards,
Karina.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Hi Rafael and Ole Morten,
In thread you pointed Ole ([DEAD LINK /message/13220#13220]Re: spaceLynk/homeLynk logic controller as a KNX to Modbus gateway): I added a proposal for Modbus TCP server in spaceLYnk/homeLYnk.
Regards,
Lionel
Link copied. Please paste this link to share this article on your social media post.
Hi
If someone wont to dig down how everything works in HL/SL here an example how to read and write via modbus slave.
TIP. Writing many points are generating high processing load. It is good practice to do it only with change of value.
-------------------------------------------------------------------------------
Add to common functions
-------------------------------------------------------------------------------
-- modbus proxy
mbproxy = {
-- supported function list
functions = {
'readdo',
'readcoils',
'readdi',
'readdiscreteinputs',
'readao',
'readregisters',
'readai',
'readinputregisters',
'writebits',
'writemultiplebits',
'writeregisters',
'writemultipleregisters',
'reportslaveid',
'getcoils',
'getdiscreteinputs',
'getinputregisters',
'getregisters',
'setcoils',
'setdiscreteinputs',
'setinputregisters',
'setregisters',
},
-- new connecton init
new = function()
require('rpc')
local mb = setmetatable({}, { __index = mbproxy })
mb.slaveid = 0
mb.rpc = rpc.client('127.0.0.1', 28002, 'mbproxy')
for _, fn in ipairs(mbproxy.functions) do
mb[ fn ] = function(self, ...)
return mb:request(fn, ...)
end
end
return mb
end
}
-- set local slave id
function mbproxy:setslave(slaveid)
self.slaveid = slaveid
end
-- send rpc request for a spefic function
function mbproxy:request(fn, ...)
local res, err = self.rpc:request({
fn = fn,
params = { ... },
slaveid = self.slaveid or 0,
})
-- request error
if err then
return nil, err
-- request ok
else
-- reply with an error
if res[ 1 ] == nil then
return nil, res[ 2 ]
-- normal reply
else
return unpack(res)
end
end
end
-------------------------------------------------------------------------------
Handler (resident script with 0 delay) configuration
-------------------------------------------------------------------------------
1. mb:open('/dev/RS485', 38400, 'E', 8, 1, 'H')
set baudrate and other serial port parameters
2. mb:setslave(10)
set slave device id
3. mb:setmapping(10, 10, 10, 10)
set number coils, discrete inputs, holding registers and input registers
4. mb:setwritecoilcb(function(coil, value)...
callback function which is executed for each coil write
5. mb:setwriteregistercb(function(coil, value)...
callback function which is executed for each register write
-------------------------------------------------------------------------------
Handler script example
-------------------------------------------------------------------------------
-- modbus init
if not mb then
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 38400, 'E', 8, 1, 'H')
mb:connect()
-- slave id
mb:setslave(10)
-- init slave storage for coils, discrete inputs, holding registers and input registers
mb:setmapping(10, 10, 10, 10)
-- coil write callback
mb:setwritecoilcb(function(coil, value)
if coil == 0 then
grp.write('1/1/1', value, dt.bool)
else
alert('coil: %d = %s', coil, tostring(value))
end
end)
-- register write callback
mb:setwriteregistercb(function(register, value)
if register == 0 then
-- send value limited to 0..100
grp.write('4/1/5', math.min(100, value), dt.scale)
else
alert('register: %d = %d', register, value)
end
end)
end
-- server part init
if not server then
require('rpc')
-- incoming data handler
local handler = function(request)
local fn, res
fn = tostring(request.fn)
if not mb[ fn ] then
return { nil, 'unknown function ' .. fn }
end
if type(request.params) == 'table' then
table.insert(request.params, 1, mb)
res = { mb[ fn ](unpack(request.params)) }
else
res = { mb[ fn ](mb) }
end
return res
end
server = rpc.server('127.0.0.1', 28002, 'mbproxy', handler, 0.01)
end
mb:handleslave()
server:step()
-------------------------------------------------------------------------------
Example event script which changes modbus slave coil (address 0)
Must be mapped to a group address with binary value
-------------------------------------------------------------------------------
value = event.getvalue()
mb = mbproxy.new()
mb:setcoils(0, value)
-------------------------------------------------------------------------------
Example event script which changes modbus slave register (address 5)
Must be mapped to a group address with scaling (0..100) value
-------------------------------------------------------------------------------
value = event.getvalue()
mb = mbproxy.new()
mb:setregisters(5, value)
Link copied. Please paste this link to share this article on your social media post.
Daniel,
what is the reason to use this modbus proxy?
Link copied. Please paste this link to share this article on your social media post.
You need it when you use event based script to drop data to registry. If you make all in one resident script then you are fine.
Link copied. Please paste this link to share this article on your social media post.
I see, great!!
Link copied. Please paste this link to share this article on your social media post.
Tomas and Daniel, thank for your help, Ole also gave a practical example
hope Rafael got the answer to his question.
Thanks,
best regards,
Karina.
Link copied. Please paste this link to share this article on your social media post.
I've seen than commenting "alert" instruction comunication is much better.
Workig fine with magelis TCP client..
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.