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:
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