nest-cli
Version:
Unofficial command-line tool to control Nest devices
22 lines (16 loc) • 442 B
JavaScript
;
function readThermostatId(cb) {
return function() {
var args = Array.prototype.slice.call(arguments);
var id = args[args.length - 2];
if (typeof id !== 'string' || !id) {
id = this.app.config.get('DEFAULT_THERMOSTAT');
}
if (!id) {
throw new Error('Device ID not specified');
}
args[args.length - 2] = id;
return cb.apply(this, args);
};
}
module.exports = readThermostatId;