Controlling a Denon AVR

Yes, using the three dots on the media player card I still can select my favorite radios, as I see today. I’m pretty sure, they were missing a week a go, but they are back now.
I can’t say, where the problem was, it solved it self somehow… :wink:

Thank you guys, I’ll check it out and report back!

Based on the post and script from @JoFie, I created this script for all the Denon commands, rather than embed them in the card. I’m sure it could use some tuning.

alias: denon_cntrl
description: Control Denon AVR
fields:
  device:
    description: Denon AVR to control (default is set to my device name, media_player.denon_avr_s740h
  action:
    description: volup (with stepcount), voldn (with stepcount), volset (with stepcount), volmute (toggle), sel_src (with source), nav (with direction), power (toggle), heos_fav (with stepcount for fav#)
  stepcount:
    description: Number of steps (used with volup, voldn, volset (specific volume ie, 50) and as heos_fav #)
  source:
    description: Source to select (DVD, BD, TV, SAT/CBL, GAME, or any listed in Denon API)

  direction:
    description: Cursor direction (CUP, CDN, CLT, CRT, ENT)
variables:
  device: "{{ device | default('media_player.denon_avr_s740h') }}"
  action: "{{ action }}"
  stepcount: "{{ stepcount | default(2) }}"
  source: "{{ source | default('SAT/CBL') }}"
  direction: "{{ direction | upper | default('ENT') }}"
sequence:
  - choose:
      - conditions: "{{ action == 'volup' }}"
        sequence:
          - repeat:
              count: "{{stepcount*2}}"
              sequence:
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0.2
                    milliseconds: 0
                - service: denonavr.get_command
                  data:
                    command: /goform/formiPhoneAppDirect.xml?MVUP
                  target:
                    entity_id: "{{ device }}"
      - conditions: "{{ action == 'voldn' }}"
        sequence:
          - repeat:
              count: "{{ stepcount * 2  }}"
              sequence:
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0.2
                    milliseconds: 0
                - service: denonavr.get_command
                  data_template:
                    entity_id: "{{ device }}"
                    command: /goform/formiPhoneAppDirect.xml?MVDOWN
      - conditions: "{{ action == 'volset' }}"
        sequence:
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?MV{{ stepcount}}
            target:
              entity_id: "{{ device }}"
      - conditions: "{{ action == 'volmute' }}"
        sequence:
          - choose:
              - conditions: "{{ state_attr(device, 'is_volume_muted') }}"
                sequence:
                  - service: denonavr.get_command
                    data:
                      entity_id: "{{ device }}"
                      command: /goform/formiPhoneAppDirect.xml?MUOFF
            default:
              - service: denonavr.get_command
                data:
                  entity_id: "{{ device }}"
                  command: /goform/formiPhoneAppDirect.xml?MUON
      - conditions: "{{ action == 'sel_src' }}"
        sequence:
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?SI{{ source }}
            target:
              entity_id: "{{ device }}"
      - conditions: "{{ action == 'nav' }}"
        sequence:
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?MN{{ direction }}
            target:
              entity_id: "{{ device }}"
      - conditions: "{{ action == 'power' }}"
        sequence:
          - choose:
              - conditions:
                  condition: state
                  entity_id: media_player.denon_avr_s740h
                  state: "on"
                sequence:
                  - service: denonavr.get_command
                    data_template:
                      entity_id: "{{ device }}"
                      command: /goform/formiPhoneAppDirect.xml?PWSTANDBY
            default:
              - service: denonavr.get_command
                data_template:
                  entity_id: "{{ device }}"
                  command: /goform/formiPhoneAppDirect.xml?PWON
      - conditions: "{{ action == 'heos_fav' }}"
        sequence:
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?SINET
            target:
              entity_id: "{{ device }}"
          - delay:
              hours: 0
              minutes: 0
              seconds: 1.5
              milliseconds: 0
          - repeat:
              count: "3"
              sequence:
                - service: denonavr.get_command
                  data:
                    command: /goform/formiPhoneAppDirect.xml?MNCUP
                  target:
                    entity_id: "{{ device }}"
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0.5
                    milliseconds: 0
          - delay:
              hours: 0
              minutes: 0
              seconds: 1.5
              milliseconds: 0
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?MNCDN
            target:
              entity_id: "{{ device }}"
          - delay:
              hours: 0
              minutes: 0
              seconds: 0.5
              milliseconds: 0
          - service: denonavr.get_command
            data:
              command: /goform/formiPhoneAppDirect.xml?MNENT
            target:
              entity_id: "{{ device }}"
          - delay:
              hours: 0
              minutes: 0
              seconds: 0.5
              milliseconds: 0
          - repeat:
              count: "{{ stepcount - 1 }}"
              sequence:
                - delay: 0.3
                - service: denonavr.get_command
                  data:
                    command: /goform/formiPhoneAppDirect.xml?MNCDN
                  target:
                    entity_id: "{{ device }}"
          - delay:
              hours: 0
              minutes: 0
              seconds: 0.5
              milliseconds: 0
          - repeat:
              count: 2
              sequence:
                - service: denonavr.get_command
                  data:
                    command: /goform/formiPhoneAppDirect.xml?MNENT
                  target:
                    entity_id: "{{ device }}"
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 0.5
                    milliseconds: 0
mode: queued
max: 10
3 Likes

I did a factory reset and blocked said adress.

Apparently that also disables the heos login in my AVR-X1600H. After removing the the block, I logged in on my HEOS account on my AVR and tadaa, my radio stations are back!

You might want to upvote this feature request to also add HEOS support to the Music Assistant add-on of Home Assistant. HEOS as Player Provider · music-assistant · Discussion #1167 · GitHub
Currently v2.0 of Music assistant is in beta testing.
HEOS speakers currently only work as a DLNA player which is not ideal.

1 Like

Just to follow-up that there is now a poll on which smart speakers / media players to integrate into Music Assistant. Feel free to vote for HEOS if you’re interested :slight_smile: Player Provider Poll #1 · music-assistant · Discussion #1200 · GitHub

That looks interesting. Was wondering how to deeply integrate my 2 Denon AVRs into Home Assistant. Do you have a sleek UI to make use of this code?

Hi all,
I have a Marantz SR5015, and wonder if it is possible to set a speaker preset using home assistant. I would love to have a quick settings tile that would switch between preset 1 and 2.

As far as I understand this you can control any attribute of an entity. Here’s the attribute list of my Denon AVR-3313

I can change the source and the sound_mode but nothing else.

I would start by looking at the attributes for your Marantz and see what’s available. Also check the doc Denon AVR Network Receivers - Home Assistant

I use a small Node RED XML + HTTP module to invoke my Marantz receiver presets 1, 2, 3 and 4. Goes directly, bypasses the Xenon integration.

Hey, Have you figured this one out?
having the same issue
Cheers!

Nope not really. Other than setting a delay and then lower the volume.

Afraid not, I didn’t explore much further tbh as I’m quite content with just being able to adjust subwoofer and centre.

anyone know how to make a button with a set volume for the volume limit ?

say a button for -20 db and a button for -10.

so if i click either it limits the volume on the receiver

I have an automation setup using a scene where I use the Media Player: Set Volume service to set my AVR to - 24 every morning when I get up. Maybe have a couple of scenes set up with different levels and then link the buttons to call the scenes?

I am working to integrate my Denon A1H into my home theater and be able to make quick changes to the configuration without using the Denon App or remote. I also want to be able to take status from the Denon A1H and use those outputs as inputs into automations.

I have figured out how to set Speaker Presets (1 and 2) as well as specific DIRAC Configurations.

Here are some of my Scripts. I hope they help.


denon_preset_1:
  alias: Speaker Preset 1
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?SPPR 1

denon_preset_2:
  alias: Speaker Preset 2
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?SPPR 2

denon_dirac_slot_1:
  alias: Dirac Slot 1
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?PSDIRAC 1

denon_dirac_slot_2:
  alias: Dirac Slot 2
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?PSDIRAC 2

denon_dirac_slot_3:
  alias: Dirac Slot 3
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?PSDIRAC 3

denon_dirac_off:
  alias: Dirac Off
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?PSDIRAC OFF


denon_dirac_off:
  alias: Dirac Off
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?PSDIRAC OFF
1 Like

With the above I am also trying to determine the state of the recieved and the video signal coming into it.

denon_get_hdr:
  alias: get HDR 
  sequence:
    - service: denonavr.get_command
      target:
        entity_id: media_player.denon_main_zone
      data:
        command: /goform/formiPhoneAppDirect.xml?SSINFSIGHDR ?

The output in the Denon telnet session is

SSINFSIGHDR I---
SSINFSIGHDR O---

Which denotes SDR, it will change to DOLBYVISION or HDR depending on the input

The issue is, I cannot figure out how to get this info BACK into Home Assistant
Does anyone know how to get the response from the get_command back into HA?

2 Likes

Are you getting the queries to the AVR from a documented API?

I am watching the traffic on the telnet session as I submit commands on the HTTP UI

1 Like

Probably my Pioneer (Onkyo) can be sniffed too between it and app. I’ll check.

1 Like