Skip to content

Commit

Permalink
0.1.1 rc (#12)
Browse files Browse the repository at this point in the history
* update package.json

* fix(gatebox): currentPos as target door state
  • Loading branch information
Actardnes authored Dec 3, 2020
1 parent a251a9b commit 32c369f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
16 changes: 2 additions & 14 deletions blebox/gateBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GateBoxAccessoryWrapper extends AbstractBoxWrapper {
const service = this.getService(serviceNumber);
service.updateCharacteristic(this.currentDoorStateCharacteristic, this.getCurrentDoorStateValue());

service.updateCharacteristic(this.targetDoorStateCharacteristic, this.getTargetDoorStateValue());
service.updateCharacteristic(this.targetDoorStateCharacteristic, this.getCurrentDoorStateValue());
}
};

Expand All @@ -75,18 +75,6 @@ class GateBoxAccessoryWrapper extends AbstractBoxWrapper {
return state;
};

getTargetDoorStateValue() {
let state = this.targetDoorStateCharacteristic.OPEN;
const gate = this.getGate();
if (gate) {
const currentPosition = Number(gate.desiredPos) || 0;
if (currentPosition === 0) {
state = this.targetDoorStateCharacteristic.CLOSED;
}
}
return state;
};

onGetCurrentDoorState(callback) {
this.log("Getting 'current door' characteristic ...");
const gate = this.getGate();
Expand All @@ -104,7 +92,7 @@ class GateBoxAccessoryWrapper extends AbstractBoxWrapper {
this.log("Getting 'target door' characteristic ...");
const gate = this.getGate();
if (this.isResponding() && gate) {
const targetState = this.getTargetDoorStateValue();
const targetState = this.getCurrentDoorStateValue();
this.log("Current 'target door' characteristic is %s", targetState);
callback(null, targetState);
} else {
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-blebox",
"version": "0.1.0",
"version": "0.1.1",
"description": "BleBox plugin for homebridge: https://github.com/nfarina/homebridge",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 32c369f

Please sign in to comment.