nodeserver/src/common/controller/sub-modules/RulesEngine.js
/* Rule information:
    Cluster, Attribute -> Match for which attributes we are tracking
    sourceEndpoint -> Match for source
    Type -> Identifies which bits to forward and what action to take
    destEndpoint -> Where to send command to
  */
Rule information:
Cluster, Attribute -> Match for which attributes we are tracking
sourceEndpoint -> Match for source
Type -> Identifies which bits to forward and what action to take
destEndpoint -> Where to send command to
Rule information : Cluster Attribute - > Match for which attributes we are tracking sourceEndpoint - > Match for source Type - > Identifies which bits to forward and what action to take destEndpoint - > Where to send command to
addRule(attribute, inDeviceInfo, outDeviceInfo, ruleType) {
    var inDeviceEndpoint = inDeviceInfo.deviceEndpoint;
    var outDeviceEndpoint = outDeviceInfo.deviceEndpoint;
    var ruleID = this.createRuleHash(inDeviceInfo.deviceEndpoint.clusterId,
                                      attribute,
                                      inDeviceEndpoint);
    if (!this.rules[ruleID]) {
      this.rules[ruleID] = [];
    }
    this.rules[ruleID].push({ inDeviceEndpoint, outDeviceEndpoint, ruleType });
    Logger.server.log('info',
                      'Rule added: ',
                      inDeviceInfo.deviceEndpoint.clusterId,
                      attribute,
                      inDeviceEndpoint,
                      ruleType,
                      outDeviceEndpoint,
                      ruleID);
    fs.writeFileSync(rulesStorePath, JSON.stringify(this.rules));
  }
addRule ( attribute , inDeviceInfo , outDeviceInfo , ruleType ) { var inDeviceEndpoint = inDeviceInfo . deviceEndpoint ; var outDeviceEndpoint = outDeviceInfo . deviceEndpoint ; var ruleID = this . createRuleHash ( inDeviceInfo . deviceEndpoint . clusterId , attribute , inDeviceEndpoint ) ; if ( ! this . rules [ ruleID ] ) { this . rules [ ruleID ] = [ ] ; } this . rules [ ruleID ] . push ( { inDeviceEndpoint , outDeviceEndpoint , ruleType } ) ; Logger . server . log ( 'info' , 'Rule added: ' , inDeviceInfo . deviceEndpoint . clusterId , attribute , inDeviceEndpoint , ruleType , outDeviceEndpoint , ruleID ) ; fs . writeFileSync ( rulesStorePath , JSON . stringify ( this . rules ) ) ; }
Rule information:
Cluster, Attribute -> Match for which attributes we are tracking
sourceEndpoint -> Match for source
Type -> Identifies which bits to forward and what action to take
destEndpoint -> Where to send command to
Rule information : Cluster Attribute - > Match for which attributes we are tracking sourceEndpoint - > Match for source Type - > Identifies which bits to forward and what action to take destEndpoint - > Where to send command to