Skip to content

Commit

Permalink
fix(magnet): updateContact from abstract-thing takes true when the ma…
Browse files Browse the repository at this point in the history
…gnet is close and false if open

Related to aholstenson#101
  • Loading branch information
Pierre CLEMENT committed Jan 25, 2018
1 parent 1ff4a41 commit 99d88ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/devices/gateway/magnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ module.exports = class Magnet extends SubDevice.with(Contact, Voltage) {
}

propertyUpdated(key, value, oldValue) {
console.log(key, value, oldValue);
if(key === 'status') {
// Change the contact state
const isOpen = value === 'open';
this.updateContact(isOpen);
const isContact = value === 'close';
this.updateContact(isContact);
}

super.propertyUpdated(key, value, oldValue);
Expand Down

0 comments on commit 99d88ff

Please sign in to comment.