Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-serialport-to-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
siburny committed Aug 22, 2017
2 parents 4cfb2a9 + 8c6276d commit e528fae
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 18 deletions.
4 changes: 3 additions & 1 deletion Readme.md
Expand Up @@ -96,9 +96,11 @@ hub.connect(process.env.HUB_IP, function () {
API
---

**0.8.0 Update Highlights:** *Not released - use master branch*
**0.8.0 Update Highlights:**
- **BREAKING CHANGES**
* By default, events are not emitted for commands you call. You can restore the previous functionality by setting `insteon.emitSelfAck = true`.
- Updated dependencies
- Improved testing and code

**0.7.0 Update Highlights:**

Expand Down
9 changes: 9 additions & 0 deletions lib/Insteon/index.js
Expand Up @@ -1913,46 +1913,55 @@ Insteon.prototype.idRequest = function (id, next) {
* Lighting Functions (deprecated)
**************************************************************************/

/* istanbul ignore next */
Insteon.prototype.turnOn = function (id, level, rate, next) {
console.trace('Insteon.trunOn(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).turnOn(...).');
return this.light(id).turnOn(level, rate, next);
};

/* istanbul ignore next */
Insteon.prototype.turnOnFast = function (id, next) {
console.trace('Insteon.turnOnFast(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).turnOnFast(...).');
return this.light(id).turnOnFast(next);
};

/* istanbul ignore next */
Insteon.prototype.turnOff = function (id, rate, next) {
console.trace('Insteon.turnOff(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).turnOff(...).');
return this.light(id).turnOff(rate, next);
};

/* istanbul ignore next */
Insteon.prototype.turnOffFast = function (id, next) {
console.trace('Insteon.turnOffFast(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).turnOffFast(...).');
return this.light(id).turnOffFast(next);
};

/* istanbul ignore next */
Insteon.prototype.brighten = function (id, next) {
console.trace('Insteon.brighten(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).brighten(...).');
return this.light(id).brighten(next);
};

/* istanbul ignore next */
Insteon.prototype.dim = function (id, next) {
console.trace('Insteon.dim(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).dim(...).');
return this.light(id).dim(next);
};

/* istanbul ignore next */
Insteon.prototype.level = function (id, level, next) {
console.trace('Insteon.level(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).level(...).');
return this.light(id).level(level, next);
};

/* istanbul ignore next */
Insteon.prototype.rampRate = function (id, btn, rate, next) {
console.trace('Insteon.rampRate(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).rampRate(...).');
return this.light(id).rampRate(btn, rate, next);
};

/* istanbul ignore next */
Insteon.prototype.onLevel = function (id, btn, level, next) {
console.trace('Insteon.onLevel(id, ...) is deprecated and will be removed in v1.0. Use Insteon.light(id).onLevel(...).');
return this.light(id).onLevel(btn, level, next);
Expand Down
12 changes: 6 additions & 6 deletions package.json
@@ -1,5 +1,5 @@
{
"version": "0.7.0",
"version": "0.8.0",
"author": "Brandon Goode <brandon@automategreen.com>",
"name": "home-controller",
"description": "A Node Home Automation Controller for Insteon Devices",
Expand All @@ -21,13 +21,13 @@
"node": ">= 0.10"
},
"dependencies": {
"commander": "^2.7.0",
"debug": "^2.1.0",
"eventsource": "^0.1.0",
"q": "^1.4.1"
"commander": "^2.11.0",
"debug": "^2.6.8",
"eventsource": "^1.0.5",
"q": "^1.5.0"
},
"optionalDependencies": {
"serialport": "^5.x",
"serialport": "^5.0.0",
"spark": "^1.0.0"
},
"devDependencies": {
Expand Down
105 changes: 94 additions & 11 deletions test/Insteon.js
Expand Up @@ -313,7 +313,7 @@ describe('Insteon Gateway (IP Interface)', function () {
(function cancelPending() {
gw.cancelPending('gggggg');
}).should.throw('Invalid Insteon ID');
(function() {
(function () {
gw.cancelPending(999999);
}).should.throw('Invalid cmdMatch');
done();
Expand Down Expand Up @@ -1492,16 +1492,60 @@ describe('Insteon Gateway (IP Interface)', function () {
}); // Light Commands

it('get the device info', function (done) {
this.slow(4000);

var gw = new Insteon();
gw.commandTimeout = 1000;
var plan = new Plan(6, done);

mockData = {
'02622926380f1000':
[
'02622926380f100006',
'02502926381eb5522f1000',
'0250292638050b0d8f01350250292638050b0d8f0135'
]
};
mockData = [
{ // thermostat
'02622926380f1000':
[
'02622926380f100006',
'02502926381eb5522f1000',
'0250292638050b0d8f0135'
]
},
{ // dimmer switch
'02621122330f1000':
[
'02621122330f100006',
'02501122339999992b1000',
'02501122330120458b0178'
],
},
{ // on/off switch
'02621122440f1000':
[
'02621122440f100006',
'02501122449999992b1000',
'02501122440220458b0178'
]
},
{ // missing full response
'02621122550f1000':
[
'02621122550f100006'
]
},
{ // missing broadcast message
'02621122660f1000':
[
'02621122660f100006',
'02501122669999992b1000',
'02501122660220452b0178'
]
},
{ // unknown device
'02621122770f1000':
[
'02621122770f100006',
'02501122779999992b1000',
'02501122772220458b0178'
]
}
];

gw.connect(host, function () {
gw.info('292638', function (err, profile) {
Expand All @@ -1511,11 +1555,50 @@ describe('Insteon Gateway (IP Interface)', function () {
profile.firmware.should.eql('0d');
profile.deviceCategory.id.should.eql(5);
profile.deviceSubcategory.id.should.eql(11);
profile.isDimmable.should.be.false;
profile.isLighting.should.be.false;
profile.isDimmable.should.be.false;
profile.isThermostat.should.be.true;
done();
plan.ok();
});

gw.info('112233').then(function (profile) {
should.exist(profile);
profile.id.should.eql('112233');
profile.firmware.should.eql('45');
profile.deviceCategory.id.should.eql(1);
profile.deviceSubcategory.id.should.eql(32);
profile.isLighting.should.be.true;
profile.isDimmable.should.be.true;
profile.isThermostat.should.be.false;
plan.ok();
}).catch(done);

gw.info('112244').then(function (profile) {
should.exist(profile);
profile.id.should.eql('112244');
profile.firmware.should.eql('45');
profile.deviceCategory.id.should.eql(2);
profile.deviceSubcategory.id.should.eql(32);
profile.isLighting.should.be.true;
profile.isDimmable.should.be.false;
profile.isThermostat.should.be.false;
plan.ok();
}).catch(done);

gw.info('112255').then(function (profile) {
should.not.exist(profile);
plan.ok();
}).catch(done);

gw.info('112266').then(function (profile) {
should.not.exist(profile);
plan.ok();
}).catch(done);

gw.info('112277').then(function (profile) {
should.exist(profile);
plan.ok();
}).catch(done);
});
});

Expand Down

0 comments on commit e528fae

Please sign in to comment.