From 99b99ab341194bfd2293620e0d542b5a733a8e4e Mon Sep 17 00:00:00 2001 From: lone-cloud Date: Sun, 25 Oct 2015 23:49:56 -0700 Subject: [PATCH] turn light on, on beat --- app/pods/components/music-tab/component.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js index 8af0a03..d2ee64a 100644 --- a/app/pods/components/music-tab/component.js +++ b/app/pods/components/music-tab/component.js @@ -563,16 +563,20 @@ export default Em.Component.extend(helperMixin, visualizerMixin, { var activeLights = this.get('activeLights'), transitionTime = this.get('transitionTime') * 10, onBeatBriAndColor = this.get('onBeatBriAndColor'), - self = this, + lightsData = this.get('lightsData'), color = null, - stimulateLight = function (light, brightness, hue) { + stimulateLight = (light, brightness, hue) => { var options = {'bri': brightness, 'transitiontime': transitionTime}; if(!Em.isNone(hue)) { options.hue = hue; } - Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', { + if(lightsData[light].state.on === false){ + options.on = true; + } + + Em.$.ajax(this.get('apiURL') + '/lights/' + light + '/state', { data: JSON.stringify(options), contentType: 'application/json', type: 'PUT'