Yamaha Restful commands

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.

Those button presses are not described in the API documentation therefore not implemented. You could try to sniff the network traffic for those commands while using the mobile app and either provide it as feature request to the HA integration (it will take a while) or just implement your own REST commands to implement desired functions.

Btw, for my devices I have the back and arrows on my remote but I don’t have anything like that on the musiccast app. So based on my devices I’m afraid the only way to implement that would be via some kind of universal remote integrated with HA (e.g. broadlink) that would be firing the IR codes.

Yeah, I dont have it in the MusicCast App, but the AV controller does.

I guess I can try to sniff the network. That’s probably going to be the way to find the commands.

Thanks for your help.

OK, I didn’t know that MusicCast devices can be also controlled with AV Controller app. I have it for an amplituner without musiccast. Sniffing the network works for it, I’ve created a couple controls and sensors this way but not for the arrows or enter button.
This app uses a different API and actually there has been some work done already to get the required commands. Have a look at this repo, I think it already includes the cursor and enter commands:

And in one of my posts above you have examples on how to use this api to get data or control options from HA using REST Command integration:

1 Like

Nice, thanks, going to dig into this today hopefully

Just wanted to say this post was eye-opening and a huge help.

Being able to easily switch the input and set an exact volume level is awesome.

I’ve created home assistant helper values to remember the volume for listening to music and another one for my Apple TV so when I switch from one to the other, the volume switches too. Now the volume is always what I want it to be.

Here are some of the commands I use:

  yamaha_input_computer:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setInput?input=hdmi1"
  yamaha_input_music:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setInput?input=audio4"
  yamaha_input_apple_tv:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setInput?input=hdmi2"

  yamaha_vol_7_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=146"
  yamaha_vol_10db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=141"
  yamaha_vol_12_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=136"
  yamaha_vol_15db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=131"
  yamaha_vol_17_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=126"
  yamaha_vol_20db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=121"
  yamaha_vol_22_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=116"
  yamaha_vol_25db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=111"
  yamaha_vol_27_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=106"
  yamaha_vol_30db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=101"
  yamaha_vol_32_5db:
    url: "http://192.168.1.89/YamahaExtendedControl/v1/main/setVolume?volume=96"

Thanks again for sharing all of this.

Anyone know the restful command to start and shuffle; theres a toggle I think :

http://{host}/YamahaExtendedControl/v1/netusb/toggleShuffle

a (server) playlist? There’s buttons in the Musiccast iOS app in “Musiccast playlists” under the favourites buttons to do it but I’d like to automate running them. I’ve skirted the official documentation but can’t find a reference to them.

Seems that it is not documented but there must be something being sent. You can try to sniff the network traffic between your phone and the device e.g. with Wireshark software.

Another option you have is to store the playlist as a favorite and later recall it using the API (<BaseURL>/v1/netusb/recallPreset?zone=<zone>&num=<num>). I’ve tested it and it works nicely for musiccast playlists which include server files.

OK, so I’ve checked it myself and here it is. The API (undocumented) to play a musiccast playlist is:
<BaseURL>/v1/netusb/manageMcPlaylist?bank=<playlist_number>&type=play&index=<track_number>&zone=<zone>
There are also a few others, you can check below for REST API and example responses from my system.

GET /YamahaExtendedControl/v1/netusb/getMcPlaylistName
{"response_code":0,"name_list":["Playlist 1","Playlist 2","Playlist 3","Playlist 4","Playlist 5"]}

