Project

irkit

0.02
No commit activity in last 3 years
No release in over 3 years
IRKit Client for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

IRKit

IRKit Client for Ruby

Requirements

  • Ruby2.0+
  • Mac OSX or Linux

Installation

for Mac

% gem install irkit

for Debian/Ubuntu Linux

% sudo apt-get install libavahi-compat-libdnssd-dev
% gem install irkit

irkit command

% irkit --help
% irkit --get  tv_on
% irkit --post tv_on
% irkit --post tv_on --address 192.168.0.123
% irkit --list
% irkit --delete tv_on

use Internet API

% irkit --device:add myhouse
% irkit --post tv_on --device myhouse
% irkit --device:delete myhouse

Usage

see samples

Read/Write IR-Data

IRKit has a HTTP-API that can be used from within the same LAN.

require 'irkit'

## find IRKit with Bonjour
irkit = IRKit::Device.find.first

## or, specify with IP-Address
irkit = IRKit::Device.new(address: '192.168.0.123')

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

ir_data = irkit.get_messages
unless ir_data
  STDERR.puts 'IR data not found'
  exit 1
end

p ir_data

puts 'rewrite IR data'
irkit.post_messages ir_data

Internet-API

To access IRKit from outside of the LAN, use Internet-API. It uses api.getirkit.com as a proxy.

Get clientkey and deviceid

irkit = IRKit::Device.find.first

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

token = irkit.get_token
puts "token: #{token}"
res = irkit.get_key_and_deviceid(token)

puts "clientkey:#{res.clientkey}"
puts "deviceid:#{res.deviceid}"

Read/Write with Internet-API

irkit = IRKit::InternetAPI.new(clientkey: "your-clientkey", deviceid: "your-deviceid")

unless irkit
  STDERR.puts 'device not found'
  exit 1
end

p irkit

unless ir_data = irkit.get_messages
  STDERR.puts 'IR data not found'
  exit 1
end

p ir_data.message

puts 'rewrite IR data'
irkit.post_messages ir_data.message

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request