       break;
     case VACUUM:
       if (millis() - laststatechange > VACUUM_TO) {
-        send("vacuumoff");
+        send("event vacuumoff");
         machinestate = ENERGIZED;
       };
-      vacuum = 1;
+      relayenergized = 1; vacuum = 1;
       break;
     case RUNNING:
       red = LED_ON; green = LED_OFF;
       relayenergized = 1; vacuum = 1;
       break;
   };
+
   digitalWrite(PIN_POWER, relayenergized);
   digitalWrite(PIN_VACUUM, vacuum);
 
   if (laststate != machinestate) {
+#if DEBUG5
+    Serial.print("State: ");
+    Serial.print(laststate);
+    Serial.print(" -->");
+    Serial.print(machinestate);
+    Serial.print(" O="); Serial.print(overload);
+    Serial.print(" 1="); Serial.print(v1);
+    Serial.print(" 2="); Serial.print(v2);
+    Serial.print(" red="); Serial.print(red);
+    Serial.print(" green="); Serial.print(green);
+    Serial.print(" P="); Serial.print(relayenergized);
+    Serial.print(" V="); Serial.print(vacuum);
+    Serial.println();
+#endif
     laststate = machinestate;
     laststatechange = millis();
   }
 }
 
-void checkTagReader() {
+int checkTagReader() {
   MFRC522::Uid uid = { 0, 0, 0 };
+
+#if 0
   static unsigned long test = 0;
   if (millis() - test > 15000) {
     uid = { 4, { 1, 2, 3, 4}, 0 };
     test = millis();
   }
-#if 0
+#endif
+
   // Look for new cards
   if ( ! mfrc522.PICC_IsNewCardPresent()) {
-    return;
+    return 0;
   }
 
   // Select one of the cards
   if ( ! mfrc522.PICC_ReadCardSerial()) {
-    return;
-  }
+    return 0;
+  }
+
   uid = mfrc522.uid;
   // Dump debug info about the card; PICC_HaltA() is automatically called
   // mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
-#endif
 
   if (uid.size) {
-
     lasttag[0] = 0;
     for (int i = 0; i < uid.size; i++) {
       char buff[5];
-      snprintf(buff, sizeof(buff), " % s % d", i ? " - " : "", uid.uidByte[i]);
+      snprintf(buff, sizeof(buff), "%s%d", i ? "-" : "", uid.uidByte[i]);
       strcat(lasttag, buff);
     }
     lasttagbeat = beatCounter;



void handleMachineState() {
  unsigned int v1 = 0, v2 = 0;
  // Discharge the capacitors first.
  //
  pinMode(PIN_OPTO1, OUTPUT); pinMode(PIN_OPTO2, OUTPUT);
  digitalWrite(PIN_OPTO1, 0);  digitalWrite(PIN_OPTO2, 0);
  delay(1);
  pinMode(PIN_OPTO1, INPUT); pinMode(PIN_OPTO2, INPUT);

  // We meet for a bit - as to ensure we have had at least most of a full 50Hz cycle.
  for (int j = 0; j < 7; j++) {
    delay(3);
    v1 += digitalRead(PIN_OPTO1);
    v2 += digitalRead(PIN_OPTO2);
  };

  // The overload pin is shared with the LED; so do the
  // measurement quickly - and then restore the LEDs.
  pinMode(PIN_OVERLOAD, INPUT);
  delay(1);
  int overload = !digitalRead(PIN_OVERLOAD);
  restoreLeds();

  int r = 0;

    return;
  };
  char * p = (char *)payload;

#define SEP(tok, err) tok = strsepspace(&p); if (!tok) { Log.println(err); return; }

