Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This gem provides basic xAP Automation protocol support for EventMachine applications. It was developed for use in Nitrogen Logic controller software. There are no automated tests and the code could be improved in many ways, but it may still be useful to someone.

This is a Ruby library written from scratch for communicating with a home automation network using the xAP protocol. Supports sending and receiving arbitrary xAP messages, triggering callbacks on certain received messages, etc. Also includes an implementation of an xAP Basic Status and Control device. Incoming xAP messages are parsed using an ad-hoc parser based on Ruby's String#split() and Array#map() (a validating Treetop parser is also available). Network events are handled using EventMachine.

This library strives to support all address wildcard modes and data types specified by the xAP specification as correctly as possible.

Read the examples under test/ to understand how to create your own applications using xap_ruby. All user-facing classes should have documenting comments.


xAP is a broadcast UDP protocol for interfacing disparate home automation systems and devices. Despite its weaknesses, xAP support is available for many DIY and enthusiast automation systems. For more information on xAP, visit


Add this line to your application's Gemfile:

gem 'xap_ruby'

Testing and Examples

There are no automated tests. You can test the code by running test/bscdev_test.rb to simulate an xAP BSC device, then running test/ and test/ on another machine.

  • test/bsdev_test.rb creates a dummy xAP Basic Status and Control device.
  • test/parser_test.rb tests the Treetop parser with a variety of xAP data types.
  • test/ uses netcat to send a network-wide xAP query message.
  • test/xap_receive.rb prints all xAP messages received from the network.

Users of xap_ruby

Submit a pull request if you use this library somewhere and would like a mention here.


(C)2012-2017 Mike Bourgeous (and any Git contributors), licensed under two-clause BSD (see LICENSE)


Ruby code for communicating with an xAP-based home automation network.



You can’t perform that action at this time.