   // remote on / off, tv remote on / off
   decode_results results;
 
+  long onofftimediff = (millis() - tv_onoff_Mills ) / 1000 / 60 ;
+
+
+  // PIR
+  if ( pirOnOff != o_pirOnOff && timerOnOff == 0) {
+    if (pirOnOff == 1) {
+      Serial.println("PIR rising called");
+      o_pirOnOff = pirOnOff;
+
+      lcd.setCursor(15, 0);
+      lcd.write(6);
+
+      turn_onoff_tv(1);
+      delay(100);
+    } else {
+      Serial.println("PIR timer called");
+      o_pirOnOff = pirOnOff;
+
+      lcd.setCursor(15, 0);
+      lcd.print(" ");
+
+      turn_onoff_tv(0);
+      delay(100);
+    }
+  }
+
+  // IR receive
   if (irrecv.decode(&results)) {
     changemodebyir(&results);
     irrecv.enableIRIn();
   }
 
+  // display Temperature
   if ((millis() - tempMills) >= 2000 ) {
     getdalastemp();
     displayTemperature();
     tempMills = millis();
 
+/*
     if (timerOnOff == 0) {
-      displaytimeleft(o_tvOnTime - ((millis() - tv_off_Mills) / 1000 / 60) );
+      displaytimeleft(o_tvOnTime - ((millis() - tv_onoff_Mills) / 1000 / 60) );
     } else {
       displaytimeleft(o_tvOffTime - ((millis() - tv_on_Mills) / 1000 / 60) );
     }
-    
+*/  
+    // display difference -60 mims Temperature 3600000   
     if ( (millis() - o_tempMills) >= 600000 ) {
       Serial.println("o_tempCinside called");
       o_tempCinside = c_tempCinside;

  startMills = millis();
  tempMills = millis();
  o_tempMills = millis();
  tv_off_Mills = millis();
  tv_on_Mills = millis();

  // lcd
  lcd.init();


// timer
long startMills;
long tv_onoff_Mills;
long tempMills;
long o_tempMills;

// temp
int o_tempminpassed = 0;
