Seluxit / ruby_home

HomeKit support for the Rubyist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maintainability Build Status

ruby_home

ruby_home is an implementation of the HomeKit Accessory Protocol (HAP) to create your own HomeKit accessory in Ruby. HomeKit is a set of protocols and libraries to access devices for home automation. A non-commercial version of the protocol documentation is available on the HomeKit developer website.

Installation

Add this line to your application's Gemfile:

gem 'ruby_home'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby_home

Usage

Create a fan with an on/off switch.

require 'ruby_home'

accessory_information = RubyHome::AccessoryFactory.create(:accessory_information)
fan = RubyHome::AccessoryFactory.create(:fan)

fan.characteristic(:on).on(:updated) do |new_value|
  if new_value == 1
    puts "Fan switched on"
  else
    puts "Fan switched off"
  end
end

RubyHome::Broadcast.run

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/karlentwistle/ruby_home.

About

HomeKit support for the Rubyist

License:MIT License


Languages

Language:Ruby 99.9%Language:Shell 0.1%