Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

spaceLynk/homeLynk logic controller as a KNX to Modbus gateway

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.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • Light and Room Control
  • SpaceLogic KNX Forum
  • spaceLynk/homeLynk logic controller as a KNX to Modbus gateway
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Thomas_Rohde
Sisko Thomas_Rohde Sisko
121
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
54
Heribert_Dölger
Lt. Commander Heribert_Dölger Lt. Commander
30
FZetina
Lt. Commander FZetina Lt. Commander
27
View All
Related Products
product field
SpaceLogic KNX - 4ʺ Touch Unit
product field
KNX Push Button Dynamic Labeling, universal
product field
Wiser for KNX : logic controller

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SpaceLogic KNX Forum
Solved
olemotor
Commander olemotor Commander
Commander

Posted: ‎2014-08-14 01:24 AM . Last Modified: ‎2024-07-15 12:06 AM

2 Likes
5
1375
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-14 01:24 AM

spaceLynk/homeLynk logic controller as a KNX to Modbus gateway

Hello,

Has anyone knowledge about where to find complementary information about or even better a LUA script example for configuring a spaceLynk logic controller as a Modbus TCP server or secondary a Modbus RTU slave and link KNX objects/GAs to Modbus registers?

The intention is to provide KNX data to a Modbus TCP client/RTU Master.

Ole Morten
  • Thumbnail of SpaceLogic KNX - 4ʺ Touch Unit
    SpaceLogic KNX - 4ʺ Touch Unit
  • Thumbnail of KNX Push Button Dynamic Labeling, universal
    KNX Push Button Dynamic Labeling, universal
  • Thumbnail of Wiser for KNX : logic controller
    Wiser for KNX : logic controller
View products (3)
Tags (5)
  • Tags:
  • gateway
  • homelynk
  • knx
  • modbus
  • spacelynk
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
sesa299442
sesa299442 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2014-08-15 05:33 AM

3 Likes
2
1197
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-15 05:33 AM

Hello Ole,

the most basic script for HL to act as modbus tcp server can looks like this:

-- modbus init

if not mb then

  require('luamodbus')

  mb = luamodbus.tcp()

 

  --open port 502 for modbus tcp connection

  mb:open('*', 502)

  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)

  --initialize holding register address5=13, address6=15

  mb:setregisters(5,13,15)

 

  -- define register write callback

  mb:setwriteregistercb(function(register, value)

      alert("register %d has been changed to %d", register, value)

  end)

 

end

--returns value of 2 registers starting by address 5, it is performed in every cycle of the script

reg5, reg6 = mb:getregisters(5,2)

log('reg5=',reg5)

log('reg6=',reg6)

--waits for incomming indication from master and sends reply

mb:handleslave()

You can access to your holding registers using fucntions getregisters(). But it may be usefull to use and define some callback function, which will execute everytime, there is some writing event to some register.

In homeLYnk user guide, there can be found more function, which can be use for your purposes. Refer to the chapter 3.5 Slave Mode Functions.

See Answer In Context

Reply
Replies 5
sesa299442
sesa299442 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2014-08-14 07:12 AM

2 Likes
4
1197
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-14 07:12 AM

Hello,

here is a simple example of controlling the iACT24 via  Smartlink TCP from homeLYnk script.

The address of Smartlink is 10.154.12.75.

Modbus TCP port of Smartlink is set to 502.

iAct24 contactor is connected to the port 6 oo Smartlink.

This resident script can be used for reading status of the contactor:

require('luamodbus')

mb = luamodbus.tcp()

-- IP: 192.168.1.2, port: 1234

mb:open('10.154.12.75', 502)

mb:connect()

--read status register of the contactor

cont_status = mb:readregisters(14400)

-- Write contactor status to the grp address

-- 0: comm. fault, 1: comm. fault, 2: cont. open, 3: cont. closed

grp.write('1/1/1', cont_status)

mb:close()

This event driven script can be used to create a open command to the contactor (driven by grp address 1/1/2):

require('luamodbus')

mb = luamodbus.tcp()

mb:open('10.154.12.75', 502)

mb:connect()

if grp.getvalue('1/1/2') then

  mb:writeregisters(14401, 1) 

  log('Contactor has been opened.')

end

mb:close()

This event driven script can be used to create a close command to the contactor (driven by grp address 1/1/3):

require('luamodbus')

mb = luamodbus.tcp()

mb:open('10.154.12.75', 502)

mb:connect()

if grp.getvalue('1/1/3') then

  mb:writeregisters(14401, 2) 

  log('Contactor has been closed.')

end

mb:close()

Best Regards

Tomas

Reply
olemotor
Commander olemotor Commander
Commander

Posted: ‎2014-08-14 10:56 AM

0 Likes
3
1197
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-14 10:56 AM

Thank you for these interesting script examples which I believe demonstrates the homeLynk as an Modbus TCP client and the Smartlink is the Modbus TCP server.

Do you have examples of the other way around, meaning the homeLynk being the Modbus TCP server responding to TCP connections and Modbus reads and writes from a third-party Modbus TCP client?

-which function makes the homeLynk listening for connections on port 502?

-which functions defines registers and their values in the homeLynk (coils and discrete inputs, input and holding registers)?

