Skip to content
Snippets Groups Projects
Commit 79ca2979 authored by Porter Libby's avatar Porter Libby
Browse files

fix no data status

parent 59a78272
Branches
No related merge requests found
timestamp,barometric,baroTrend,insideTemp,insideHum,outsideTemp,outsideHum,windSpeed,windSpeedAvg,windSpeed2mAvg,windDir,forecast,UVLevel,solarRad,sunrise,sunset
05-18-2022 09:40:01,29.85,n/a-236,77.5,44,62.2,70,0,0.0,0.3,NNW,Increasing clouds with little temperature change.,0.8,127,06:22,20:51
\ No newline at end of file
status,timestamp,barometric,baroTrend,insideTemp,insideHum,outsideTemp,outsideHum,windSpeed,windSpeedAvg,windSpeed2mAvg,windDir,forecast,UVLevel,solarRad,sunrise,sunset
no data,06-21-2022 20:18:26,,,,,,,,,,,,,,,
\ No newline at end of file
......@@ -141,3 +141,8 @@ h2{
bottom: 10px;
right: 10px;
}
#error-bar{
color: #980000;
font-family: sans-serif;
font-size: 16px;
}
......@@ -42,6 +42,7 @@ function get_current_weather(){
}
// ----------- RENDER display ----------- //
function make_display(arr){
console.log(arr);
data = {};
for (x = 0; x < arr[0].length;x++){
title = arr[0][x];
......@@ -52,10 +53,15 @@ function make_display(arr){
document.getElementById("lastrecord").innerText = "Recorded at: " + data['timestamp'];
// Build out various displays
temptable(data);
forecast(data);
windtable(data);
lighttable(data);
if (data["status"] == 'no data'){ // if status=no data, show error message.
document.getElementById("error-bar").innerText = "Host was not able to collect data from Davis Vantage Pro. Check your system."
}
else{ // status is normal
temptable(data);
forecast(data);
windtable(data);
lighttable(data);
}
}
function forecast(data){
forcast_elem = document.getElementById("current-weather-forecast");
......
......@@ -32,6 +32,7 @@
</div>
<!-- Table for current weather data, shows most recent data available (should be within 5-10 minutes) -->
<h3 id="error-bar"></h3>
<table id='current-weather-table-temp'></table>
<table id='current-weather-table-wind'></table>
<table id='current-weather-table-light'></table>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment