   runTimerDoLightOff();
 
   pirValue = digitalRead(pir);
+  if ( oldpirValue != pirValue ) {
+    pirSent = HIGH;
+    oldpirValue = pirValue;
+  }
 
   payload = "{\"Humidity\":";
   payload += h;

IPAddress time_server = MQTT_SERVER;

// pin
#define pir 13
#define DHTPIN 14
#define RELAYPIN 4
#define TOPBUTTONPIN 5

// DHT22
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE, 15);

// OTHER
#define REPORT_INTERVAL 9500 // in msec

#define BETWEEN_RELAY_ACTIVE 5000

// DS18B20
//#define ONE_WIRE_BUS 12
#define ONE_WIRE_BUS 0
#define TEMPERATURE_PRECISION 12

OneWire oneWire(ONE_WIRE_BUS);
