From ea26bc54ed258dcf3e2c3a56f09ea4c64033cba4 Mon Sep 17 00:00:00 2001 From: William Moore Date: Sat, 28 May 2022 16:50:56 -0500 Subject: [PATCH] Update to include tick thresholds to avoid spammy messages --- src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d7dfbea..0a7990c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,8 +39,11 @@ async function temperatoTick() { if (response.getSensorData.temperato >= SET_POINT) { numberOfTicks++; - if (numberOfTicks == TICK_THRESHOLD) { - numberOfTicks = 0; + if (numberOfTicks == TICK_THRESHOLD) { + numberOfTicks = 0; + } + + if (numberOfTicks == 0) { const basicAuth = Buffer.from(`${USERNAME}:${PASSWORD}`).toString('base64'); await fetch(NOTIF_URL, { method: 'post',