From 7303cb359c7b8b3e1660d5f756cb1d5097dca5ab Mon Sep 17 00:00:00 2001 From: Peter Murray Date: Sun, 8 Feb 2015 17:10:29 +0000 Subject: [PATCH] - Fixes #46, the scene parameter was not being passed through to the bridge when activating a scene --- Changelog.md | 3 +++ hue-api/lightstate.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Changelog.md b/Changelog.md index 3ff5ce2..32c831f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Change Log +## 1.0.5 +- Fixes issue #46 scene id was missing from body sent to the bridge for activation requests + ## 1.0.4 - Fixes issue #45 creating a scene resulted in a NaN id for the scene created diff --git a/hue-api/lightstate.js b/hue-api/lightstate.js index 4a58b38..ad3bfdb 100644 --- a/hue-api/lightstate.js +++ b/hue-api/lightstate.js @@ -179,6 +179,11 @@ State.prototype.transitiontime = function (value) { return this; }; +State.prototype.scene = function (value) { + this._addValues(_getSceneId(value)); + return this; +} + /////////////////////////////////////////////////////////////////////// // Convenience functions @@ -414,6 +419,15 @@ function _getTransitionState(value) { }; } +function _getSceneId(value) { + var result = {}; + + if (value) { + result.scene = value; + } + return result; +} + function _getWhiteState(colorTemp, brightness) { return utils.combine( _getCtState(colorTemp),