StrDn2030
TODO: Write a gem description
Installation
gem 'str_dn_2030'
gem 'sinatra'
Or install it yourself as:
$ gem install str_dn_2030
Usage
as a Ruby library
Connect
require 'str_dn_2030'
remote = StrDn2030.new('x.x.x.x')
remote.connect
zone = remote.zones(0)
See status
p zone.volume
p zone.powered_on?
p zone.muted?
p zone.headphone?
Control input
input = zone.active_input
p input.name
p input.preset_name
p zone.inputs
zone.inputs['Chrome'].activate!
zone.active_input = zone.inputs['Apple TV']
Control volume
zone.volume = 30
zone.mute = true
zone.mute = false
HTTP interface
require 'str_dn_2030'
require 'str_dn_2030/web'
remote = StrDn2030::Remote.new('x.x.x.x')
remote.connect
StrDn2030::Web.set :remote, remote
run StrDn2030::Web
curl http://localhost:9292/zones/0
curl http://localhost:9292/zones/0/inputs
curl http://localhost:9292/zones/0/volume
curl -X PUT \
-H 'Content-Type: application/json' \
-d '{"volume": 25}' \
http://localhost:9292/zones/0/volume
curl -X PUT \
-H 'Content-Type: application/json' \
-d '{"mute": true}' \
http://localhost:9292/zones/0/volume
curl 'http://localhost:9292/zones/0/inputs/Apple+TV'
curl -X POST 'http://localhost:9292/zones/0/inputs/Apple+TV/activate'
curl http://localhost:9292/zones/0/active
curl -X PUT \
-H 'Content-Type: application/json' \
-d '{"input": "Apple TV"}' \
http://localhost:9292/zones/0/active
Contributing
- Fork it ( https://github.com/sorah/str_dn_2030/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request