Interface to KNX using LAN interface This document will show you how you can interface to the KNX system, control it and get status from the KNX system. So, what can it do for me? Below you find a feature list: 1. Interface directly to the KNX network without using a 3rd party gateway. 2. Send any group address to the KNX system 3. Receive an update whenever a KNX unit is changing state. Requirement You must use Neets Control system that can control LAN devices. One free LAN connection in the project that must interface to the KNX. You need to use script code in order to send and receive KNX group address. A KNX IP interface that supports KNXnet/IP / KNX TP tunneling. Tested and verified: Gira KNX IP interface, PN: 216800/100 Minimum module version 2.9.7 when using Neets Project Editor. Neets Project Designer version 1.1.0 or higher. Knowledge of what and how KNX group address is working Limitations Only possible to control ON/OFF group address. Only possible to receive new state on ON/OFF group address. Most IP interfaces only allow one connection. Therefore, you should have one Interface box for each Control system which should connect to the KNX. Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX How-to get started (Project Editor). This section will take you through the step of adding KNX support to you project. 1. Make a new project or open an existing project. 2. Add the “Neets –KNX IP interface” (The device is found on Neets.dk under application notes) device to you project and enter the IP address of the KNX IP interface you want to connect to. 3. It is recommended to assign a static IP address to the KNX IP interface using the KNX ETS software. Remember to always add the “Neets –KNX IP interface” device as the first device on the LAN port. 4. In the “Global variables” under “System code” add: #define KNX_LAN_DEVICE 1 #define KNX_LAN_DEVICE 1 5. Now in the “Global functions” in “System code” the function to handle incoming group address changes must be included. Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX Now your system is ready to connect to the KNX interface. Next step is to handle and send command to the KNX network. Changing the state of a group address. When you want to change the state of group address, you have to use the built-in function: fnKNXSendONOFFGroupAddress. You can use the fnKNXSendONOFFGroupAddress like any other function anywhere in the script code. If you want a button press to trigger the transition there are two options: 1. Option You can convert any button to code and include the function like this: In this case, we would like to change group address “0/1/5” to 1. This is done like this: 2. Option The code script offers the possibility to add a key press event Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX listener. This is done by adding the #define GET_KEYPRESS_EVENT in the “Global variables” section. When using the GET_KEYPRESS_EVENT you also need to add the two functions fnKeyDown and fnKeyUp in the “Global function” section like this: fnKeyDown(KeyId){ if(KeyId == 25){//When the key with id number 25 is presse send a group address fnKNXSendONOFFGroupAddress("0/0/3", 1); } } fnKeyUp(KeyId){ } It is important that both functions are added to your project even if you only use one of them. Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX How-to get started (Project Designer). This section will take you through the step of adding KNX support to you project. 1. Make a new project or open an existing project. 2. Add the “Neets –KNX IP interface” (The device is found on Neets.dk under application notes) device to you project and enter the IP address of the KNX IP interface you want to connect to. 3. It is recommended to assign the KNX IP interface a static IP address using the KNX ETS software. Remember to always add the “Neets –KNX IP interface” device as the first device on the LAN port. 4. Now open the “system code” dialog that can be found in the “Assign functions” 5. In the “Global variables” add: #define KNX_LAN_DEVICE 1 Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX 6. Now in the “Global functions” in “system code” the function to handle incoming group address changes must be included: Now your system is ready to connect to the KNX interface. Next step is to handle and send command to the KNX network. Changing the state of a group address. When you want to change the state of group address, you have to use the built-in function: fnKNXSendONOFFGroupAddress. You can use the fnKNXSendONOFFGroupAddress like any other function anywhere in the script code. If you want a button press to trigger the transition you do like the following. You can add “Script code” function to a button of your choice like this: Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX If you want to change group address “0/1/5” to 1. This is done like this: Handling incoming group addresses. When the Control System get a notification from the KNX network that a group address has changed its state, we need to check if the group address that has changed has any effect on our system. You do this by comparing the incoming data in the fnKNXGroupAddressChange like this: In this case we would like the led on button to light when group address “0/0/3” is 1 and off when is it 0. fnKNXGroupAddressChange(GroupAddress[], Value){ //Handle incomming Group address if(!strcmp(GroupAddress, "0/0/3")){ //We have a match if(Value){ IOKeyboardSetLed(1, LedOn); }else{ IOKeyboardSetLed(1, LedOff); } } } In this case, we would like to press button with id number 34 when group address “0/5/85” is 1. fnKNXGroupAddressChange(GroupAddress[], Value){ //Handle incomming Group address if(!strcmp(GroupAddress, "0/5/85")){ //We have a match if(Value){ @KeyPressed(34); } } } Debugging connection to KNX If you have problems, connecting to the KNX interface you can enable the KNX debug option. This will start transmitting debug information on RS232 port 1. You enable it by adding #define KNX_DEBUG in the “Global variables” like this: If you want to change the debug port you can do this by using the following defines. Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX #define KNX_DEBUG_PORT 2 Define the port number that the debug information should be send too. This port apply for both LAN and RS232 ports #define KNX_DEBUG_LAN Define that the debug out should use a LAN connection instead of an RS232 port. When using ether RS232 of LAN as debug out remember to assign a device to the port you have selected (This is done in the Project overview and need to be done in-order to setup the port communications settings). Neets A/S • Langballe 4 • 8700 Horsens • Denmark • Phone: +45 75 666 099 • E-Mail: [email protected] Doc#: 499-019 REV1 LAN interface to KNX
© Copyright 2024 ExpyDoc