turn light on, on beat
This commit is contained in:
parent
f4c8d8f8a9
commit
8e4ff7aa0e
1 changed files with 7 additions and 3 deletions
|
|
@ -563,16 +563,20 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
|
||||||
var activeLights = this.get('activeLights'),
|
var activeLights = this.get('activeLights'),
|
||||||
transitionTime = this.get('transitionTime') * 10,
|
transitionTime = this.get('transitionTime') * 10,
|
||||||
onBeatBriAndColor = this.get('onBeatBriAndColor'),
|
onBeatBriAndColor = this.get('onBeatBriAndColor'),
|
||||||
self = this,
|
lightsData = this.get('lightsData'),
|
||||||
color = null,
|
color = null,
|
||||||
stimulateLight = function (light, brightness, hue) {
|
stimulateLight = (light, brightness, hue) => {
|
||||||
var options = {'bri': brightness, 'transitiontime': transitionTime};
|
var options = {'bri': brightness, 'transitiontime': transitionTime};
|
||||||
|
|
||||||
if(!Em.isNone(hue)) {
|
if(!Em.isNone(hue)) {
|
||||||
options.hue = 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),
|
data: JSON.stringify(options),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'PUT'
|
type: 'PUT'
|
||||||
|
|
|
||||||
Reference in a new issue