Nó-vermelho: interruptor de bit

var a= parseInt(msg.payload.value2);

var basis= flow.get('AggStatus')||'00000000000000000000000000000000';
var result;
var aktStatus;
var id=a; //Aggregat # (1basierend)
id=32-id;

  if(basis.charAt(id)==='1') {
     aktStatus='0';
  }else{
     aktStatus='1';  
}
result= basis.substring(0,id)+aktStatus+basis.substring(id+1);
flow.set('AggStatus',result);
msg.payload=result
digimax