Stand up a REST service using Express and NodeJS (primarily) to interact with a Yamaha RX-A730 Home Theater Receiver.
Creates local webservice endpoints which process functions against the Yamaha Receiver. This can be used in conjunction with any front end client you may desire such as Google Home, Alexa, iOS shortcut, or write an app for your devices.
This is what will be wired up to Google Home Webhooks (eventually)
- Volume Up by sending
POSTto/receiver/turnItUp - Volume Down by sending
POSTto/receiver/turnItDown - Power On by sending
POSTto/receiver/powerOn - Power Off by sending
POSTto/receiver/powerOff - Get Volume by sending
GETto/receiver/getVolume - Get Power Status by sending
GETto/receiver/getPowerStatus
All assuming that the webservice is running 192.168.1.2:6969
- Get the current volume level
Request:
curl http://192.168.1.2:6969/receiver/getVolumeResponse:Volume is: -350dB
- Get the current power status
Request:
curl http://192.168.1.2:6969/receiver/getPowerStatusResponse:Power Status is: Standby
- Increase the volume up by 15 DB (1.5 unit on receiver)
Request:
curl -X POST http://192.168.1.2:6969/receiver/turnItUpResponse:Volume adjusted from -350 to -335 successfully.
Clone this repo, install the dependencies from package.json, start the webServer.
git clone https://github.com/cps5155/yamaha-receiver-api.gitTraverse into the project folder
cd yamaha-receiver-apiUse npm to install the required libraries
npm installStart the webserver using the appropriate syntax & supply it your yamaha-receiver's MAC address. This depends on what you're using to run
- For Windows (git bash)
node ./lib/webServer.js -MAC=AA:BB:CC:DD:EE:FF- For MacOS (zshrc)
node ./lib/webServer.js --MAC=AA:BB:CC:DD:EE:FF- For other OS, try a combination of the above or use a lowercase mac address as needed
If you start the server on a network where the MAC address provided via CLI is not found, it will default to use localhost:80 as the "target". When you are using localhost as your target, you should be running the receiver-mockResponse.js in the background so that the mock responses are sent back to the webServer as if the receiver was on the network. Future enhancement will start the receiver-mockResponse.js as a child process of the webserver when localhost is being used (so you don't have to remember to start/stop it manually to test).
Logs can be found in ./logs/ directory.
- any security, whatsoever
- start mock webserver subprocess when localhost is being used
- add init.d example for auto daemon startup on Raspi
- Raspi 1st gen (running Wheezy)
- Git bash on Windows
- Yamaha RX-A730 Home Theater Receiver