diff --git a/app/pods/components/hue-controls/component.js b/app/pods/components/hue-controls/component.js index 46e1bd9..ed137c3 100644 --- a/app/pods/components/hue-controls/component.js +++ b/app/pods/components/hue-controls/component.js @@ -198,7 +198,8 @@ export default Em.Component.extend({ if(!this.get('trial')) { this.doUpdateGroupsData(); - this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 1000)); + this.updateLightData(); + this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 2000)); } if (!Em.isNone(this.get('storage').get('huegasm.selectedTab'))) { @@ -208,17 +209,14 @@ export default Em.Component.extend({ onUpdateGroupsDataChange: function(){ if(this.get('updateGroupsData')){ - var self = this; - setTimeout(function(){ self.doUpdateGroupsData(); }, 1000); + setTimeout(()=>{ this.doUpdateGroupsData(); }, 1000); } }.observes('updateGroupsData'), doUpdateGroupsData(){ - var self = this; - - Em.$.get(this.get('apiURL') + '/groups', function (result, status) { + Em.$.get(this.get('apiURL') + '/groups', (result, status)=>{ if (status === 'success' ) { - self.set('groupsData', result); + this.set('groupsData', result); } }); diff --git a/app/pods/components/light-group/component.js b/app/pods/components/light-group/component.js index 3a4f642..7fce746 100644 --- a/app/pods/components/light-group/component.js +++ b/app/pods/components/light-group/component.js @@ -10,7 +10,7 @@ export default Em.Component.extend({ actions: { clickLight(id, data){ - var light = Em.$(event.target); + var light = Em.$('.light'+id); if(!light.hasClass('bootstrapTooltip')){ light = light.parent(); @@ -68,7 +68,7 @@ export default Em.Component.extend({ if(!this.get('isHovering')){ var lightsData = this.get('lightsData'), lightsList = Em.A(), type; for (var key in lightsData) { - if (lightsData.hasOwnProperty(key)) { + if (lightsData.hasOwnProperty(key) && lightsData[key].state.reachable) { switch(lightsData[key].modelid){ case 'LCT001': type = 'a19'; @@ -114,8 +114,6 @@ export default Em.Component.extend({ if(!this.get('activeLights').contains(key)){ activeClass = 'lightInactive'; - } else if(!lightsData[key].state.reachable){ - activeClass = 'lightUnreachable'; } lightsList.push({type: type, name: lightsData[key].name, id: key, data: lightsData[key], activeClass: activeClass}); diff --git a/app/pods/components/light-group/template.hbs b/app/pods/components/light-group/template.hbs index d47c752..1a37454 100644 --- a/app/pods/components/light-group/template.hbs +++ b/app/pods/components/light-group/template.hbs @@ -1,5 +1,5 @@ {{#each lightsList as |light|}} -