Ole Morten
Reply
sesa299442
sesa299442 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2014-08-15 05:33 AM

3 Likes
2
1198
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-15 05:33 AM

Hello Ole,

the most basic script for HL to act as modbus tcp server can looks like this:

-- modbus init

if not mb then

  require('luamodbus')

  mb = luamodbus.tcp()

 

  --open port 502 for modbus tcp connection

  mb:open('*', 502)

  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)

  --initialize holding register address5=13, address6=15

  mb:setregisters(5,13,15)

 

  -- define register write callback

  mb:setwriteregistercb(function(register, value)

      alert("register %d has been changed to %d", register, value)

  end)

 

end

--returns value of 2 registers starting by address 5, it is performed in every cycle of the script

reg5, reg6 = mb:getregisters(5,2)

log('reg5=',reg5)

log('reg6=',reg6)

--waits for incomming indication from master and sends reply

mb:handleslave()

You can access to your holding registers using fucntions getregisters(). But it may be usefull to use and define some callback function, which will execute everytime, there is some writing event to some register.

In homeLYnk user guide, there can be found more function, which can be use for your purposes. Refer to the chapter 3.5 Slave Mode Functions.

Reply
olemotor
Commander olemotor Commander
Commander

Posted: ‎2014-08-17 10:35 PM

0 Likes
1
1197
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-08-17 10:35 PM

Hi Tomas,

Thanks again for brilliant examples that are very helpful in understanding the use of modbus in homeLynk and spaceLynk.

Ole Morten
Reply
lfiat
Ensign lfiat
Ensign

Posted: ‎2014-10-23 07:14 AM

3 Likes
0
1197
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-23 07:14 AM

Hi all,

We developed an Application Note (I attached it) to connect in both directions a spaceLYnk (or homeLYnk) with SmartStruxureLite (SSL) MPM controler via Modbus TCP: in this solution spaceLYnk (or homeLYnk) is a Modbus TCP server.

This Application Note is not fully validated (document has to be reviewed) but can be reused for your usage using only the scripts for spaceLYnk in spaceLYnk (or homeLYnk) = restore the script backup in AN package: AN009_v1-0_MBTCP_SL-SSL_script.tar

(we used it to exchange with a comX200 to read data in spaceLYnk and we have no issue).

All data presented to be read by a Modbus is 4bytes size but obviously you can set a boolean in a 4bytes register and your client has to know to read only the right bit (registers are seen with comX200 with LittleEndian)

So the principle to use the spaceLYnk script is quite simple:

* in spaceLYnk (or homeLYnk) you want to export a KNX object via Modbus TCP, the Modbus TCP client will read it

Principle: 1/1/1 object => you tag it via spaceLYnk object table with TAG 1 : NOTIFIED_TO_SSL_VIA_MBTCP  + , + TAG 2: unique index number between 1 to 100)

real example for 3 KNX objects:

      - 1/1/1 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 1

      - 1/2/5 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 2

      - 1/2/6 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 3

=> the second TAG is an index in Modbus register table of 4 bytes per line:

to read with a Modbus TCP client:

- 1/1/1 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 1    => set in  Modbus TCP client: register = 1 (with 2 or 4 bytes register size)

- 1/1/5 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 2    => set in  Modbus TCP client: register = 3 (with 2 or 4 bytes register size)

- 1/1/6 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 3    => set in  Modbus TCP client: register = 5 (with 2 or 4 bytes register size)

* in spaceLYnk (or homeLYnk) you want to export a KNX object via Modbus TCP, the Modbus TCP client will write it:

Principle: 1/1/1 object => you tag it via spaceLYnk object table with TAG 1 : NOTIFIED_BY_SSL_VIA_MBTCP  + , + TAG 2: unique index number between 1 to 100)

real example for 3 KNX objects:

      - 1/1/1 object TAG = NOTIFIED_BY_SSL_VIA_MBTCP  , 1

      - 1/2/5 object TAG = NOTIFIED_BY_SSL_VIA_MBTCP  , 2

      - 1/2/6 object TAG = NOTIFIED_BY_SSL_VIA_MBTCP  , 3

=> here be careful: we didn't test with a standard Modbus TCP client (SmartStruxureLite (SSL) MPM controler uses 2 Modbus messages to write Modbus registers so it means it may not work with a standard Modbus TCP client! (but we can do an evolution: futhermore we interested in a real business case to complete and validate a new Application Note: simple Modbus TCP server in spaceLYnk using our spaceLYnk to SSL MPM Application Note)

Full example with read registers and write registers (second TAG has to be unique between read registers and write registers) :

- 1/1/1 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 1

- 1/2/5 object TAG = NOTIFIED_BY_SSL_VIA_MBTCP , 2

- 1/2/6 object TAG = NOTIFIED_BY_SSL_VIA_MBTCP , 3

- 1/2/7 object TAG = NOTIFIED_TO_SSL_VIA_MBTCP, 4

Don't hesitate if you need more help and notify your need: we may also consider to industrialize a solution through an Application Note.

Regards,

Lionel

Attachments
AN009_v1-0_spaceLYnk_and_SmartStruxureLite_integration_ via_Modbus_TCP_v1.0.zip
Reply
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of