setInterval(function () { if (counter === 3) { counter = 0; if (CONFIG.CI_CCTRACKER_URL === SUCCESS_URL) { CONFIG.CI_CCTRACKER_URL = ERROR_URL; } else { CONFIG.CI_CCTRACKER_URL = SUCCESS_URL; } } else { counter += 1; } request.get(CONFIG.CI_CCTRACKER_URL, function (error, response, body) { if (error) { console.log("Something is wrong with your CI =("); return; } if (body.indexOf("Success") !== -1) { console.log("Your CI is ok!"); self.ledSuccess.on(); self.ledError.off(); } else { console.log("Something is wrong with your CI =(. Fix it!!!!"); self.ledSuccess.off(); self.ledError.on(); } }); }, CONFIG.INTERVAL)