Yamaha Restful commands

I tried all the settings now and found that you have defined the wrong url for “Cinema enhancer off” in the REST commands.
It points to …/setExtraBass instead of …/setEnhancer.

1 Like

Thanks. Cut and paste error. Correct commands:

cinema_enhancer_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setEnhancer?enable=true"

cinema_enhancer_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setEnhancer?enable=false"

cinema_extra_bass_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setExtraBass?enable=true"

cinema_extra_bass_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setExtraBass?enable=false"

Awesome dude !! You should push that to github or something, it could help many people!

I have a RX-V481 and the Extra Bass function is not available as GET request.
But the old Android “AV Controller” can set it On/Off.
By making a Man-In-The-Middle with Wireshark between the router and the receiver, I just found that there is a bunch of POST request that can be made.

for example with the URL

http://receiverHost/YamahaRemoteControl/ctrl

and the following body

<YAMAHA_AV cmd=“PUT”>
<Main_Zone>
<Sound_Video>
<Extra_Bass>Auto</Extra_Bass>
</Sound_Video>
</Main_Zone>
</YAMAHA_AV>

It Activates the Extra Bass mode.
Need to test further…

3 Likes

So if I can’t get to http://192.168.0.71/YamahaExtendedControl (it shows there is not such site). My receiver may be too old for this?

I have a Yamaha RX-V477, and I can get to http://192.168.0.71/ but there is not much there.

The above described API is for Music Cast devices, your device is an older type but there is still an API you can use. It is a bit more complex as it requires sending an xml data. You can do it via shell_command. Below please find examples from my aplituner RX-V1067:

shell_command:
  yamaha_pure_direct_on: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Sound_Video><Pure_Direct><Mode>On</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'"
  yamaha_pure_direct_off: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Sound_Video><Pure_Direct><Mode>Off</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'"
  yamaha_party_mode_on: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><System><Party_Mode><Mode>On</Mode></Party_Mode></System></YAMAHA_AV>'"
  yamaha_party_mode_off: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><System><Party_Mode><Mode>Off</Mode></Party_Mode></System></YAMAHA_AV>'"
  yamaha_enhancer_on: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>On</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>'"
  yamaha_enhancer_off: "curl -X POST 'http://10.144.1.12/YamahaRemoteControl/ctrl' --data-binary  '<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>Off</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>'"

Documentation of the API can be found here:

Aparently you can also do it directly with REST commands from HA, below some examples for my RX-V1067:

# sensors.yaml:
  - platform: rest
    resource: http://10.144.1.12/YamahaRemoteControl/ctrl
    method: POST
    payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="GET"><Main_Zone><Sound_Video><Pure_Direct><Mode>GetParam</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'
    scan_interval: 15
    name: Yamaha Pure Direct
    value_template: '{{ value_json.YAMAHA_AV.Main_Zone.Sound_Video.Pure_Direct.Mode }}'
  - platform: rest
    resource: http://10.144.1.12/YamahaRemoteControl/ctrl
    method: POST
    payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="GET"><System><Party_Mode><Mode>GetParam</Mode></Party_Mode></System></YAMAHA_AV>'
    scan_interval: 15
    name: Yamaha Party Mode
    value_template: '{{ value_json.YAMAHA_AV.System.Party_Mode.Mode }}'
  - platform: rest
    resource: http://10.144.1.12/YamahaRemoteControl/ctrl
    method: POST
    payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>'
    scan_interval: 15
    name: Yamaha Sound
    value_template: '{{ value_json.YAMAHA_AV.Main_Zone.Basic_Status.Surround.Program_Sel.Current.Sound_Program }}'
    json_attributes_path: "$.YAMAHA_AV.Main_Zone.Basic_Status.Surround.Program_Sel.Current"
    json_attributes:
      - Enhancer
      - Straight

#rest_command.yaml
yamaha_pure_direct_on:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Sound_Video><Pure_Direct><Mode>On</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'
yamaha_pure_direct_off:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Sound_Video><Pure_Direct><Mode>Off</Mode></Pure_Direct></Sound_Video></Main_Zone></YAMAHA_AV>'
yamaha_party_mode_on:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><System><Party_Mode><Mode>On</Mode></Party_Mode></System></YAMAHA_AV>'
yamaha_party_mode_off:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><System><Party_Mode><Mode>Off</Mode></Party_Mode></System></YAMAHA_AV>'
yamaha_enhancer_on:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Surround><Program_Sel><Current><Enhancer>On</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>'
yamaha_enhancer_off:
  url: 'http://10.144.1.12/YamahaRemoteControl/ctrl'
  method: POST
  payload: '<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="PUT"><Main_Zone><Surround><Program_Sel><Current><Enhancer>Off</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>'

