Skip to content

tcharp/knx.net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KNX.net

KNX.net provides a KNX API for C#

This API allows to connect in both modes:

  • Tunneling
  • Routing

After connecting you will be able to send actions to the bus and receive messages from it.

The following datapoints are available in the API:

  • bit (lights, buttons)
  • byte (dimmers, temperature difference, RGB)
  • 9.001 (temperatures)

There may be some bugs on the implementation as I don't have access to KNX documentation, many information about the protocol is from OpenRemote Knowlodge Base.

Examples

Connecting using Routing (turn off and on a light)

static void Main(string[] args)
{
  var connection = new KNXConnectionRouting();
  connection.Connect();
  connection.KNXEventDelegate += new KNXConnection.KNXEvent(Event);
  connection.Action("5/0/2", false);
  Thread.Sleep(5000);
  connection.Action("5/0/2", true);
  Thread.Sleep(5000);
}
static void Event(string address, string state)
{
  Console.WriteLine("New Event: device " + address + " has status " + state);
}

Working with 9.001 datapoints

Sending an action

connection.Action("1/1/16", connection.toDPT("9.001", 24.0f));

Converting status from event

float temp = (float)connection.fromDPT("9.001", state);

Connecting using Tunneling

The only difference is how the connection object is created

connection = new KNXConnectionTunneling(remoteIP, remotePort, localIP, localPort);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%