@myrandow you can change the loop to something like this: void loop() { // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; static bool sentValue = false; if(tripped != sentValue){ // The state of the motion sensor has changed Serial.println(tripped); sentValue=tripped; send(msg.set(sentValue?"1":"0")); // Send tripped value to gw } } If you want the sensor to send updates every 2 minutes even if the state has not changed, you'll need to add some additional logic.