Добавлено скрытие в веб-интерфейсе ненужных данных (типа срабатывания датчика присутс...
authorRoman Bazalevsky <rvb@rvb.name>
Tue, 13 Nov 2018 08:09:45 +0000 (11:09 +0300)
committerRoman Bazalevsky <rvb@rvb.name>
Tue, 13 Nov 2018 08:10:31 +0000 (11:10 +0300)
openwrt-web/meteo/meteo.js

index f56bc2db61063ba15c7846e3f5c6375e8fc1783d..9060847fccbd5ac57e8dfae18d749faed2ec3c9f 100644 (file)
@@ -24,27 +24,29 @@ function RefreshPageState() {
           if (sensor != "timestamp") {
             for (var param in returnedData[sensor_id][sensor]) {
               sensor_path = sensor_id+"."+sensor+"."+param;
-              value = returnedData[sensor_id][sensor][param];
               name = properties["names"][sensor_path];
-              if (! name) { name = sensor_path; }
-              units = properties["units"][sensor_path];
-              scale = properties["scale"][sensor_path];
-              color = properties["colors"][sensor_path];
-              if (scale) {
-                value = (scale[0] * value).toFixed(scale[1]);
+              if (! name.startsWith("-")) {
+                value = returnedData[sensor_id][sensor][param];
+                if (! name) { name = sensor_path; }
+                units = properties["units"][sensor_path];
+                scale = properties["scale"][sensor_path];
+                color = properties["colors"][sensor_path];
+                if (scale) {
+                  value = (scale[0] * value).toFixed(scale[1]);
+                }
+                if (! color) {
+                  color =  value_color;
+                }
+                var section = template.replace(/\$SENSOR_ID/g,sensor_id);
+                section = section.replace(/\$SENSOR/g,sensor);
+                section = section.replace(/\$PARAM/g,param);
+                section = section.replace(/\$NAME/g,name);
+                section = section.replace(/\$UNITS/g,units);
+                section = section.replace(/\$VALUE/g,value);
+                section = section.replace(/\$COLOR/g,color);
+                section = section.replace(/\$TIMESTAMP/g,timestamp);
+                html = html + section;
               }
-              if (! color) {
-                color =  value_color;
-              }
-              var section = template.replace(/\$SENSOR_ID/g,sensor_id);
-              section = section.replace(/\$SENSOR/g,sensor);
-              section = section.replace(/\$PARAM/g,param);
-              section = section.replace(/\$NAME/g,name);
-              section = section.replace(/\$UNITS/g,units);
-              section = section.replace(/\$VALUE/g,value);
-              section = section.replace(/\$COLOR/g,color);
-              section = section.replace(/\$TIMESTAMP/g,timestamp);
-              html = html + section;
             }
           }  
         }