From a6dc824bc0cfabd8d0eb41f6a0615fd542cad201 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Sat, 19 May 2018 02:06:04 +0900 Subject: [PATCH] Only Flora has moisture I think The rest will be humidity --- html/home.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html/home.html b/html/home.html index 24c3e42..e23237f 100644 --- a/html/home.html +++ b/html/home.html @@ -177,7 +177,8 @@ function displayGraph(id, data, width, height, interpolation) { oneUrl = `${baseUrl}/id/${id}?limit=150`; that.off('click'); $.getJSON(oneUrl, function(data, textStatus, xhr) { - var extra = (data[0]['info']['sensor'] === "dht11" ? "humidity" : "moisture"); + var isFlora = data[0]['info']['sensor'].toLowerCase().indexOf("flora") > -1; + var extra = (isFlora ? 'humidity' : 'moisture'); var ks = ['temperature', extra]; for (var ik in ks) { var key = ks[ik]; @@ -196,7 +197,8 @@ function displayGraph(id, data, width, height, interpolation) { var x = data[i]; addToList(x); addEleToDashBoard(x); - var toHide = (x['info']['sensor'] === "dht11" ? 'moisture' : 'humidity'); + var isFlora = x['info']['sensor'].toLowerCase().indexOf("flora") > -1; + var toHide = (isFlora ? 'humidity' : 'moisture'); $('#' + x['device'].replace(/:/g, '_')).find('.'+ toHide).hide(); } reloadListener();