Below is a panel I made to control my Denon AVR, should anyone be interested.
Some notes:
- It makes use of the Custom Button Card.
- Replace my entity id “
media_player.denon_avr_2113
” with your own AVR entity.
- The buttons only cover functions I want to use in HA, mainly internet radio. A lot of stuff is missing, like DVD controls etc. Change/add buttons as you need, using the API commands from this list .
- I use scripts to help with some of the functionality. The definitions are given below.
- Change the colors to match your scheme.
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: 'custom:button-card'
entity: media_player.denon_avr_2113
name: Denon
color_type: label-card
show_state: true
icon: |
[[[
if (entity.state == 'off')
return "mdi:amplifier-off"
else if (entity.attributes.source == 'TV AUDIO')
return "mdi:television-classic";
else if (entity.attributes.source == 'DVD')
return "mdi:music-circle-outline";
else if (entity.attributes.media_title == 'AirPlay')
return "mdi:cast-audio"
else if (entity.state == 'playing' || entity.attributes.source == 'FM')
return "mdi:radio"
else
return "mdi:cast-connected";
]]]
size: 90%
styles:
card:
- height: 175px
- border-radius: 5%
- background-image: >-
linear-gradient(90deg, rgba(13, 44, 99,1) 0%, rgba(9, 34, 79,1)
7%, rgba(81, 132, 224,1) 100%)
- padding: 4%
- padding-left: 6%
- color: lime
- font-size: 13px
- text-shadow: 1px 1px 5px black
icon:
- color: lightgrey
- margin-top: 1%
- padding: 0px 10px 0px 0px
img_cell:
- justify-content: end
- align-items: start
name:
- font-weight: bold
- color: white
- font-size: 33px
- padding: 10px 0px 5px 170px
state:
- font-weight: bold
- font-size: 16px
- justify-self: middle
- padding: 0px 10px
grid:
- position: relative
- grid-template-areas: >-
"n . i" "volume . i" "muted . i" "source . i" "title title
title" "artist artist s"
- grid-template-columns: 1fr 1fr 1fr
- grid-template-rows: 1fr min-content min-content min-content min-content
custom_fields:
volume:
- padding-top: 15px
- padding-bottom: 2px
- align-self: middle
- justify-self: start
muted:
- padding-bottom: 2px
- align-self: middle
- justify-self: start
source:
- padding-bottom: 2px
- align-self: middle
- justify-self: start
title:
- padding-bottom: 2px
- align-self: middle
- justify-self: start
artist:
- align-self: middle
- justify-self: start
custom_fields:
volume: |
[[[
if ( entity.state == 'off' )
return ``
else
return `<ha-icon
icon="mdi:volume-high"
style="width: 18px; height: 17px; color: deepskyblue;">
</ha-icon><span> Volume: <span style="color: var(--text-color-sensor);">${Math.round((states['media_player.denon_avr_2113'].attributes.volume_level)*100)}</span></span>`
]]]
muted: |
[[[
if ( entity.state == 'off' )
return ``
else
return `<ha-icon
icon="mdi:volume-off"
style="width: 18px; height: 17px; color: deepskyblue;">
</ha-icon><span> Muted: <span style="color: var(--text-color-sensor);">${states['media_player.denon_avr_2113'].attributes.is_volume_muted}</span></span>`
]]]
source: |
[[[
if ( entity.state == 'off' )
return ``
else
return `<ha-icon
icon="mdi:dlna"
style="width: 18px; height: 17px; color: deepskyblue;">
</ha-icon><span> Source: <span style="color: var(--text-color-sensor);">${states['media_player.denon_avr_2113'].attributes.source} </span></span>`
]]]
title: |
[[[
if ( entity.state == 'off' || !(entity.attributes.title) )
return ``
else if ( entity.state == 'playing' || (entity.state == 'on' && entity.attributes.source != 'TV AUDIO') )
return `<ha-icon
icon="mdi:form-textbox"
style="width: 18px; height: 17px; color: deepskyblue;">
</ha-icon><span> Title: <span style="color: var(--text-color-sensor);">${states['media_player.denon_avr_2113'].attributes.media_title} </span></span>`
else
return ``
]]]
artist: |
[[[
if ( entity.state == 'off' || !(entity.attributes.media_artist) )
return ``
else
return `<ha-icon
icon="mdi:account-voice"
style="width: 18px; height: 17px; color: deepskyblue;">
</ha-icon><span> Artist: <span style="color: var(--text-color-sensor);">${states['media_player.denon_avr_2113'].attributes.media_artist} </span></span>`
]]]
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV15
- type: horizontal-stack
cards:
- type: 'custom:button-card'
color_type: blank-card
- type: 'custom:button-card'
entity: media_player.denon_avr_2113
size: 25px
name: power
show_name: false
show_state: false
color_type: card
color: 'rgb(45, 79, 140)'
state:
- value: 'off'
icon: 'mdi:power'
color: 'rgb(109, 117, 138)'
styles:
icon:
- color: 'rgb(230, 235, 148)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MUOFF
- operator: default
icon: 'mdi:power-settings'
styles:
icon:
- color: yellow
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MUON
- type: 'custom:button-card'
color_type: blank-card
- type: 'custom:button-card'
show_name: false
icon: |
[[[
if ( states['media_player.denon_avr_2113'].attributes.is_volume_muted ) return 'mdi:volume-off';
else return 'mdi:volume-high';
]]]
size: 25px
color_type: card
color: 'rgb(45, 79, 140)'
tap_action:
action: call-service
service: script.denon_mute_unmute
- type: 'custom:button-card'
icon: 'mdi:volume-minus'
size: 25px
color_type: card
color: 'rgb(45, 79, 140)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MVDOWN
double_tap_action:
action: call-service
service: script.denon_vol_decrease
service_data:
stepcount: 10
- type: 'custom:button-card'
icon: 'mdi:volume-plus'
size: 25px
color_type: card
color: 'rgb(45, 79, 140)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MVUP
double_tap_action:
action: call-service
service: script.denon_vol_increase
service_data:
stepcount: 10
- type: 'custom:button-card'
color_type: blank-card
- type: horizontal-stack
cards:
- type: 'custom:button-card'
name: 10
color_type: card
color: 'rgb(40, 69, 120)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV10
- type: 'custom:button-card'
name: 15
color_type: card
color: 'rgb(40, 69, 120)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV15
- type: 'custom:button-card'
name: 20
color_type: card
color: 'rgb(40, 69, 120)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV20
- type: 'custom:button-card'
name: 25
color_type: card
color: 'rgb(40, 69, 120)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV25
- type: 'custom:button-card'
name: 28
color_type: card
color: 'rgb(40, 69, 120)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MV28
- type: horizontal-stack
cards:
- type: 'custom:button-card'
icon: 'mdi:arrow-up-thick'
size: 22px
color_type: card
color: 'rgb(35, 58, 99)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNCUP
- type: 'custom:button-card'
icon: 'mdi:arrow-down-thick'
size: 22px
color_type: card
color: 'rgb(35, 58, 99)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNCDN
- type: 'custom:button-card'
icon: 'mdi:arrow-left-thick'
size: 22px
color_type: card
color: 'rgb(35, 58, 99)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNCLT
- type: 'custom:button-card'
icon: 'mdi:arrow-right-thick'
size: 22px
color_type: card
color: 'rgb(35, 58, 99)'
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNCRT
- type: 'custom:button-card'
name: Enter
tooltip: Enter
Xicon: 'mdi:subdirectory-arrow-right'
icon: 'mdi:arrow-right-bold-outline'
size: 22px
color_type: card
color: 'rgb(35, 58, 99)'
show_name: false
styles:
name:
- font-size: 14px
- padding: 1px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNENT
- type: horizontal-stack
cards:
- type: 'custom:button-card'
name: Fav
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIFVP
- type: 'custom:button-card'
name: iFav
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIFAVORITES
- type: 'custom:button-card'
name: iRadio
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIIRADIO
- type: 'custom:button-card'
name: Recent
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIIRP
- type: 'custom:button-card'
name: TV
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SITV
- type: 'custom:button-card'
name: DVD
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIDVD
- type: 'custom:button-card'
name: Tuner
color_type: card
color: 'rgb(50, 52, 97)'
styles:
name:
- font-size: 16px
- padding: 3px 0px
tap_action:
action: call-service
service: denonavr.get_command
service_data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SITUNER
- type: horizontal-stack
cards:
- type: 'custom:button-card'
name: Sky
tooltip: Pop
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 1
- type: 'custom:button-card'
name: 538
tooltip: Pop
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 2
- type: 'custom:button-card'
name: 100%NL
tooltip: Dutch
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 3
- type: 'custom:button-card'
name: SLAM
tooltip: Pop
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 4
- type: horizontal-stack
cards:
- type: 'custom:button-card'
name: SkyL
tooltip: Lounge
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 5
- type: 'custom:button-card'
name: Arrow Rock
tooltip: Rock
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 6
- type: 'custom:button-card'
name: Splash
tooltip: Lounge
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 7
- type: 'custom:button-card'
name: Antenne
tooltip: 80s Hits
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 8
- type: horizontal-stack
cards:
- type: 'custom:button-card'
name: Radio32
tooltip: Oldies
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 9
- type: 'custom:button-card'
name: RTL
tooltip: Pop
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 10
- type: 'custom:button-card'
name: 1Live
tooltip: Pop
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 11
- type: 'custom:button-card'
name: Radio2
tooltip: Dutch
color_type: card
color: 'rgb(30, 45, 71)'
styles:
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 12
- type: horizontal-stack
cards:
- type: 'custom:button-card'
color_type: blank-card
- type: 'custom:button-card'
name: 100% Classic
tooltip: Cliassic
color_type: card
color: 'rgb(30, 45, 71)'
styles:
card:
- height: 34px
name:
- font-size: 16px
- padding: 2px 0px
tap_action:
action: call-service
service: script.denon_favorite_station
service_data:
stepcount: 13
- type: 'custom:button-card'
color_type: blank-card
- type: 'custom:button-card'
color_type: label
color: var(--primary-color)
styles:
card:
- border-radius: 80%;
- height: 20px
- background-image: >-
linear-gradient(90deg, rgba(13, 44, 99,1) 0%, rgba(9, 34, 79,1) 7%,
rgba(81, 132, 224,1) 100%)
Below are the scripts used in the panel.
- mute / unmute the AVR, based on its current status.
- increase- and decrease volume. Double-click volume up/down will repeatedly send the volume command to the AVR 10x (effectively 5 stops, as the AVR changes 0.5 at a time).
- selecting a station from the Favorites list. I could not find a command to directly select a specific Favorite station, so I start from the top each time and go down in the list for a specified count to find the desired position in the list. Slow, but it works.
# Denon AVR - Mute OR Unmute sound (toggle)
denon_mute_unmute:
description: Toggle Denon Mute/Unmute status
sequence:
- choose:
# IF Denon is currently MUTED, then unmute
- conditions: "{{ state_attr('media_player.denon_avr_2113', 'is_volume_muted') }}"
sequence:
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MUOFF
# IF Denon is currently UNMUTED, then mute (Note: few seconds delay in state update after change)
default:
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MUON
# Denon AVR - Increase the volume by nr of steps provided by parameter
denon_vol_increase:
description: Increase Denon volume by specified nr of steps
fields:
stepcount:
description: Number of UP steps
variables:
stepcount: "{{ stepcount | default(2) }}"
sequence:
- repeat:
count: "{{ stepcount }}"
sequence:
- delay: 0.1
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MVUP
# Denon AVR - Decrease the volume by nr of steps provided by parameter
denon_vol_decrease:
description: Decrease Denon volume by specified nr of steps
fields:
stepcount:
description: Number of DOWN steps
variables:
stepcount: "{{ stepcount | default(2) }}"
sequence:
- repeat:
count: "{{ stepcount }}"
sequence:
- delay: 0.1
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MVDOWN
# Denon AVR - Favorites + nr of steps down
denon_favorite_station:
description: Denon Favorite Station
fields:
stepcount:
description: Number of DOWN steps
variables:
stepcount: "{{ stepcount | default(0) }}"
sequence:
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?SIFAVORITES
- delay: 2.5
- repeat:
count: "{{ stepcount }}"
sequence:
- delay: 0.3
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNCDN
- delay: 1.5
- service: denonavr.get_command
data:
entity_id: media_player.denon_avr_2113
command: /goform/formiPhoneAppDirect.xml?MNENT