Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98cef33

Browse files
committed
Clean up
1 parent b28b822 commit 98cef33

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ cmdSwitchPlatform.prototype.setPowerState = function (thisSwitch, state, callbac
188188

189189
// Restore switch after 1s if only one command exists
190190
if (!notCmd && !thisSwitch.state_cmd) {
191-
setTimeout(function (thisSwitch, state) {
192-
this.accessories[thisSwitch.name].getService(Service.Switch)
191+
setTimeout(function () {
192+
self.accessories[thisSwitch.name].getService(Service.Switch)
193193
.setCharacteristic(Characteristic.On, !state);
194-
}.bind(self, thisSwitch, state), 1000);
194+
}, 1000);
195195
}
196196

197197
if (tout) {
@@ -205,7 +205,7 @@ cmdSwitchPlatform.prototype.setPowerState = function (thisSwitch, state, callbac
205205
tout = null;
206206
thisSwitch.log("Turning " + (state ? "on" : "off") + " took too long, assuming success." );
207207
callback();
208-
}.bind(this, thisSwitch, state), 1000);
208+
}, 1000);
209209
} else {
210210
thisSwitch.log("Turned " + (state ? "on" : "off"));
211211
thisSwitch.state = state;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "homebridge-cmdswitch2",
3-
"version": "0.1.14",
3+
"version": "0.1.15",
44
"description": "CMD plugin for HomeBridge (API 2.0): https://github.com/nfarina/homebridge",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)