Yamaha Restful commands

Here’s an example of some Yamaha restful commands I use to control extra features of my Yamaha RX-V685 AV receiver. It will work for any receiver that uses this API (PDF link).

Example of extra controls in Lovelace:

Screenshot_2020-10-14 Overview - Home Assistant

Restful Commands:

#################################################################
## Amplifier Commands
#################################################################

### CINEMA ### (Main Zone)

cinema_adaptive_drc_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setAdaptiveDrc?enable=true"

cinema_adaptive_drc_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setAdaptiveDrc?enable=false"

cinema_adaptive_dsp_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setAdaptiveDspLevel?enable=true"

cinema_adaptive_dsp_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setAdaptiveDspLevel?enable=false"

cinema_dialogue_lift:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setDialogueLift?value={{ ( states('input_number.cinema_dialogue_lift')|float * 2 )|int }}"

cinema_dialogue_level:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setDialogueLevel?value={{ states('input_number.cinema_dialogue_level')|int }}"

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"

set_cinema_sound_program_to_surr_decoder:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setSoundProgram?program=surr_decoder"

set_cinema_sound_program: # filter out surround decoders before calling
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setSoundProgram?program={{ states('input_select.cinema_surround_mode')|lower|replace(' ', '_') }}"

set_cinema_surround_decoder_type: # only if sound_program = surr_decoder
  url: "http://10.1.1.17/YamahaExtendedControl/v1/main/setSurroundDecoderType?type={{ states('input_select.cinema_surround_mode')|lower|replace(' ', '_') }}"

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

### DECK ### (Zone 2)

deck_set_balance_level:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setBalance?value={{ ( states('input_number.deck_balance_level')|float * 2 )|int }}"

deck_enhancer_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setEnhancer?enable=true"

deck_enhancer_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setEnhancer?enable=false"

deck_extra_bass_on:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setExtraBass?enable=true"

deck_extra_bass_off:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setExtraBass?enable=false"

deck_set_tone_level:
  url: "http://10.1.1.17/YamahaExtendedControl/v1/zone2/setToneControl?mode=manual&bass={{ ( states('input_number.deck_bass_level')|float * 2 )|int }}&treble={{ ( states('input_number.deck_treble_level')|float * 2 )|int }}"

Sensors:

#################################################################
## Amplifier sensors
#################################################################

### CINEMA ###

- platform: rest
  name: Cinema Amp
  resource: http://10.1.1.17/YamahaExtendedControl/v1/main/getStatus
  value_template: "{{ value_json.power }}"
  json_attributes:
  - adaptive_drc
  - adaptive_dsp_level
  - dialogue_level
  - dialogue_lift
  - dts_dialogue_control
  - enhancer
  - extra_bass
  - surr_decoder_type
  - sound_program
  - subwoofer_volume

- platform: template
  sensors:
    cinema_dialogue_lift:
      friendly_name: Dialogue Lift
      value_template: "{{ state_attr('sensor.cinema_amp', 'dialogue_lift')|float / 2 }}"
    cinema_dialogue_level:
      friendly_name: Dialogue Level
      value_template: "{{ state_attr('sensor.cinema_amp', 'dialogue_level')|int }}"
    cinema_surround_decoder_type:
      friendly_name: Surround Decoder
      value_template: "{{ state_attr('sensor.cinema_amp', 'surr_decoder_type')|replace('_', ' ')|title|replace('Dts', 'DTS') }}"
    cinema_sound_program:
      friendly_name: Sound Program
      value_template: "{{ state_attr('sensor.cinema_amp', 'sound_program')|replace('_', ' ')|title }}"
    cinema_subwoofer_level:
      friendly_name: Subwoofer Level
      value_template: "{{ state_attr('sensor.cinema_amp', 'subwoofer_volume')|float / 2 }}"

### DECK ###

- platform: rest
  name: Deck Amp
  resource: http://10.1.1.17/YamahaExtendedControl/v1/zone2/getStatus
  value_template: "{{ value_json.power }}"
  json_attributes:
  - extra_bass
  - enhancer
  - balance
  - tone_control

