Skip to content

danielbowden/onkyo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onkyo-api

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

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/status"
{
  "status": {
    "main": {
      "source": "tv",
      "status": "on",
      "volume": 55
    },
    "zone2": {
      "source": "appletv",
      "status": "standby",
      "volume": 0
    }
  }
}

Controlling power status

PUT /onkyo/<zone>/power/<value>

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

Controlling volume

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

$ curl -X "PUT" "http://localhost:8080/onkyo/main/volume/55"
{
  "volume": 55,
  "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

Daniel Bowden

github.com/danielbowden

twitter.com/danielgbowden

About

Use a Raspberry Pi Zero to expose an API to my Onkyo Receiver for an iOS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages