Skip to content

Use a Raspberry Pi Zero to expose an API to my Onkyo Receiver for a link with bOS

Notifications You must be signed in to change notification settings

wweijtje/onkyo-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onkyo-api

Use a Raspberry Pi Zero to expose an API to my Onkyo Receiver for an iOS app or bOS integration.

Defaults by assuming the receiver is at 192.168.0.162, but can be updated using the /onkyo/discover

Install

$ python -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt

Run

$ ./app.py

Example Requests

Aggregates the results of several commands into an easy status response

GET /onkyo/status

$ curl "http://localhost:8080/onkyo/main/status"
{
  "status": {
    "main": {
      "source": "tv",
      "status": "on",
      "volume": 55
    },
    "zone2": {
      "source": "appletv",
      "status": "standby",
      "volume": 0
    }
  }
}

Discover devices

Will also set the first device found as default

POST /onkyo/discover

$ curl -X "POST" "http://localhost:8080/onkyo/discover"  

Controlling power status

POST /onkyo/<zone>/power/<value>

$ curl -X "POST" "http://localhost:8080/onkyo/main/power/on"
$ curl -X "POST" "http://localhost:8080/onkyo/main/power/standby"

Controlling volume

PUT /onkyo/<zone>/volume/<level>

$ curl -X "POST" "http://localhost:8080/onkyo/main/volume/55"
{
  "volume": 55,
  "zone": "main"
}

Changing TuneIn preset

PUT /onkyo/<zone>/tunein/preset

$ curl -X "PUT" "http://localhost:8080/onkyo/main/tunein/2"
{
  "preset": 2,
  "zone": "main"
}

Scheduled task

Run on startup on the Raspberry Pi as a task in crontab

$ crontab -e # edit cron table

@reboot /home/pi/.pyenv/shims/python3 /home/pi/bin/onkyo-server/app.py > /home/pi/logs/onkyo-server.log 2>&1 &

Author

Wout Weijtjens, Original repo forked from Daniel Bowden

github.com/danielbowden

twitter.com/danielgbowden

About

Use a Raspberry Pi Zero to expose an API to my Onkyo Receiver for a link with bOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Shell 5.1%