Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
Fixing contact sensor.
Browse files Browse the repository at this point in the history
  • Loading branch information
bassrock committed Sep 2, 2018
1 parent 5831eb0 commit be3bd25
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/devices/sensor_pod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ const { batteryService } = require("./_shared");
const isLeakSensor = (state, device, config) =>
config.leak_ids.indexOf(device.object_id) !== -1;

const isNotLeakSensor = (state, device, config) =>
config.leak_ids.indexOf(device.object_id) === -1;
const isContactSensor = (state, device, config) =>
config.leak_ids.indexOf(device.object_id) === -1 &&
state.opened !== undefined;

module.exports = ({ Characteristic, Service }) => {
const {
Expand Down Expand Up @@ -99,7 +100,7 @@ module.exports = ({ Characteristic, Service }) => {
},
{
service: Service.ContactSensor,
supported: isNotLeakSensor,
supported: isContactSensor,
characteristics: [
{
characteristic: ContactSensorState,
Expand Down

0 comments on commit be3bd25

Please sign in to comment.