lmoe/node-denon-client

Power control is wrong

Opened this issue · 0 comments

Hi,

This library has 2 power options:

  1. To "power on" (or whatever state)
  2. To power zone 2 to whatever state.

If "setPower" is used (option 1 from above) then it powers on all the zones the receiver has. Some might want that, i didn't :)

So these commands:

  /**
   * Sets the power mode of the Denon AVR. (On / Standby).
   * Use {PowerOptions}.
   *
   * @method setPower
   * @param {PowerOptions} powerOptions [The power option]
   * @return {Promise} [A response]
   */
  setPower(powerOptions) {

    return this.sendCommand('PW', powerOptions,
      this.getEvent('power'));
  }

  /**
   * Returns the current power status of the Denon AVR.
   *
   * @method getPower
   * @return {Promise} [A response]
   */
  getPower() {

    return this.sendCommand('PW', Options.PowerOptions.Status,
      this.getEvent('power'));
  }

Should use ZM (Zone Main) instead of PW.

  /**
   * Sets the power mode of the Denon AVR. (On / Standby).
   * Use {PowerOptions}.
   *
   * @method setPower
   * @param {PowerOptions} powerOptions [The power option]
   * @return {Promise} [A response]
   */
  setPower(powerOptions) {

    return this.sendCommand('ZM', powerOptions,
      this.getEvent('power'));
  }

  /**
   * Returns the current power status of the Denon AVR.
   *
   * @method getPower
   * @return {Promise} [A response]
   */
  getPower() {

    return this.sendCommand('ZM', Options.PowerOptions.Status,
      this.getEvent('power'));
  }

In all fairness, i think more functions would be needed here and these should be renamed.
For instance:
setPowerZone[main,one,two,...]
getPowerZone[main,one,two,...]

Which would keep everyone happy and be quite clear API wise.

Cheers,
Mark