Update to include tick thresholds to avoid spammy messages

This commit is contained in:
William Moore 2022-05-28 16:50:56 -05:00
parent f1562451cc
commit ea26bc54ed

View File

@ -39,8 +39,11 @@ async function temperatoTick() {
if (response.getSensorData.temperato >= SET_POINT) { if (response.getSensorData.temperato >= SET_POINT) {
numberOfTicks++; numberOfTicks++;
if (numberOfTicks == TICK_THRESHOLD) { if (numberOfTicks == TICK_THRESHOLD) {
numberOfTicks = 0; numberOfTicks = 0;
}
if (numberOfTicks == 0) {
const basicAuth = Buffer.from(`${USERNAME}:${PASSWORD}`).toString('base64'); const basicAuth = Buffer.from(`${USERNAME}:${PASSWORD}`).toString('base64');
await fetch(NOTIF_URL, { await fetch(NOTIF_URL, {
method: 'post', method: 'post',