limitExceed(params: any) {
params.forEach((data: any) => {
if (data.humidity === 100) {
this.createNotification('warning', data.sensor, false);
} else if (data.humidity >= 67 && data.humidity <= 99.99) {
this.createNotification('warning', data.sensor, true);
}
});
}
createNotification(type: string, title: string, types: boolean): void {
this.notification.config({
nzPlacement: 'bottomRight',
nzDuration: 5000,
});
if (types) {
this.notification.create(
type,
title,
'Humidity reached the minimum limit'
);
} else {
this.notification.create(
type,
title,
'Humidity reached the maximum'
);
}
}
how to make it trigger/alert every 5 minutes. but first it will alert then after the first alert/trigger it will alert/trigger again every 5 minutes.
cause I already set the setInterval like this.
setInterval(() => {
if (types) {
this.notification.create(
type,
title,
'Humidity reached the minimum limit'
);
} else {
this.notification.create(
type,
title,
'Humidity reached the maximum'
);
}
}, 300000);
but it didn't alert/trigger first.