Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoduj committed Aug 16, 2019
1 parent 17f3321 commit 8499d88
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 1.0.4

- [FIX] #33 Status is not correct until refresh timer if door operated outside app

## 1.0.3

- [FIX] #32 Operation timer is canceled before all operations completed if more than one dorr is operated simultaneously
Expand Down
8 changes: 1 addition & 7 deletions gogogateAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,7 @@ GogogateAPI.prototype = {
});
},

refreshDoor: function(
myGogogateAccessory,
service,
callback,
characteristic
) {
refreshDoor: function(service, callback, characteristic) {
var that = this;

let infoURL =
Expand Down Expand Up @@ -218,7 +213,6 @@ GogogateAPI.prototype = {
} else {
that.platform.handleRefreshDoor(
statusbody,
myGogogateAccessory,
service,
callback,
characteristic
Expand Down
21 changes: 11 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Gogogate2Platform.prototype = {
let service = myGogogateAccessory.services[s];
if (service.UUID == Service.GarageDoorOpener.UUID) {
this.log.debug('INFO - refreshAllDoors - Door : ' + service.subtype);
this.gogogateAPI.refreshDoor(myGogogateAccessory, service);
this.gogogateAPI.refreshDoor(service);
} else if (service.UUID == Service.TemperatureSensor.UUID) {
this.log.debug('INFO - refreshAllDoors - Temp : ' + service.subtype);
this.gogogateAPI.refreshSensor(
Expand Down Expand Up @@ -335,13 +335,7 @@ Gogogate2Platform.prototype = {
return false;
},

handleRefreshDoor(
statusbody,
myGogogateAccessory,
service,
callback,
characteristic
) {
handleRefreshDoor(statusbody, service, callback, characteristic) {
let currentDoorState =
statusbody == 'OK'
? Characteristic.CurrentDoorState.OPEN
Expand Down Expand Up @@ -404,6 +398,15 @@ Gogogate2Platform.prototype = {
this.gogogateAPI.getStateString(newDoorState)
);
callback(undefined, newDoorState);

//No operation in progress, ensure that target state is in sync if status has changed.
if (!operationInProgress) {
setImmediate(() => {
service
.getCharacteristic(Characteristic.TargetDoorState)
.updateValue(newTargetState);
});
}
} else if (characteristic == Characteristic.TargetDoorState) {
this.log.debug(
'INFO - refreshDoor - ' +
Expand Down Expand Up @@ -490,7 +493,6 @@ Gogogate2Platform.prototype = {
);

homebridgeAccessory.platform.gogogateAPI.refreshDoor(
homebridgeAccessory,
service,
callback,
Characteristic.CurrentDoorState
Expand Down Expand Up @@ -520,7 +522,6 @@ Gogogate2Platform.prototype = {
);

homebridgeAccessory.platform.gogogateAPI.refreshDoor(
homebridgeAccessory,
service,
callback,
Characteristic.TargetDoorState
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-gogogate2",
"version": "1.0.3",
"version": "1.0.4",
"author": "Nicolas Dujardin",
"description": "Publish your gogogate 2 to homebridge",
"main": "index.js",
Expand Down

0 comments on commit 8499d88

Please sign in to comment.