Skip to content

Commit

Permalink
allow multiple keypresses to work in homekit
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed May 20, 2019
1 parent 0234ebd commit 201ef41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Expand Up @@ -113,16 +113,16 @@ TagAccessory.prototype.identify = function(callback) {

TagAccessory.prototype.onKeyPress = function() {
var characteristic = this.service.getCharacteristic(Characteristic.ProgrammableSwitchEvent);
this.presses += 1;
if (this.presses <3) {
this.presses += 1;
}

if (this.presses > 3) {
this.presses = 3
}
this.log(`got press ${this.presses}`)

clearTimeout(this.timeout)

this.timeout = setTimeout(() => {
characteristic.setValue(this.presses);
this.presses = -1
}, 250)
}, 500)
};

0 comments on commit 201ef41

Please sign in to comment.