homebridge-denon-quickselect
Advanced tools
Comparing version 0.2.0 to 0.3.0
21
index.js
@@ -19,2 +19,3 @@ const request = require('request') | ||
this.pingUrl = config.pingUrl | ||
this.matchSource = config.matchSource | ||
@@ -51,3 +52,16 @@ if (this.zone < 1 && this.zone > 2) { | ||
DenonQuickselect.prototype.getState = function(callback) { | ||
callback(null, 0) | ||
const xml = this.buildXml({ | ||
cmd: [ | ||
{ attr: { id: '1' }, val: 'GetAllZonePowerStatus' }, | ||
{ attr: { id: '2' }, val: 'GetAllZoneSource' } | ||
] | ||
}) | ||
this.doRequest(xml).then(resp => { | ||
const power = resp.rx.cmd[0].zone1[0] === 'ON' | ||
const source = resp.rx.cmd[1].zone1[0].source[0] === this.matchSource | ||
callback(null, (power && source) ? 1 : 0) | ||
}) | ||
.catch(e => { this.log.warn(e) }) | ||
} | ||
@@ -63,6 +77,3 @@ | ||
const xml = this.buildXml({ | ||
cmd: { | ||
attr: { id: '1' }, | ||
val: 'SetQuickSelect' | ||
}, | ||
cmd: { attr: { id: '1' }, val: 'SetQuickSelect' }, | ||
zone: this.zoneName, | ||
@@ -69,0 +80,0 @@ value: this.quickselect |
{ | ||
"name": "homebridge-denon-quickselect", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "homebridge plugin to control QuickSelect on denon receivers", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
6779
110