Skip to content

Commit

Permalink
prepare option usage (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Jun 14, 2019
1 parent 1b8f6d8 commit da89f7f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions homematic-devices/hmipw-drs4.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,27 @@ class AccMultiService extends Accessory {
}

module.exports = class HmipwDrs {
option(id) {
return !(this.config.options[id] && this.config.options[id].disabled);
option(id, option) {
let addr = this.config.description.ADDRESS;
if (!addr.includes(':')) {
addr = addr + ':' + id;
}

let res;

if (option) {
res = this.config.options[addr] && this.config.options[addr][option];
} else {
res = !(this.config.options[addr] && this.config.options[addr].disabled);
}

this.node.debug('option ' + addr + ' ' + id + ' ' + option + ' ' + res);
return res;
}

constructor(config, node) {
const {ccu} = node;
this.node = node;
this.ccu = ccu;
this.config = config;
if (this.option(config.description.ADDRESS + ':SingleAccessory')) {
Expand Down

0 comments on commit da89f7f

Please sign in to comment.