…ho aggiunto il codice sotto ad uno script mJs che legge i valori letti da 2 pinze amperometriche: mi vengono restituiti correttamente i risultati della potenza attiva utilizzata (sotto forma di numero), il problema è che quando cerco di sommare phaseA e phaseB il valore di totalPhase è uguale a 0. Sapete dirmi dove sbaglio?

codice:
let phaseA = null;
let phaseB = null;
let totalPhase = null;


function somma() {
  let x = null;
  let y = null;
  let s = x + y;
  return s;
}


function startMonitor() {
    Shelly.addStatusHandler(function(response, usr_data) {
      if(response != null) {
        if(response.name == "em1") {
          if(response.component == "em1:0") {
            phaseA = response.delta.act_power;
            print("Phase A: " + phaseA);
          } 
          if(response.component == "em1:1") {
            phaseB = response.delta.act_power;
            print("Phase B: " + phaseB);
          }
        }
      }
      if(phaseA != null && phaseB != null) {
        totalPhase = somma(phaseA, phaseB);
        print("Total: " + totalPhase);
      }
    })
}
startMonitor();