GET /YamahaExtendedControl/v1/netusb/getMcPlaylist?bank=1&index=0
{"response_code":0,"max_line":11,"bank":1,"index":0,"track_info":[{"input":"server","text":"Hello","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Send My Love (To Your New Lover)","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"I Miss You","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"When We Were Young","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Remedy","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Water Under the Bridge","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"River Lea","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Love in the Dark","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Million Years Ago","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"All I Ask","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63},{"input":"server","text":"Sweetest Devotion","thumbnail":"http:\/\/10.144.1.162:32469\/proxy\/df5def65beafa7527493\/albumart.jpg","attribute":63}]}

GET /YamahaExtendedControl/v1/netusb/manageMcPlaylist?bank=1&type=play&index=0&zone=main
{"response_code":0}

Updated now also on my repo
Edit:

BTW, I’ve also found this repo, which includes (in the php files) above as well as some other APIs for MusicCast.

1 Like

Thank you so much.

It needed YamahaExtendedControl added before v1 but is working.

For others needing this :

ipaddress/YamahaExtendedControl/v1/netusb/manageMcPlaylist?bank=1&type=play&index=0&zone=1

Will play the first playlist starting at the first track of the playlist.

1 Like

Sure, as per the official docs: <baseURL> is http://{host}/YamahaExtendedControl
:slight_smile:
Happy it works for you too!
Btw, keep in mind that the index starts with 0 and 1 will be the second item on the playlist.

1 Like

Yeah, I just worked that one out a minute ago lol.

1 Like

The second part of my question regarded shuffling,

For shuffling, there’s no on|off command so you have to determine the current state and then use toggleShuffle if it’s off.

This puts the current shuffle state (of the receivers server mode) into sensor.shufflestate

In configuration.YAML:


sensor:

  - platform: rest
    name: shufflestate
    resource: Receiver_IP_address/YamahaExtendedControl/v1/netusb/getPlayInfo
    value_template: "{{ value_json.shuffle }}"
    scan_interval: 15
    json_attributes:
      - "shuffle”

This is the command to toggle shuffle in server mode, also in configuration.YAML


rest_command:
  toggle_shuffle:
    url: 'Receiver_IP_address/YamahaExtendedControl/v1/netusb/toggleShuffle'

And in scripts.YAML or automations.YAML, test the state and toggle if required.


toggle_shuffle:
alias: toggle_shuffle
 sequence:
  - if:
        condition: state
        entity_id: sensor.shufflestate
        state: "off"
    then:
        service: rest_command.toggle_shuffle

As of now I’m not sure if I can put a rest scan into a script and do it on demand, I’ll be refining this whole process anyway but it works for now

1 Like

In HA I can go to the control panel of my MusicCast device where I can select “browse media”. In the Library screen which now opens I can select “Presets”. And in the Presets screen I can now click on a preset which will start playing.

I now want to make a button with a shortcut to this Presets screen.

With PCAPdroid on my phone I figured out that {ip_address}/YamahaExtendedControl/v1/netusb/getPresetInfo is the place where I can find the presets.

But when I create a button in Lovelace with “Navigate” of “URL” I do not get the desired outcome.

After some googling I ended up here. It cost me two days before I had figured out the above, and with the information in this topic I have the feeling I am staring down yet another rabbit hole.

My programming / coding skills leave a lot to be desired. Some help with what I am trying to achieve would be greatly appreciated.

I don’t think it is possible to game a URL that goes directly to any of the browser media screens including the Presets one. If you don’t change your posts to often you can create buttons that will play desired preset by calling respective URL visa REST command directly on your Yamaha device.

Since you mention that you can browse the Presets from HA, maybe you can make an automation and trigger that from a button?

Just create an automation with just on action of the “Play media” type where you can select a mediaplayer and then browse the library. Then save it with a good name.

Now you can trigger it from a button by configuring the button with call-service action

This button works for me (and I created an automation called playmusic)

type: button
name: Trigger play music automation
tap_action:
  action: call-service
  service: automation.trigger
  data:
    skip_condition: true
  target:
    entity_id: automation.play_music

That is a good one, I’ve just noticed it is now explained in the documentation of musiccast integration how to play a preset:

service: media_player.play_media
target:
  entity_id: media_player.buro
data:
  media_content_id: "presets:1"
  media_content_type: "music"

https://www.home-assistant.io/integrations/yamaha_musiccast/#examples
I can get rid of my REST commands now :slight_smile: