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'
);
}
}
как заставить его срабатывать / предупреждать каждые 5 минут. но сначала он выдаст сигнал тревоги, затем после первого оповещения / триггера будет срабатывать снова / снова каждые 5 минут.
, потому что я уже установил setInterval
следующим образом.
setInterval(() => {
if (types) {
this.notification.create(
type,
title,
'Humidity reached the minimum limit'
);
} else {
this.notification.create(
type,
title,
'Humidity reached the maximum'
);
}
}, 300000);
, но это не предупредил / не сработал первым.