From c8ccaf1c2d0a076b452699ee6b691cba3a659c23 Mon Sep 17 00:00:00 2001 From: ebaauw Date: Thu, 30 May 2019 13:04:31 +0200 Subject: [PATCH] DeviceProperties loggin See #74. --- lib/ZpAccessory.js | 10 ++++++++++ lib/ZpPlatform.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ZpAccessory.js b/lib/ZpAccessory.js index 266d464..ddc128e 100644 --- a/lib/ZpAccessory.js +++ b/lib/ZpAccessory.js @@ -282,6 +282,7 @@ function ZpAccessory (platform, zp) { this.alarmClock = new SonosModule.Services.AlarmClock(this.zp.host, this.zp.port) this.on('GroupManagement', this.handleGroupManagementEvent) + this.on('DeviceProperties', this.handleDevicePropertiesEvent) this.on('AVTransport', this.handleAVTransportEvent) this.on('RenderingControl', this.handleRenderingControlEvent) this.on('GroupRenderingControl', this.handleGroupRenderingControlEvent) @@ -390,6 +391,11 @@ ZpAccessory.prototype.createSubscriptions = function () { member.log.info('%s: member of group %s', member.name, member.coordinator.name) member.copyCoordinator() } + this.subscribe('DeviceProperties', (err) => { + if (err) { + this.log.error('%s: subscribe to DeviceProperties events: %s', this.name, err) + } + }) this.subscribe('MediaRenderer/AVTransport', (err) => { if (err) { this.log.error('%s: subscribe to AVTransport events: %s', this.name, err) @@ -453,6 +459,10 @@ ZpAccessory.prototype.handleGroupManagementEvent = function (data) { } } +ZpAccessory.prototype.handleDevicePropertiesEvent = function (data) { + this.log('%s: DeviceProperties event: %j', this.name, data) +} + ZpAccessory.prototype.handleAVTransportEvent = function (data) { this.log.debug('%s: AVTransport event', this.name) this.parser.parseString(data.LastChange, (err, json) => { diff --git a/lib/ZpPlatform.js b/lib/ZpPlatform.js index 03f7e56..be1d7f1 100644 --- a/lib/ZpPlatform.js +++ b/lib/ZpPlatform.js @@ -270,7 +270,7 @@ ZpPlatform.prototype.findPlayers = function () { if (err) { this.log.error('%s: error %s', zp.zone, err) } else { - // this.log.debug('%s: info %j', zp.zone, info) + this.log('%s: info %j', zp.zone, info) zp.id = 'RINCON_' + info.MACAddress.replace(/:/g, '') + ('00000' + zp.port).substr(-5, 5) zp.version = info.DisplaySoftwareVersion