Onkyo - Input Slider - Bi-directional

Hi,

I spend ages trying to get a input slider (now input number) to work correctly. I could always control the Onkyo receiver (TX-NR414) but was struggling with automation to make the slider move if the volume was adjusted on the amp. Once I got it solved I though I would post this just in case someone else needs the code.

This is mostly copy/paste from various topics. If I log on to the web interface of my Onkyo it says the receiver is capable of 0-80 but currently set at 64 max, hence using 80 in the automations and 64 in the input_number.

I have not had time to test this, literally just got it to work but it definitely does work.

In configuration.yaml

input_number:
  onkyo_volume:
    name: Onkyo Volume
    initial: 15
    min: 0
    max: 64
    step: 1

Automations:

  - alias: Onkyo Volume Slider Set
    trigger:
      - platform: state
        entity_id: input_number.onkyo_volume
    condition:
      - condition: state
        entity_id: media_player.receiver
        state: 'on'
    action:
      - service: media_player.volume_set
        data_template:
          entity_id: media_player.receiver
          volume_level: '{{ states.input_number.onkyo_volume.state | float / 80 }}'
          
  - alias: Onkyo Volume Slider Get
    trigger:
      platform: state
      entity_id: media_player.receiver
    action:
      service: input_number.set_value
      data_template:
        entity_id: input_number.onkyo_volume
        value: '{{ states.media_player.receiver.attributes.volume_level | float * 80 }}'

Cheers

Simon

1 Like

Hello simon,
I tried to replicate your sttings. Unfortunatly it doesn’t seems to work for my Google Home and Yamaha receiver.

Here is the automation code i used:

 - alias: google home - Adjust Volume
   trigger:
     - platform: state
       entity_id: input_number.slider1
   action:
     - service: media_player.volume_set
       data_template:
         entity_id: media_player.google_home
         volume_level: '{{ states.input_number.google_home.state | float / 80 }}'
         
 - alias: yamaha - Adjust Volume
   trigger:
     - platform: state
       entity_id: input_number.slider2
   action:
     - service: media_player.volume_set
       data_template:
         entity_id: media_player.home_cinema_main
         volume_level: '{{ states.input_number.home_cinema_main.state | float / 80 }}'

 - alias: google home - Volume
   trigger:
     - platform: state
       entity_id: media_player.google_home
   action:
     - service: input_number.select_value
       data_template:
         entity_id: input_number.slider1
         value: '{{ states.media_player.google_home.attributes.volume_level | float * 80 }}'
         
 - alias: yamaha - Volume
   trigger:
     - platform: state
       entity_id: media_player.home_cinema_main
   action:
     - service: input_number.select_value
       data_template:
         entity_id: input_number.slider2
         value: '{{ states.media_player.home_cinema_main.attributes.volume_level | float * 80 }}'

And there is my input_number:

input_number:
  slider1:
    name: Google Home
    initial: 40
    min: 0
    max: 100
    step: 10
  slider2:
    name: Yamaha
    initial: 40
    min: 0
    max: 100
    step: 10

If you have any suggestions i will really appreciate.
Thanks

Hello Simon,

Thanks for sharing this configuration info. It solved a nagging issue I’ve had with my setup that just became apparent since version 0.81.0.

Steve K.

Wow, i have been trying to get this to work correctly for a week (finally got it “working” with a 0 to 1 slider, but the numbers didnt match up since the python file limits it to 80 and mine goes to 100).

Thank you, now when my volume is 54, it says 54 not .6275