External integration - Denon / Marantz AVR

New version of the Denon / Marantz integration: 1.2.4, published (it will arrive in the store at the next indexer pass). It requires Gladys 5.3.0 or newer; on an older Gladys, version 1.2.3 remains installed.

The amp becomes a Gladys music player

In the Music box of the dashboard, and in the scene action « Play music » of Gladys:

  • browse the music services connected to the amp in the HEOS app, as in the app: your HEOS favorites, your HEOS playlists, and each service;
  • search for an artist, album, playlist, or track;
  • play by replacing the queue, playing next, or adding to the end;
  • view the queue and skip to a track;
  • view the current track, artist, album, and cover.

For an already added amp: Discovery, then « Update » on the amp, to get the new features.

Qobuz

Since 2025, Qobuz is integrated with HEOS: just link your account in the HEOS app. The integration only talks to the amp, never directly to Qobuz.

  • The scene action « Amp: Play from Qobuz » plays one of your playlists, an album, the latest album by an artist, an artist, or a track. Existing scenes work without any changes.
  • Fix: HEOS marks Qobuz playlists as « unplayable ». They were therefore ignored; they are now found and played.

Other services in the HEOS app

New scene action « Amp: Play from a HEOS service », with the service of your choice:

  • TIDAL, Deezer, SoundCloud, Napster: browse, search, play a playlist, an album, the latest album by an artist, an artist, or a track;
  • TuneIn, iHeartRadio: a radio by name, for example FIP;
  • Amazon Music: can be browsed, but HEOS does not allow searching;
  • Network music servers (DLNA), USB key, AUX inputs: can be browsed and played;
  • Spotify: in HEOS, Spotify only works through Spotify Connect, from the Spotify app. It does not have a catalog that the amp can browse: the integration cannot launch it.

A setting « Preferred music service for search » chooses where to search: Qobuz if connected, otherwise all services.

Known limitations

  • HEOS does not provide the date of albums: the « latest album » is deduced from the artist’s page. The action states how it was found.
  • Gladys waits for a music command for 10 seconds. If a service responds slowly, the integration stops before and states this, without launching anything. Only exception: if the amp is slow to confirm the very last step, the music may start anyway after the message.
  • Qobuz is not in the official HEOS documentation. I was not able to test everything on an amp: your feedback is precious.

If you have a moment

  1. Configuration → « HEOS and Qobuz services: check » (with an artist if you want): the list of your services is displayed, and the « Qobuz check » lines in the logs show what the amp responds. Post them here, without your account name.
  2. The Music box: browse and search in your services.
  3. A scene with a playlist, an album, and the latest album by an artist you know well: is it correct?

Having trouble? Let us know here or in an issue in the repository.

Hi @lmilcent!

First of all, thanks for the integration, I now use it for the voice of my alarm: Gladys scenes that make the living room amp speak when a door opens at night or when the alarm is armed. And that’s exactly where I encountered two issues when the amp comes out of standby. Nothing serious during the day, but for an alarm it’s annoying ^^

My setup: Nvidia Shield → Denon AVR-S650H → LG TV, with HDMI-CEC enabled everywhere (that’s what turns on the TV when you wake up the Shield). Version 1.2.4, announcement_volume at 50, announcement_restore enabled.

1. From standby, the volume is ignored and the beginning of the sentence is lost

In the logs, the integration sends PWON, then the volume and the play_stream about 1.5 seconds later (the settle(timing.zoneSwitchDelayMs) from ensureZoneOn). My amp takes about 4 to 5 seconds to really wake up:

  • the volume command arrives too early, it ignores it: the announcement comes out at the volume before standby (in my case 20, so barely audible);
  • the first one to two seconds of sound are lost: a short announcement like “Night surveillance activated” disappears completely.

When the amp is already on, everything works perfectly.

2. Returning to the previous state wakes up the Shield, which turns everything back on

In restore(), the original input (in my case the HDMI input of the Shield) is set before returning to standby. Except that selecting an HDMI input causes the amp to send a CEC message <Routing Change> to the device connected to it. In the Shield’s logcat:

HDMI-CEC: onReceiveCommand: <Routing Change> 5F:80:40:00:45:00
HDMI-CEC: go wakeup and send active source
PowerManagerService: Waking up from Asleep (reason=WAKE_REASON_HDMI)
OneTouchPlayAction: HDMI-CEC: start OneTouchPlay action

The Shield wakes up, does a “One Touch Play”, and turns the amp and TV back on just after the PWSTANDBY. Result: every announcement at night, the living room TV turns on to the Shield’s home screen :sweat_smile:

What I would suggest

