Project

knx

0.0
No commit activity in last 3 years
No release in over 3 years
Constructs KNX standard datagrams that make it easy to communicate with devices on KNX networks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 11
~> 3.5
~> 0

Runtime

~> 2.3
 Project Readme

Ruby KNX

Constructs KNX standard datagrams that make it easy to communicate with devices on KNX networks. It does not implement the transport layer so you can use it with native ruby, eventmachine, celluloid or the like.

Build Status

You'll need a gateway. I recommend one that supports TCP/IP such as MDT Interfaces however you can use multicast groups if your network is configured to allow this.

Install the gem

Install it with RubyGems

gem install knx

or add this to your Gemfile if you use Bundler:

gem 'knx'

Usage

require 'knx'

knx = KNX.new
datagram = knx.read(byte_string)

datagram.source_address.to_s
# => '2.3.4'

datagram.destination_address.to_s
# => '3/4/5'

datagram.data # Returns a byte array
# => [1]

# ...

request = knx.action('1/2/0', true)
byte_string = request.to_binary_s

request = knx.action('1/2/3', 150)
byte_string = request.to_binary_s

# Send byte_string to KNX network to execute the request
# Supports multicast, unicast and TCP/IP tunneling (when supported)

We also support KNX BAOS devices devices:

require 'knx/object_server'

os = KNX::ObjectServer.new
datagram = os.read(byte_string)

# Can return multiple values
datagram.data.length #=> 1

# Get the item index we are reading
datagram.data[0].id
# => 12

datagram.data[0].value # Returns a binary string
# => "\x01"

# ...

request = os.action(1, true)
byte_string = request.to_binary_s

# Send byte_string to KNX BAOS server to execute the request
# This protocol was designed to be sent over TCP/IP

License and copyright

MIT