Control Denon AVR by SONOS Playing/Paused Status using NR

Yes you need to reload automations (or restart home assistant), but that alone will not trigger the automation to run.

Yup. Cool.
So I think it’s working now after adding a delay. Was a bit quick I think for amp to process.
I need to use a template in the condition for the OFF automation to check the source interface don’t I?

Yes I think you need a template because source is an attribute, not a state.

But you don’t need this condition anyway

condition:
  - condition: state
    entity_id: media_player.denonavr
    state: 'on'

There is no harm in turning off an entity that is already off.

Wanted to protect against turning off the amp if it’s being used to watch a movie (on a different input).
It’s a slim chance of happening, but being pedantic.

If it’s a big hassle I’ll pass on this condition.

I have made a “works with Sonos” for Denon integration using node red. Hope this can help somebody…
What Im able to do is:

  1. When pressing Play/paus in Sonos app, this Turns on my AVR and selects Sonos as input.
  2. moving volume bar in sonos app is controling volume on the AVR.

Step by Step:

  1. Have the correct equitment, my setup is a Denon AVR-X3300W and a Sonos Connect connected via optical to avr.

  2. In Home Assistant, install Denon & Sonos Integrations.Make sure you can control both devices induvidully before proceeding.

  3. In Sonos app, go to Connect Settings. Select Line-Out level as “Pass-Through”. This to be able to control the volume. Seems like Sonos is creating a fictive volume control by putting it to pass-through

4 First I was setting up the “Turn on AVR” and Select correct input by using blocks within the blue box in below picture.

  1. Then to control the volume I firstly created a sensor template:
       sonosconnect_volume:
        value_template: >
          {% set volume = states.media_player.tv_rum_connect.attributes.volume_level %}
          {% set new_volume = volume * 100 %}
          {{ new_volume}}
        friendly_name: Connect Volume Level
        icon_template: mdi:volume-medium

Then I used this sensor and output to a switch block. See below pic

  1. To control the Denon Volume I used the “media_player.volume_set” service. See below pic

  2. Deploy. Finished.
    Sorry for a blurry picture, but as a new user I was not allowed to post more than one picture.

I know there is maybe a simpler way of controlling the volume of the AVR. But I could not get the msg.payload to work in the data : volume_set function.
I got the follwing message:
“Call-service API error. Error Message: expected float for dictionary value @ data[‘volume_level’]”

If somebody has a fix for this I would be happy…

I’m not familiar with NR anymore.
I ended up doing this through the automations in HA. Works a treat.
Looking at the error above I’d change the below:

      sonosconnect_volume:
        value_template: >
          {% set volume = states.media_player.tv_rum_connect.attributes.volume_level %}
          {% set new_volume = volume * 100 %}
          {{ new_volume}}

to:

      sonosconnect_volume:
        value_template: >
          {% set volume = states.media_player.tv_rum_connect.attributes.volume_level %}
          {% set new_volume = volume * 99.9 %}
          {{ new_volume}}

see how it goes…?
Here’s my automation in HA that turns my Denon on when the SONOS connected to it changes to playing:

- id: '1563129872586'
  alias: SONOS Denon ON
  trigger:
  - entity_id: media_player.rumpus
    from: paused
    platform: state
    to: playing
  condition:
  - condition: state
    entity_id: media_player.denonavr
    state: 'off'
  action:
  - data:
      entity_id: media_player.denonavr
    service: media_player.turn_on
  - delay: 00:00:04
  - data:
      entity_id: media_player.denonavr
      volume_level: 0.7
    service: media_player.volume_set
  - data:
      entity_id: media_player.denonavr
      source: SONOS
    service: media_player.select_source

the volume level in mine is also a float (with a decimal point), like yours, i need to represent mine as a fraction rather than a “%”.
I haven’t looked back since I moved to the automations from NR. So simple!

Hi
how to send command to denon to change speaker preset 1 to preset 2 ?
I can control the volume etc, but depending on the input device, I wanted to change the preset.