Skip to content

Commit

Permalink
KraigM#131 Reverse toggling order during activity transition
Browse files Browse the repository at this point in the history
  • Loading branch information
huebs committed Apr 7, 2018
1 parent ae7c2e0 commit 731a4bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/activity-accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ ActivityAccessory.prototype._updateActivities = function(list) {
ActivityAccessory.prototype._updateActivityState = function (currentActivity) {
if (currentActivity == null) currentActivity = this._currentActivity;
else this._currentActivity = currentActivity;
_.forEach(this._getActivityServices(), function(service){
var val = getServiceActivityId(service) == currentActivity;
service.getCharacteristic(Characteristic.On).setValue(val, null, true);
var currentService = null;
_.forEach(this._getActivityServices(), function (service) {
if (getServiceActivityId(service) == currentActivity) currentService = service;
else service.getCharacteristic(Characteristic.On).setValue(false, null, true);
});
if (currentService) currentService.getCharacteristic(Characteristic.On).setValue(true, null, true);
};

ActivityAccessory.prototype.refreshActivityAsync = function() {
Expand Down

0 comments on commit 731a4bf

Please sign in to comment.