   if(! GOT_ANALOG_SENSOR) {
     (*a) = 0.0;
   } else if(analogSensor == "analog_mains") {
-    (*a) = 1.0;
+    (*a) = (float) emon1.calcIrms(1480);
   } else if(analogSensor == "analog_pressure") {
     int analogValue = analogRead(A0);
 

#include <Adafruit_TSL2591.h>
#include <RCSwitch.h>
#include "Adafruit_MCP23008.h"

/////////////////////////////////////////////////////////////////////////////
// resource management stuff ////////////////////////////////////////////////

    // tsl.setTiming(TSL2591_INTEGRATIONTIME_600MS); // longest (dim)
  }
  
  Wire.beginTransmission(pH_Add);
  error = Wire.endTransmission();
  if(error==0){
    GOT_PH_SENSOR = true;
    dln(monitorDBG, "Found pH sensor");
  }

  if(GOT_ANALOG_SENSOR && analogSensor == "analog_mains") {
    emon1.current(A0, 111.1); // current: input pin, calibration
  }
}

