  */
 String gethostname(bool cache) {
   static String mac = "";
-  if (mac.length() && cache) {
-     return mac;
-  }
-  String pattern = "STAMAC,\"";
-  String answer = wifi.getip().c_str();
-  int starti = answer.indexOf(pattern) + pattern.length();
-  mac = answer.substring(starti, answer.length() -1);  
-  int stopi = mac.indexOf("\"");
-  mac = String("wino-") + mac.substring(0,stopi);
-  mac.replace(":", "");
+  if (!(mac.length() && cache)) {
+    mac = String("wino-") + wifi.getmac();
+    mac.replace(":", "");
+  }
   return mac;
 }
 /*

void sensor_setup(void) {
  pinMode(powerPin, OUTPUT);  // Sensor Power
  pinMode(ledPin, OUTPUT);  // LED when measuring
}
  


void loop() {
  SerialUSB.print("loops (minutes) since restart: ");
  SerialUSB.println(loopcnt);
    
  loopcnt++;
  if ((loopcnt % 5) == 0) lg_heartbeat(); // every 5 loops
  if ((loopcnt % 5) == 0) lg_sensor(soil_measure());    // every 5 minutes
  blinkLed(200);

  delay(60000); // one loop per minute 
}

/* get local IP address. The wifi library gives a strig result like this: 
 *  
 *  +CIFSR:APIP,"xxx.xxx.xxx.xxx"
 *  +CIFSR:APMAC,"xx:xx:xx:xx:xx:xx"
 *  +CIFSR:STAIP,"xxx.xxx.xxx.xxx"
 *  +CIFSR:STAMAC,"xx:xx:xx:xx:xx:xx"
 * 
 * we need to cut out the value from the STAIP line (Station IP)
 *
 */

String getIP(bool cache) {
  static String ip = "";

    + "Content-Length: " + payload.length() + "\r\n"
    + "\r\n"
    + payload + "\r\n";
  http_post(request);
 }
 
 void lg_sensor(int val) {