You can use those sensors to create switches and have a complete control in GUI:

  - platform: template
    switches:
      yamaha_pure_direct:
        friendly_name: "Yamaha Pure Direct"
        value_template: "{{ is_state('sensor.yamaha_pure_direct', 'On') }}"
        turn_on:
          service: rest_command.yamaha_pure_direct_on
        turn_off:
          service: rest_command.yamaha_pure_direct_off
      yamaha_party_mode:
        friendly_name: "Yamaha Party Mode"
        value_template: "{{ is_state('sensor.yamaha_party_mode', 'On') }}"
        turn_on:
          service: rest_command.yamaha_party_mode_on
        turn_off:
          service: rest_command.yamaha_party_mode_off
      yamaha_enhancer:
        friendly_name: "Yamaha Enhancer"
        value_template: "{{ is_state_attr('sensor.yamaha_sound', 'Enhancer', 'On') }}"
        turn_on:
          service: rest_command.yamaha_enhancer_on
        turn_off:
          service: rest_command.yamaha_enhancer_off

image

Haven’t used this yet but I assume this doesn’t have the same conflict with remote controlling it over port 50000 using YNC/YNCA?

Problem with that is it’s locked to a single device whilst the port is open to get the response.

I am trying to implement some more features for my Music Cast system, namely to play last album added on Tidal. To achieve that I need to run a few restfull commands one after another, this works ok from web browser as well as from shell with curl. But when I’m trying to run it as a script in HA I am receiving Client error errors. I’ve described the case in detail here.
Any ideas how to evercome that?

I am trying to use the Yamaha music cast api to stream and play a single mp3 file from a media server like subsonic. Do anyone here know if that is possible? I have read the documentation and see that streaming is possible, but I didn’t see any requirement for specifying my mp3 file metadata and it’s location for streaming. Any idea how to go about this please?

Just check the documentation of the official integration. There is example of exactly what you are looking for:

service: media_player.play_media
target:
  entity_id: media_player.salon_main
data:
  media_content_type: "music"
  media_content_id: "http://192.168.188.18:8123/local/sound_files/doorbell-front.mp3"

Thank you for your response. I had to research HA after reading your reply. I am actually developing an app with python, and was hoping to intigrate an IOT function somewhere in-between.

Just a quick confirmation following what I read on HA RESTful API.

Can I still implement this “Instruction on how to integrate Yamaha MusicCast Receivers into Home Assistant.” directly into my python script with HA RESTful API, and not having to use HA’s frontend “card”?

You can utilize any feature of the Yamaha MusicCast API. Just look at the documentation. Not sure where the originals are so attaching it here. From my understanding you can more or less implement all features that are implemented in official music cast app.

@tom_l Thanks for sharing your work, I realllly appreciate: 95% of the work is done for my Yamaha RX-V4A your are awesome!

I wish with all my respect to what you have achieve here to help others avoid this small error in the code that did prevent my subwoofer level to work at first try :slight_smile:

    cinema_subwoofer_level:
      url: "http://ampli-salon.foxad.net/YamahaExtendedControl/v1/main/setSubwooferVolume?volume={{ ( states('input_number.lounge_subwoofer_level')|float * 2 )|int }}"

for

    cinema_subwoofer_level:
      url: "http://ampli-salon.foxad.net/YamahaExtendedControl/v1/main/setSubwooferVolume?volume={{ ( states('input_number.cinema_subwoofer_level')|float * 2 )|int }}"

Great job again! Have a good one

1 Like

Thanks. Fixed in the original post (and my config!).

Hi Tom,
Unfortunately I’m very new to all this HA coding. I have a musiccast Yamaha receiver and would like to use your excelent remote code. But I don’t know what tot do with this code in this post. Is it possible to make a short manual where tot copy this blocks of code and what should be adjusted to my personal situation. As I said I’m not (yet) familiar with how HA and coding works. This would help me a lot in reaching my goal an d learn a lot how to use this coding bloks.

Thanks,
Rolof

Just use the muisiccast integration.

It will provide all the entities without any need for the yaml above.

Hi Tom,

Thanks for your reply,
Sorry for being a novice but somewhere you have to start learning.
I allready have this Musicast running and I’m already using the avaiable (fround) entities.
But I’m missing a lot of the option you have above. The yamaha does have these options.
Can you tell me how (or if) I can add the missing commands. For instance a extra bas switch or subwoofer level. I know these option are controllable over IP since the official yamaha app can do this.
I hope you can push me a bit in the right direction, so I can add the needed options.

Thanks !!!

Hi All,
I totally not understand how things work. I have a yamaha amplifier RX-V581 which has all the option descibed above. All work from yamaha’s own app (over IP) so it is possible to control this over IP
but when I send: (from chrome)
http://‘MY IP’/YamahaExtendedControl/v1/main/setExtraBass?enable=true
It’s not working. (responc code: 3)
If I send:
http://‘MY IP’/YamahaExtendedControl/v1/main/setEnhancer?enable=true
It works perfectly
So what am I doing wrong (or is going wrong)

Is there anybody who can explain me a bit more on this ??

Thanks
Rolof

The extra base entity is available in the musiccast integration if your amplifier supports it.

I have MusicCast setup, everything works great.

When I choose bluetooth as the input, I want it to display the video feed from HDMI1 as well.

This works fine, except the Bluetooth menu is on top of the screen. I have to use the remote app, use the right cursor button, and press enter.

How can I capture the commands so that I can automate this in HomeAssistant?

It works from the app/remote, so there should be an API call to do it.