   }
 
   // now we trigger MOSFETs off or on
-  Serial.print("Growbed Valve Air Pump ");
-  Serial.print(pumpNum);
-  if(newState == true){
-    mcp.digitalWrite(mcpPin, HIGH);
-    Serial.println(" on");
-  } else {
-    mcp.digitalWrite(mcpPin, LOW);
-    Serial.println(" off");
-  }
+  swapPumpState(pumpNum, newState, mcpPin);
 
   toSend += "<h2>Water Pump ";
   toSend += pumpNum;


/////////////////////////////////////////////////////////////////////////////
// misc utils ///////////////////////////////////////////////////////////////
void ledOn() { digitalWrite(BUILTIN_LED, LOW); }
void ledOff() { digitalWrite(BUILTIN_LED, HIGH); }
void blink(int times) {
  ledOff();

    buf->concat(", \"pH\": ");
    buf->concat(m->pH);
  }
  // TODO add water levels
  buf->concat(" }");
}
void getTemperature(float* waterCelsius) {
