HCP #4 Control your Yamaha Home Receiver from command line
Now, this is great to listen to you music from anywhere, using a computer or an audio software. But if you want to listen to your radio stream in your home, with your Home Receiver, then you might need to do more configuration...
First, use an audio cable to connect your Raspberry Pi to your Home Receiver.
The audio cable will go to your "AUX" port. On my Yamaha, I plugged it in AUDIO1.
The MPD software we use on the Pi will output the stream via the Raspberry audio output, as long as you configured it in MPD.
If you switch your audio channel with your Yamaha remote control, you will hear your radio ! So that's pretty good.
Next, what I wanted to do is to turn on the audio when I wake up in the morning. So I won't need any alarm clock, and my personal streaming radio will be turned on automatically and wake me up.
This may seem complicate, but I assure you that it's not ! The real issue is "how to communicate with my Home Receiver ??"
Well, of course you will need a Home Receiver that is connected to your local network. Mine is a Yamaha RX-V671 and I'll explain how I did the explained task. This should work with any model that can connect to your network.
You should already know that your Yamaha can be controlled by other things than your remote control. A mobile app for example. But also a web interface, that can be accessed from any browser.
From your local network, use Google Chrome (important) and navigate to the IP address of your Home Receiver. Just try them all (192.168.1.X) until you arrive on a web interface that allows you to control some of your Yamaha parameters (channel, audios, etc).
Locate the action that will set the channel to AUDIO1 (or the one you plugged your cable in). By running the action, you will normally hear your audio stream, as the channel will be turned on. Once located, open the Google Developer tool with F12 and go in the "Network" tab.
Now, re-do the action and analyse the request that are being triggered. If you analyse the Request Playload, you will easily spot the right request. Right Click on the request will allow you to copy the request as cURL request. And that's totally wonderful.
From any command line, from a computer in local network (and thus, from your Pi), try to run the command line that Google provided you in your clipboard. So Paste it in your terminal and run the query.
Magic !
You now have a single command to control something !
Of course you can do the same process with any action you need to grab and use somewhere.
Once you got the cURL request that matches your need, well you can do whatever you want with it.
In my example, I added a cron job on my Pi, that runs the cURL request every morning at 8am. So it automatically start playing my radio.
And I grabbed another cURL request, to change to my default audio Channel (AV4 - my TV audio channel) that I run every morning at 9am.
Then, every morning, my radio will be played automatically from 8am to 9am, without requiring any actions from my part. I don't even have to touch the remote control.
You can extend the scenario, for example, you can also run a request to set the volume to a precise level, so you are sure to hear something, and also sure to not wake the whole building up ;)
_Going further, you will even be able to build your own remote control. How cool is that ?ย _
I consider myself as an IT Business Artisan. Or Consultant CTO. I'm a self-taught Web Developper, coach and teacher. My main work is helping and guiding digital startups.
more about meBTC
18SY81ejLGFuJ9KMWQu5zPrDGuR5rDiauM
ETH
0x519e0eaa9bc83018bb306880548b79fc0794cd08
XMR
895bSneY4eoZjsr2hN2CAALkUrMExHEV5Pbg8TJb6ejnMLN7js1gLAXQySqbSbfzjWHQpQhQpvFtojbkdZQZmM9qCFz7BXU
2024 © My Dynamic Production SRL All rights Reserved.