Yamaha AV reciever voice control via Google Assistant

How to control your Yamaha reciever with LAN fuctions via voice – using Raspberry Pi and Google Home Mini.

see video 1st https://youtu.be/OnFLlMnTMZk

What you need (HW) :

  • AV reciever with LAN functions
  • Raspberry Pi to host simple bash scripts
  • Google Assistant voice control device like Google Home Mini

 

1. Reciever
Latest AV home recievers can be controled via Http. I am using Yamaha HTR-4071.
For full list of Yamahas API commands – see https://github.com/rsc-dev/pyamaha.
So you can power it on, off, control volume, select inputs etc – all without even touching reciever of remote. Just using Http command.

Example of such command can be – power on
http://192.168.1.149/YamahaExtendedControl/v1/main/setPower?power=on
Set volume to 80%
http://192.168.1.149/YamahaExtendedControl/v1/main/setVolume?volume=80
Set input to Spotify
http://192.168.1.149/YamahaExtendedControl/v1/main/setInput?input=spotify
To get info about reciever call
http://192.168.1.149/YamahaExtendedControl/v1/system/getDeviceInfo
To get list of features your reciever can do – call
http://192.168.1.149/YamahaExtendedControl/v1/system/getFeatures
You can find result of this call hosted here (JSON).
Here 192.168.1.149 is local IP of reciever in my network.

 

2. Raspberry Pi
Just create simple bash files calling API you want to use.
Example – file : yamaha_power_on.sh
curl http://192.168.1.149/YamahaExtendedControl/v1/main/setPower?power=on
Dont forget to make it executable by
chmod 777 yamaha_power_on.sh
Create at many files as you like, one for each command.

3. Particle cloud
Install Particle service to your raspbeppy so you can control your scripts from internet.
For setup refer to https://docs.particle.io or YouTube video
Once done, open Particle console and create your script.
Can look like this
void setup() {
Particle.subscribe("myAVRecieverTest", myHandler);
}
void loop() {
}
void myHandler(const char *event, const char *data)
{
if (strcmp(data,"off")==0) {
Process proc = Process::run("/home/pi/pepa/yamaha_power_off.sh");
proc.wait();
}
else if (strcmp(data,"on")==0) {
Process proc = Process::run("/home/pi/pepa/yamaha_power_on.sh");
proc.wait();
}
}

Next – verify code and proceed remote flash to your Pi – using icons at left side bar.

 

4. IFTTT
Open super-powerfull IFTTT at https://ifttt.com/. Create new applet.
1) If this : select google assistant – select „Say simple phrase“ – and choose your wording, press Create trigger.
2) Than what :
– select Particle – „Publish event“
– next „Then publish (Event Name)“ here insert value from particle script line 2 – in my case „myAVRecieverTest“
– next „The event includes (Data)“ insert values from if statement – in my case „on“ or „off“
– next make event Public. Press Create action and Finish.



5. Result
Conclusion : so once you say your voice command to Google assitant, if will trigget via IFTTT event at Particle cloud, which will trigger bash script at your raspberry, which will publish HTTP API call to Yamaha reciever. Magic is done here 🙂