   
   // Wenn die Zeit (worktime) kleiner als die Vergangene Zeit ist, Sende eine Nachricht.
   if ((unsigned long)(currmillis - task1) >= stime || (currmillis == 1000)) {
-    send_msg("Testnachricht_1");
-    compute_msg(temp_sensor_id(), get_temp(), hum_sensor_id(), get_hum());
+    Serial.println(F("check DHT22"));
+    //send_msg("Testnachricht_1");
+    compute_msg(get_temp(), get_hum());
     task1 = millis();
   }
 
   // checke die Luftfeuchtigkeit und wenn zu niedrig schalte Luefter ein.
   if ((unsigned long)(currmillis - task2) >= mtime) {
-    if ((float)(get_hum() <= 70.0)) {
+    Serial.println(F("check if hum"));
+    if ((float)(get_hum() <= 65.0 || get_hum() <= 75.0)) {
       // switch ventilator on
+      Serial.println(F("switch Ventilator on"));
       if (!fan1) {
         //oeffne Luefter schlitz
         int i = 1;
+        //bitSet(reg, i);
+        updateShiftRegister(i);
+        delay(60);
+        //switch fan1 on
+        i = 14;
         bitSet(reg, i);
-        updateShiftRegister();
-        delay(10);
-        //switch fan1 on
-        i = i + 1;
-        bitSet(reg, i);
-        updateShiftRegister();
+        updateShiftRegister(i);
         delay(60);
         fan1 = true;
       }
     } else {
       if (fan1) {
+        Serial.println(F("Switch Ventilator off"));
         // switch fan1 off und schliesse den Schlitz
         reg = 0;
-        updateShiftRegister();
+        updateShiftRegister(0);
         delay(60);
         fan1 = false;
       }

  // Read humidity
  sensors_event_t event;  
  dht.humidity().getEvent(&event);
  return event.relative_humidity;
}

void compute_msg(char temp_uuid, float temp, char hum_uuid, float hum){
  /*
   * compute message for sending data
   * dtostrf(FLOAT,WIDTH,PRECSISION,BUFFER);
   */
   char str;
   str += temp_uuid;
   str += dtostrf(temp,5,2,7);
   str += hum_uuid;
   str += dtostrf(hum,5,2,7);
   //Serial.println(str);
   send_msg(str);
}

void send_msg(char message) {
  /*
   * Sending data over 433MHz Sender
   */
  const char *msg = message; // this is your message to send
  vw_send((uint8_t *)msg, strlen(msg));
  vw_wait_tx(); // Wait for message to finish


//Pausen zwischen den Messungen in Millisekunden
unsigned long stime = 10000;
unsigned long mtime = 10000;

// boolean felder
boolean fan1 = false;

void setup() {
  Serial.begin(115200);
  // Initialise the IO and ISR
  vw_set_ptt_inverted(true); // Required for RF Link module
  vw_setup(1200); // Bits per sec
