portakalkoku Posted July 5, 2017 Share Posted July 5, 2017 Hi; I know that there is a KNX Network driver which allows us to control KNX System. But i'm really curious about how the driver make a connection with KNX IP device. I did some research and found that need to send "connection request" to IP device. First, i created a connection with C4:CreateNetworkConnection(6001,my_ip_address,"UDP") Second, i connected to device C4:NetConnect(6001,3671), and got some feedback related that i have successfully connected to device. But after that, i suppose i need to send some connection request which is a hexadecimal data to send telegrams to IP device with C4:SendToNetwork(). But i can't figure out how to use hexadecimal data in C4:SendToNetwork() function. For example; the KNX Network Driver gives that output while it sending a connect request: -----> CONNECT_REQUEST 06 10 02 05 00 1A 08 01 C0 A8 05 3B 8A 3D 08 01 C0 A8 05 3B A4 3A 04 04 02 00 And get that response <----- CONNECTIONSTATE_RESPONSE [8] 06 10 02 08 00 08 08 00 I want to send this data "06 10 02 05 00 1A 08 01 C0 A8 05 3B 8A 3D 08 01 C0 A8 05 3B A4 3A 04 04 02 00" with C4:SendToNetwork() to specific binding. Thank you ! Any help is appreciated. Link to comment Share on other sites More sharing options...
RyanE Posted July 5, 2017 Share Posted July 5, 2017 5 hours ago, portakalkoku said: i need to send some connection request which is a hexadecimal data to send telegrams to IP device with C4:SendToNetwork(). But i can't figure out how to use hexadecimal data in C4:SendToNetwork() function. For example; the KNX Network Driver gives that output while it sending a connect request: All data going through SendToNetwork is binary data. You just need to generate the binary data. You can either build it as strings, using tohex: local mydata = tohex('06 10 02 05 00 1A 08 01 C0 A8 05 3B 8A 3D 08 01 C0 A8 05 3B A4 3A 04 04 02 00') Or you can use string.pack to build the string. It works by binary packing data into the structure based on size (and big/little endianness) of data. That's the way the KNX Network driver does it, since it knows what the structure should be, and builds it that way. local packet = string.pack("bb>HHbbbbbbHbbbbbbHbbbb", HEADER_SIZE, KNXNETIP_VERSION, CONNECT_REQUEST, 0x001A, HPAI_LENGTH, IPV4_UDP, caddr1, caddr2, caddr3, caddr4, gCtrlPort, HPAI_LENGTH, IPV4_UDP, caddr1, caddr2, caddr3, caddr4, gDataPort, 04, TUNNEL_CONNECTION, 02, 00) Just out of curiosity, why are you wanting to make a new KNX Network driver? It's pretty complicated. RyanE Link to comment Share on other sites More sharing options...
portakalkoku Posted July 6, 2017 Author Share Posted July 6, 2017 Hi RyanE thank you for your reply. I have both KNX and Control4 systems in my house. I use Berker B.IQ Thermostats and they don't work properly with current KNX Thermostat and KNX Network drivers. I can not receive any feedback on Control4 side when i change something manually from B.IQ itself. I've been experiencing this issue for nearly 2 years, and i have contacted distributor in my country, they couldn't help about it. And i also opened a topic about it in this forum. Here is the link : So i decided to solve it myself. Actually i would very much rather customize the current KNX Network driver for Berker B.IQ than write it from scratch; but it's encrypted. Thanks in advance. Link to comment Share on other sites More sharing options...
RyanE Posted July 6, 2017 Share Posted July 6, 2017 Right, but the Network driver isn't specific to any particular type of device. You should be able to modify the knx_thermostat driver for your Berker Thermostat, and that driver is not encrypted. It shows you how you can *use* the KNX network driver, which can send / receive most of the common DPTs. The Thermostat driver registers which Group Addresses it wants to get asynchronous updates about, and sends values to those Group Addresses through the network driver. RyanE Link to comment Share on other sites More sharing options...
portakalkoku Posted July 7, 2017 Author Share Posted July 7, 2017 19 hours ago, RyanE said: Right, but the Network driver isn't specific to any particular type of device. You should be able to modify the knx_thermostat driver for your Berker Thermostat, and that driver is not encrypted. It shows you how you can *use* the KNX network driver, which can send / receive most of the common DPTs. The Thermostat driver registers which Group Addresses it wants to get asynchronous updates about, and sends values to those Group Addresses through the network driver. RyanE Thank you Ryan, i'll try. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.