     // tsl.setTiming(TSL2591_INTEGRATIONTIME_600MS); // longest (dim)
   }
   
-  //Wire.begin();
   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
   }
 }
 

  if(! GOT_ANALOG_SENSOR) {
    (*a) = 0.0;
  } else if(analogSensor == "analog_mains") {
    (*a) = 1.0;
  } else if(analogSensor == "analog_pressure") {
    int analogValue = analogRead(A0);


#include <Adafruit_TSL2591.h>
#include <RCSwitch.h>
#include "Adafruit_MCP23008.h"
#include "EmonLib.h" // Emon Library, see openenergymonitor.org

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