Skip to content

Commit

Permalink
Fixed default for update method and added water sensor.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdlove committed Jan 30, 2017
1 parent f348980 commit 3958e4d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ Example of all settings. Not all ssettings are required. Read the breakdown belo

## What's New

* 0.5.1
* [Plugin] Fixed default value to be correct for update_method.
* [Plugin] Added type detection for Water Sensor.


* 0.5.0
* Add support for PubNub and Direct updates. The legacy method using the API has been somewhat crippled in default settings.
* [Plugin] Moved switches up in the order so that they switches with temperature sensors on them still add as switches.
Expand Down
20 changes: 20 additions & 0 deletions accessories/smartthings.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ function SmartThingsAccessory(platform, device) {

}

// if (devices.capabilities["Valve"] !== undefined) {
// this.deviceGroup = "valve";
// Thinking of implementing this as a Door service.
// }

if (device.capabilities["Button"] !== undefined) {
this.deviceGroup = " button";

}
if (device.capabilities["Switch"] !== undefined && this.deviceGroup == "unknown") {
this.deviceGroup = "switch";
thisCharacteristic = this.getaddService(Service.Switch).getCharacteristic(Characteristic.On)
Expand Down Expand Up @@ -259,6 +268,17 @@ function SmartThingsAccessory(platform, device) {
that.platform.addAttributeUsage("motion", this.deviceid, thisCharacteristic);
}

if (device.capabilities["Water Sensor"] !== undefined) {
if (this.deviceGroup == 'unknown') this.deviceGroup = "sensor";

thisCharacteristic = this.getaddService(Service.LeakSensor).getCharacteristic(Characteristic.LeakDetected)
thisCharacteristic.on('get', function(callback) {
var reply = Characteristic.LeakDetected.LEAK_DETECTED;
if (that.device.attributes.water == "dry") reply = Characteristic.LeakDetected.LEAK_NOT_DETECTED;
callback(null, reply); });
that.platform.addAttributeUsage("water", this.deviceid, thisCharacteristic);
}

if (device.capabilities["Presence Sensor"] !== undefined) {
if (this.deviceGroup == 'unknown') this.deviceGroup = "sensor";

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function SmartThingsPlatform(log, config) {

//This is how often it polls for subscription data.
this.update_method = config["update_method"];
if (!this.update_method) this.update_method='api';
if (!this.update_method) this.update_method='direct';

this.update_seconds = config["update_seconds"];
if (!this.update_seconds) this.update_seconds = 30; //30 seconds is the new default
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-smartthings",
"description": "HomeBridge plugin for Smart Things",
"version": "0.4.7",
"version": "0.5.1",
"repository": {
"type": "git",
"url": "git://github.com/pdlove/homebridge-smartthings.git"
Expand Down

0 comments on commit 3958e4d

Please sign in to comment.