@tplnet/homebridge-denon-heos-audio 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes of this fork. The fork is based on [hov3rcraft/homebridge-denon-heos-audio](https://github.com/hov3rcraft/homebridge-denon-heos-audio) 1.0.0-beta.1.
|
|
4
4
|
|
|
5
|
+
## 1.2.1
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- When switching on took a few seconds (e.g. while the power on favorite was being started), the tile briefly showed "off" before it switched to "on". The requested state is now reported from the moment of the tap, and intermediate states of the device are ignored until switching has finished.
|
|
10
|
+
- The player list was requested twice per device at startup.
|
|
11
|
+
|
|
5
12
|
## 1.2.0
|
|
6
13
|
|
|
7
14
|
### New
|
|
@@ -204,7 +204,10 @@ export declare class DenonClientHeosCli extends DenonClient {
|
|
|
204
204
|
private infoLog;
|
|
205
205
|
private player_name;
|
|
206
206
|
constructor(serialNumber: string, name: string, host: string, connect_timeout: number, response_timeout: number, debugLogCallback?: (message: string, ...parameters: any[]) => void, powerUpdateCallback?: (power: boolean) => void, muteUpdateCallback?: (mute: boolean) => void, volumeUpdateCallback?: (volume: number) => void, inputUpdateCallback?: (input: string) => void);
|
|
207
|
+
private playerIdLookup;
|
|
208
|
+
/** Looks up the player id; concurrent calls share one request. */
|
|
207
209
|
private findPlayerId;
|
|
210
|
+
private findPlayerIdUncached;
|
|
208
211
|
protected subscribeToChangeEvents(): Promise<void>;
|
|
209
212
|
protected sendCommand(command: ProtocolCommand, commandMode: CommandMode, { value, passPayload }: {
|
|
210
213
|
value?: string;
|
|
@@ -275,7 +275,15 @@ export class DenonClientHeosCli extends DenonClient {
|
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
playerIdLookup;
|
|
279
|
+
/** Looks up the player id; concurrent calls share one request. */
|
|
280
|
+
findPlayerId() {
|
|
281
|
+
this.playerIdLookup ??= this.findPlayerIdUncached().finally(() => {
|
|
282
|
+
this.playerIdLookup = undefined;
|
|
283
|
+
});
|
|
284
|
+
return this.playerIdLookup;
|
|
285
|
+
}
|
|
286
|
+
async findPlayerIdUncached() {
|
|
279
287
|
const payload_str = await super.sendCommand(DenonClientHeosCli.PROTOCOL.PLAYERS, CommandMode.GET, { passPayload: true });
|
|
280
288
|
const payload = JSON.parse(payload_str);
|
|
281
289
|
if (!Array.isArray(payload)) {
|
|
@@ -38,6 +38,7 @@ export declare class DenonAudioAccessory {
|
|
|
38
38
|
private targetMediaState;
|
|
39
39
|
private volumeChangeOngoing;
|
|
40
40
|
private pendingActive;
|
|
41
|
+
private powerChangeInProgress;
|
|
41
42
|
private playingChangeOngoing;
|
|
42
43
|
constructor(platform: DenonAudioPlatform, accessory: PlatformAccessory, config: DeviceConfig, log: Logger);
|
|
43
44
|
/**
|
|
@@ -44,6 +44,7 @@ export class DenonAudioAccessory {
|
|
|
44
44
|
targetMediaState;
|
|
45
45
|
volumeChangeOngoing = false;
|
|
46
46
|
pendingActive;
|
|
47
|
+
powerChangeInProgress = false;
|
|
47
48
|
playingChangeOngoing = false;
|
|
48
49
|
constructor(platform, accessory, config, log) {
|
|
49
50
|
log.debug("Initializing DenonAudioAccessory...");
|
|
@@ -312,6 +313,10 @@ export class DenonAudioAccessory {
|
|
|
312
313
|
async setActive(newValue) {
|
|
313
314
|
this.log.debug(`setActive for ${this.name} set to ${newValue}`);
|
|
314
315
|
const active = newValue === this.platform.Characteristic.Active.ACTIVE;
|
|
316
|
+
// Report the requested state right away: switching on can take a few seconds (e.g. when the power on favorite is
|
|
317
|
+
// started), and the device reports intermediate states during that time.
|
|
318
|
+
this.pendingActive = { value: active, until: Number.POSITIVE_INFINITY };
|
|
319
|
+
this.powerChangeInProgress = true;
|
|
315
320
|
try {
|
|
316
321
|
await this.denonClient.setPower(active);
|
|
317
322
|
this.pendingActive = { value: active, until: Date.now() + DenonAudioAccessory.POWER_STATE_SETTLE_TIME };
|
|
@@ -321,6 +326,9 @@ export class DenonAudioAccessory {
|
|
|
321
326
|
this.log.error(`An error occured while setting power status for ${this.name}.`, error);
|
|
322
327
|
throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
323
328
|
}
|
|
329
|
+
finally {
|
|
330
|
+
this.powerChangeInProgress = false;
|
|
331
|
+
}
|
|
324
332
|
}
|
|
325
333
|
async setActiveIdentifier(newValue) {
|
|
326
334
|
this.log.debug(`setActiveIdentifier for ${this.name} set to ${newValue}`);
|
|
@@ -542,6 +550,10 @@ export class DenonAudioAccessory {
|
|
|
542
550
|
* Handles characteristic updates from the API
|
|
543
551
|
*/
|
|
544
552
|
callbackActive(active) {
|
|
553
|
+
if (this.powerChangeInProgress && this.pendingActive && this.pendingActive.value !== active) {
|
|
554
|
+
this.log.debug(`Ignoring intermediate power state ${active} of ${this.name} while switching.`);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
545
557
|
if (this.pendingActive && this.pendingActive.value !== active) {
|
|
546
558
|
// changed on the device (e.g. in the HEOS app) - the device state wins
|
|
547
559
|
this.pendingActive = undefined;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tplnet/homebridge-denon-heos-audio",
|
|
3
3
|
"displayName": "Homebridge Denon Heos Audio (tplnet)",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.1",
|
|
6
6
|
"description": "Control your Denon and Marantz HEOS speakers, amplifiers and AVRs via AVR Control and/or HEOS CLI",
|
|
7
7
|
"author": "tplnet",
|
|
8
8
|
"contributors": [
|