Two small modifications, which I couldn’t test in real life since the integration container is read-only (they just pass node --check):

  1. In ensureZoneOn (control.js), wait longer when the amp was coming out of standby:
const wakingUp = state.power !== 1;
// ...
if (switched) {
  await settle(wakingUp ? Math.max(timing.zoneSwitchDelayMs, 5000) : timing.zoneSwitchDelayMs);
}

(Better yet, wait for the amp to confirm PWON then a short delay, but I don’t know what that does on other models.)

  1. In restore() (announcements.js), don’t set the input if we’re going back to standby:
if (
  snapshot.power !== 0 &&
  snapshot.source &&
  snapshot.source !== HEOS_SOURCE_CODE &&
  state.source === HEOS_SOURCE_CODE
) {
  setSource(externalId, snapshot.source, zone);
}

The amp then goes back to standby on the network input. At the next wake-up by the Shield, the CEC puts it back on the correct input anyway.

Small thing by the way: as you noted in the code, the volume requested in the scene action is lost by the core. So you can’t have a discreet announcement at night and a loud alert with the same amp. If one day the core transmits the options, that would be great ^^

In the meantime, I’ve cut the voices from my alarm. I can test a corrected version as soon as you want. Let me know if I misread your code!

Thanks @guim31 for this thorough diagnosis, including the Shield logcat: you read the code correctly, the two issues were exactly those. It’s in v1.2.5: Release v1.2.5 · LM1LC3N7/gladys-denon-avr · GitHub (it will be in the store at the next indexer run).

1. Announcement since last night: waiting for the amp
I took your “even better” version: since last night, the announcement waits for the amp to confirm PWON (5 seconds max, then it continues anyway), waits 2 more seconds, changes the input, then waits for the amp to return the requested volume (4 seconds max, the volume command is sent every second) before playing the sound. All waits are bounded, around 12.5 seconds in the worst case. The scene action responds immediately to Gladys and the rest continues in the background.
Other cases covered along the way:

  • two close announcements share the same wake-up, and the second also waits for its volume;
  • if you turn off the amp during wake-up (scene, widget, or remote), the announcement stops immediately and nothing is sent after;
  • an amp woken up by the integration always goes back to standby afterward, even if it never confirmed its power-on.
    When the amp is already on, nothing changes.

2. No more HDMI input reset before standby
As you suggested: when the amp goes back to standby, the original input is no longer reset, so no more <Routing Change> to the Shield. The amp goes back to sleep on the network input, and the CEC puts it back on the correct input when the Shield turns it back on. If the amp was on before the announcement, the input is still reset as before.

The volume of the scene action
Still lost by the core in 5.3.2: the scene correctly passes { volume }, but the external integration proxy only transmits the value. Nothing can be done on the integration side for now; it’s being tracked on the SDK side.

I don’t have an S650H: everything was tested on a fake amp. When you put your alarm voices back, let me know if, since standby, the volume is correct, if the beginning of the sentence is heard, and if the TV stays off. If your amp takes more than 5 seconds to confirm PWON, the DEBUG logs will tell me.

Thanks @lmilcent for the 1.2.5, super quick! :folded_hands:

First test since yesterday: the Shield stays well asleep after the announcement, it’s fixed :+1:

For the beginning of the sentence, it’s much better but there are still about 2 seconds missing for me. In the logs, the stream starts 4.9 seconds after the PWON:

13:33:07.224 power on (before an announcement) -> sent PWON
13:33:10.225 the receiver is still waking up, the announcement goes on
13:33:12.080 HEOS accepted the "Speak on a speaker" stream

On « Alarme en cours d’activation. Vous avez une minute pour quitter la maison. », I only hear « Vous avez une minute… ». I have the impression that my AVR-S650H responds « allumé » well before the audio output is ready.

Could you make the wakeSettleMs adjustable in the config (or increase it to 4-5 s)? In the meantime, I start my messages with « Attention, attention. », so that’s what gets cut off ^^

Thanks @guim31 for the test and timestamps, it’s very clear. It’s in v1.2.6: Release v1.2.6 · LM1LC3N7/gladys-denon-avr · GitHub (it will arrive in the store at the next indexer run).

  • New setting: “Delay after power-on before an announcement (seconds)”, from 0 to 15 s, in the integration configuration.
  • New default: 4 s instead of 2. With your measurements, this should be enough for the beginning of the sentence; if a word is still missing, increase to 5 or 6.
  • Turning off the amp during this wait cancels the announcement immediately.
  • Worst case since yesterday: about 25 s with the maximum of 15 s (the details are in the documentation). Scenes still have their response in 3 s.

Your feedback with the S650H is welcome, especially to know which value suits you.