Particle.Function () losing its value

Update. Adding resisters from each sensor to ground has helped the problem too. Even with the code above, I was getting two notifications. I put a 10ohm resister to ground on each sensor. Semi-related to another problem I had. Garage Door Detector Problem