- platform: template
  sensors:
    deck_balance_level:
      friendly_name: Balance Level
      value_template: "{{ state_attr('sensor.deck_amp', 'balance')|float / 2 }}"
    deck_bass_level:
      friendly_name: Bass
      value_template: "{{ state_attr('sensor.deck_amp', 'tone_control')['bass']|float / 2 }}"
    deck_treble_level:
      friendly_name: Treble
      value_template: "{{ state_attr('sensor.deck_amp', 'tone_control')['treble']|float / 2 }}"

Switches (note refreshing of the restful sensors to prevent the switch ‘bouncing’)

#################################################################
## AV Switches
#################################################################

### CINEMA ###

- platform: template
  switches:
    cinema_amp_adaptive_drc:
      friendly_name: Adaptive DRC
      value_template: "{{ is_state_attr('sensor.cinema_amp', 'adaptive_drc', true ) }}"
      turn_on:
      - service: rest_command.cinema_adaptive_drc_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      turn_off:
      - service: rest_command.cinema_adaptive_drc_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      icon_template: >-
        {% if is_state('sensor.cinema_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}
    cinema_amp_adaptive_dsp:
      friendly_name: Adaptive DSP
      value_template: "{{ is_state_attr('sensor.cinema_amp', 'adaptive_dsp_level', true ) }}"
      turn_on:
      - service: rest_command.cinema_adaptive_dsp_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      turn_off:
      - service: rest_command.cinema_adaptive_dsp_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      icon_template: >-
        {% if is_state('sensor.cinema_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}
    cinema_amp_enhancer:
      friendly_name: Enhancer
      value_template: "{{ is_state_attr('sensor.cinema_amp', 'enhancer', true ) }}"
      turn_on:
      - service: rest_command.cinema_enhancer_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      turn_off:
      - service: rest_command.cinema_enhancer_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      icon_template: >-
        {% if is_state('sensor.cinema_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}
    cinema_amp_extra_bass:
      friendly_name: Extra Bass
      value_template: "{{ is_state_attr('sensor.cinema_amp', 'extra_bass', true ) }}"
      turn_on:
      - service: rest_command.cinema_extra_bass_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      turn_off:
      - service: rest_command.cinema_extra_bass_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.cinema_amp
      icon_template: >-
        {% if is_state('sensor.deck_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}

### DECK ###

- platform: template
  switches:
    deck_amp_enhancer:
      friendly_name: Enhancer
      value_template: "{{ is_state_attr('sensor.deck_amp', 'enhancer', true ) }}"
      turn_on:
      - service: rest_command.deck_enhancer_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.deck_amp
      turn_off:
      - service: rest_command.deck_enhancer_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.deck_amp
      icon_template: >-
        {% if is_state('sensor.deck_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}
    deck_amp_extra_bass:
      friendly_name: Extra Bass
      value_template: "{{ is_state_attr('sensor.deck_amp', 'extra_bass', true ) }}"
      turn_on:
      - service: rest_command.deck_extra_bass_on
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.deck_amp
      turn_off:
      - service: rest_command.deck_extra_bass_off
      - delay:
          seconds: 1
      - service: homeassistant.update_entity
        entity_id: sensor.deck_amp
      icon_template: >-
        {% if is_state('sensor.deck_amp', 'on') %}
          mdi:tune-vertical
        {% else %}
          mdi:tune-vertical
        {% endif %}

Input Numbers:

cinema_dialogue_lift:
  name: Dialogue Lift
  min: 0
  max: 2.5
  step: 0.5
  unit_of_measurement: "m"
  icon: mdi:arrow-expand-up

cinema_dialogue_level:
  name: Dialogue Level
  min: 0
  max: 3
  step: 1
  unit_of_measurement: "dB"
  icon: mdi:account-voice

cinema_subwoofer_level:
  name: Subwoofer Level
  min: -6
  max: 6
  step: 0.5
  unit_of_measurement: "dB"
  icon: mdi:smoke-detector

deck_balance_level:
  name: Balance
  min: -10
  max: 10
  step: 0.5
  unit_of_measurement: "dB"
  icon: mdi:scale-balance

deck_bass_level:
  name: Base
  min: -6
  max: 6
  step: 0.5
  unit_of_measurement: "dB"
  icon: mdi:music-clef-bass

deck_treble_level:
  name: Treble
  min: -6
  max: 6
  step: 0.5
  unit_of_measurement: "dB"
  icon: mdi:music-clef-treble

Input Selects:

cinema_surround_mode:
  name: Surround Mode
  options:
  - '7ch Stereo'
  - 'DTS Neural X'
  - 'DTS Neo6 Cinema'
  - 'DTS Neo6 Music'
  - 'Dolby Surround'
  - '2ch Stereo'
  - 'Action Game'
  - 'Adventure'
  - 'Bottom Line'
  - 'Chamber'
  - 'Cellar Club'
  - 'Drama'
  - 'Mono Movie'
  - 'Munich'
  - 'Music Video'
  - 'Roleplaying Game'
  - 'Roxy Theatre'
  - 'Sci-Fi'
  - 'Spectacle'
  - 'Sports'
  - 'Straight'
  - 'Standard'
  - 'Vienna'
  icon: mdi:dolby

Automations:

#################################################################
## Amplifier Automations
#################################################################

### CINEMA ###

- alias: 'Set Cinema Dialogue Lift'
  trigger:
  - platform: state
    entity_id: input_number.cinema_dialogue_lift
  condition:
  - condition: template
    value_template: "{{ states('input_number.cinema_dialogue_lift') != states('sensor.cinema_dialogue_lift') }}"
  - condition: template
    value_template: "{{ states('input_number.cinema_dialogue_lift') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: rest_command.cinema_dialogue_lift

- alias: 'Get Cinema Dialogue Lift'
  trigger:
  - platform: state
    entity_id: sensor.cinema_dialogue_lift
  condition:
  - condition: template
    value_template: "{{ states('sensor.cinema_dialogue_lift') != states('input_number.cinema_dialogue_lift') }}"
  - condition: template
    value_template: "{{ states('sensor.cinema_dialogue_lift') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: input_number.set_value
    data:
      entity_id: input_number.cinema_dialogue_lift
      value: "{{ states('sensor.cinema_dialogue_lift')|int }}"

- alias: 'Set Cinema Dialogue Level'
  trigger:
  - platform: state
    entity_id: input_number.cinema_dialogue_level
  condition:
  - condition: template
    value_template: "{{ states('input_number.cinema_dialogue_level') != states('sensor.cinema_dialogue_level') }}"
  - condition: template
    value_template: "{{ states('input_number.cinema_dialogue_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: rest_command.cinema_dialogue_level

- alias: 'Get Cinema Dialogue Level'
  trigger:
  - platform: state
    entity_id: sensor.cinema_dialogue_level
  condition:
  - condition: template
    value_template: "{{ states('sensor.cinema_dialogue_level') != states('input_number.cinema_dialogue_level') }}"
  - condition: template
    value_template: "{{ states('sensor.cinema_dialogue_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: input_number.set_value
    data:
      entity_id: input_number.cinema_dialogue_level
      value: "{{ states('sensor.cinema_dialogue_level')|float }}"

- alias: 'Set Cinema Surround Mode'
  trigger:
  - platform: state
    entity_id: input_select.cinema_surround_mode
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('input_select.cinema_surround_mode') in [ 'DTS Neural X', 'DTS Neo6 Cinema', 'DTS Neo6 Music', 'Dolby Surround' ] }}"
      - condition: template
        value_template: "{{ states('input_select.cinema_surround_mode') != states('sensor.cinema_surround_decoder_type') }}"
      sequence:
      - service: rest_command.set_cinema_sound_program_to_surr_decoder
      # - delay:
      #     seconds: 1
      - service: rest_command.set_cinema_surround_decoder_type
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('input_select.cinema_surround_mode') in [ '2ch Stereo', '7ch Stereo', 'Action Game', 'Adventure', 'Bottom Line', 'Chamber', 'Cellar Club', 'Drama', 'Mono Movie', 'Munich', 'Music Video', 'Roleplaying Game', 'Roxy Theatre', 'Sci-Fi', 'Spectacle', 'Sports', 'Straight', 'Standard', 'Vienna' ] }}"
      - condition: template
        value_template: "{{ states('input_select.cinema_surround_mode') != states('sensor.cinema_sound_program') }}"
      sequence:
      - service: rest_command.set_cinema_sound_program

- alias: 'Get Cinema Surround Mode'
  trigger:
  - platform: state
    entity_id: sensor.cinema_sound_program
  - platform: state
    entity_id: sensor.cinema_surround_decoder_type
  - platform: state
    entity_id: media_player.cinema_av_rx
    attribute: source
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('sensor.cinema_sound_program') == 'Surr Decoder' }}"
      - condition: template
        value_template: "{{ states('sensor.cinema_surround_decoder_type') != states('input_select.cinema_surround_mode') }}"
      sequence:
      - service: input_select.select_option
        data:
          entity_id: input_select.cinema_surround_mode
          option: "{{ states('sensor.cinema_surround_decoder_type') }}"
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('sensor.cinema_sound_program') in [ '2ch Stereo', '7ch Stereo', 'Action Game', 'Adventure', 'Bottom Line', 'Chamber', 'Cellar Club', 'Drama', 'Mono Movie', 'Munich', 'Music Video', 'Roleplaying Game', 'Roxy Theatre', 'Sci-Fi', 'Spectacle', 'Sports', 'Straight', 'Standard', 'Vienna' ] }}"
      - condition: template
        value_template: "{{ states('sensor.cinema_sound_program') != states('input_select.cinema_surround_mode') }}"
      sequence:
      - service: input_select.select_option
        data:
          entity_id: input_select.cinema_surround_mode
          option: "{{ states('sensor.cinema_sound_program') }}"

- alias: 'Cinema Subwoofer Automation'
  trigger:
  - platform: state
    entity_id: media_player.cinema_av_rx  # using no state triggers on HA restart
    to: 'on'
  - platform: state
    entity_id: media_player.cinema_av_rx
    to: 'off'
  action:
    service: >
      {% if is_state('media_player.cinema_av_rx', 'off') %}
        switch.turn_off
      {% else %}
        switch.turn_on
      {% endif %}
    entity_id: switch.cinema_subwoofer

- alias: 'Set Cinema Subwoofer Level'
  trigger:
  - platform: state
    entity_id: input_number.cinema_subwoofer_level
  condition:
  - condition: template
    value_template: "{{ states('input_number.cinema_subwoofer_level') != states('sensor.cinema_subwoofer_level') }}"
  - condition: template
    value_template: "{{ states('input_number.cinema_subwoofer_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: rest_command.cinema_subwoofer_level

- alias: 'Get Cinema Subwoofer Level'
  trigger:
  - platform: state
    entity_id: sensor.cinema_subwoofer_level
  condition:
  - condition: template
    value_template: "{{ states('sensor.cinema_subwoofer_level') != states('input_number.cinema_subwoofer_level') }}"
  - condition: template
    value_template: "{{ states('sensor.cinema_subwoofer_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: input_number.set_value
    data:
      entity_id: input_number.cinema_subwoofer_level
      value: "{{ states('sensor.cinema_subwoofer_level')|float }}"

- alias: 'Update Cinema Media Player Sensor'
  trigger:
  - platform: state
    entity_id: media_player.cinema_av_rx
    attribute: source
  action:
  - service: homeassistant.update_entity
    entity_id: sensor.cinema_amp

### DECK ###

- alias: 'Set Deck Balance Level'
  trigger:
  - platform: state
    entity_id: input_number.deck_balance_level
  condition:
  - condition: template
    value_template: "{{ states('input_number.deck_balance_level') != states('sensor.deck_balance_level') }}"
  - condition: template
    value_template: "{{ states('input_number.deck_balance_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: rest_command.deck_set_balance_level

- alias: 'Get Deck Balance Level'
  trigger:
  - platform: state
    entity_id: sensor.deck_balance_level
  condition:
  - condition: template
    value_template: "{{ states('sensor.deck_balance_level') != states('input_number.deck_balance_level') }}"
  - condition: template
    value_template: "{{ states('sensor.deck_balance_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: input_number.set_value
    data:
      entity_id: input_number.deck_balance_level
      value: "{{ states('sensor.deck_balance_level')|float }}"

- alias: 'Get Deck Tone Level'
  trigger:
  - platform: state
    entity_id: sensor.deck_bass_level
  - platform: state
    entity_id: sensor.deck_treble_level
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: "{{ states('sensor.deck_bass_level') != states('input_number.deck_bass_level') }}"
    - condition: template
      value_template: "{{ states('sensor.deck_treble_level') != states('input_number.deck_treble_level') }}"
  - condition: template
    value_template: "{{ states('sensor.deck_bass_level') not in ['unknown', 'None', 'unavailable'] }}"
  - condition: template
    value_template: "{{ states('sensor.deck_treble_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('sensor.deck_bass_level') != states('input_number.deck_bass_level') }}"
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.deck_bass_level
          value: "{{ states('sensor.deck_bass_level')|float }}"
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('sensor.deck_treble_level') != states('input_number.deck_treble_level') }}"
      sequence:
      - service: input_number.set_value
        data:
          entity_id: input_number.deck_treble_level
          value: "{{ states('sensor.deck_treble_level')|float }}"

