From a42730128b35a56b7cd2f1bb1db899dd9b6fea73 Mon Sep 17 00:00:00 2001 From: Dawid Kubicki Date: Sat, 19 Jan 2019 13:26:35 +0100 Subject: [PATCH] waiting for status change --- src/app/status-list/status-list.component.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/status-list/status-list.component.ts b/src/app/status-list/status-list.component.ts index d921be3..c3cbb8d 100644 --- a/src/app/status-list/status-list.component.ts +++ b/src/app/status-list/status-list.component.ts @@ -53,12 +53,18 @@ export class StatusListComponent implements OnInit { } else { newStatus = status.splice(0, i); } - const first = new Date(newStatus[0].time).getTime(); - const last = new Date(newStatus[newStatus.length - 1].time).getTime(); + const first = Date.now(); //new Date(newStatus[0].time).getTime(); + const last = new Date(newStatus[0].time).getTime(); //new Date(newStatus[newStatus.length - 1].time).getTime(); const time = first - last; - //console.log(this); this.time = time / 1000; - //console.log(this.time); + if ( + this.activeDevice.lastStatus == "0" && + this.time < 10 && + newStatus[1].value == "1" + ) { + this.activeDevice.lastStatus = "1"; + } + console.log(this.time); }); };