- alias: 'Set Deck Tone Level'
  trigger:
  - platform: state
    entity_id: input_number.deck_bass_level
  - platform: state
    entity_id: input_number.deck_treble_level
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: "{{ states('sensor.deck_bass_level') != states('input_number.deck_bass_level') }}"
    - condition: template
      value_template: "{{ states('sensor.deck_treble_level') != states('input_number.deck_treble_level') }}"
  - condition: template
    value_template: "{{ states('input_number.deck_bass_level') not in ['unknown', 'None', 'unavailable'] }}"
  - condition: template
    value_template: "{{ states('input_number.deck_treble_level') not in ['unknown', 'None', 'unavailable'] }}"
  action:
  - service: rest_command.deck_set_tone_level
15 Likes

Niiice! For sure gonna use this.

I was quite pleased with myself when I got the surround programs and surround decoder types in the one input select, and made it update when the source was changed in the mini media player.

Sounds cool! As soon as I renovated my office I will play with this :slight_smile:

This is awesome, if I knew how to implement it.

I’m new to implementing REST in Home Assistant (looked at it for the first time today) so I don’t know where to put all this.
I’m guessing that the code under “sensors” and “switches” can be written in configuration.yaml and the code under “automations” should of course be written in automations.yaml.
Where should “restful commands”, “input numbers” and “input selects” reside and is there anything more to code than what is shown here?

By default you put all of this in configuration.yaml file but you can also create separate files and include them in the main configuration file like that:
input_select: !include input_select.yaml
and create separate input_select.yaml file in the same location. The same applies to input_number and restful_command (and many other types).

1 Like

I tried copying everything as is and changed the ip address but I get a lot of “end of stream or document separator is expected” errors everywhere.


and then on every row with “value_template:”.
On the end I get a error saying “unexpected end of stream within a double quoted scalar”.
I haven’t tried reloading and see if it works despite the errors.

You need to put each section of config under their respective domains (e.g. sensors), not just anywhere in your config file.

1 Like

Thanks a lot!

Haven’t had the need to fiddle with that many manual entries in yaml but now it feels like the elevator just went all the way up and I might be in for many sleepless nights of trying to set up new integrations.

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”?