save website from rpi
This commit is contained in:
118
web/index.html
118
web/index.html
@@ -5,27 +5,27 @@
|
|||||||
<script src="https://cdn.plot.ly/plotly-latest.min.js" charset="utf-8"></script>
|
<script src="https://cdn.plot.ly/plotly-latest.min.js" charset="utf-8"></script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
<title>Climate-Measuring-Box</title>
|
<title>Node dev page</title>
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
|
||||||
</head>
|
</head>a
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Make a new header with a navigation bar -->
|
<!-- Make a new header with a navigation bar -->
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar">
|
<nav class="navbar">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="climate-monitor.html">Monitoring</a></li>
|
<li><a href="climate-monitor.html">Monitoring deez</a></li>
|
||||||
<li><a href="Map.html">Map</a></li>
|
<li><a href="Map.html">Map</a></li>
|
||||||
<li><a onclick="serialConnect()" class="navRight">Connect to port</a></li>
|
|
||||||
<li><a onclick="disconnect()" class="navRight">Disconnect from port</a></li>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- Make a new flex container for the live data -->
|
<!-- Make a new flex container for the live data -->
|
||||||
<div class="flex-LiveData">
|
<div class="nodeData">
|
||||||
|
<div class="flex-NodeData">
|
||||||
|
<div class="flex-LiveData">
|
||||||
<div>
|
<div>
|
||||||
<div>Temperatuur: <p id="temperature">Not connected</p>
|
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,20 +50,116 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Make a new flexcontainer for the graphs and API request time -->
|
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||||
<div class="flex-graph">
|
<div class="flex-graph">
|
||||||
<div>
|
<div>
|
||||||
<p>Live graph:</p>
|
<p>Live graph:</p>
|
||||||
<div id="liveGraph"></div>
|
<div id="liveGraph"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-NodeData">
|
||||||
|
<div class="flex-LiveData">
|
||||||
<div>
|
<div>
|
||||||
<div>Time until POST request to API:<p id="cnt">Connect to port</p></div>
|
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="tempStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>API data:</p>
|
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||||
<div id="apiGraph"></div>
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="humidStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||||
|
<div class="flex-graph">
|
||||||
|
<div>
|
||||||
|
<p>Live graph:</p>
|
||||||
|
<div id="liveGraph"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- class="nodeData" -->
|
||||||
|
<div class="nodeData">
|
||||||
|
<div class="flex-NodeData">
|
||||||
|
<div class="flex-LiveData">
|
||||||
|
<div>
|
||||||
|
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="tempStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="humidStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||||
|
<div class="flex-graph">
|
||||||
|
<div>
|
||||||
|
<p>Live graph:</p>
|
||||||
|
<div id="liveGraph"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <div class="flex-NodeData">
|
||||||
|
<div class="flex-LiveData">
|
||||||
|
<div>
|
||||||
|
<div>Temperatuur: <p id="temperature">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="tempStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Luchtvochtigheid: <p id="humidity">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="humidStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Lichtintensiteit: <p id="lightIntensity">Not connected</p>
|
||||||
|
</div>
|
||||||
|
<div class="statusElement">
|
||||||
|
<p class="statusText" id="lightIntensityStatus">Not connected</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Make a new flexcontainer for the graphs and API request time -->
|
||||||
|
<div class="flex-graph">
|
||||||
|
<div>
|
||||||
|
<p>Live graph:</p>
|
||||||
|
<div id="liveGraph"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- class="nodeData" -->
|
||||||
|
|
||||||
<!-- Include the js file -->
|
<!-- Include the js file -->
|
||||||
<script src="main.js"></script>
|
<script src="main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
52
web/main.js
52
web/main.js
@@ -1,26 +1,29 @@
|
|||||||
|
let data;
|
||||||
|
let measurements;
|
||||||
|
let date;
|
||||||
|
let value;
|
||||||
|
let newArrayTemp = [];
|
||||||
|
let newArrayHumid = [];
|
||||||
|
let newArrayLight = [];
|
||||||
|
let timeArray = []; // Array to store time values`
|
||||||
|
let dateArray = [1,2,3];
|
||||||
|
let valueArray = [1,2,3,4,5];
|
||||||
|
let newValueArray = [4,5,6];
|
||||||
|
let myValue = 1;
|
||||||
|
|
||||||
|
//const timeArray = [1,2,3,4];
|
||||||
|
//const dateArray = [5,6,7,8];
|
||||||
|
//const valueArray = [1,1,1,3];
|
||||||
|
|
||||||
// Make lines in the graph of the live data
|
// Make lines in the graph of the live data
|
||||||
Plotly.plot("liveGraph", [
|
Plotly.plot("liveGraph", [
|
||||||
{
|
{
|
||||||
x: timeArray, // Use timeArray as x values
|
x: timeArray, // Use timeArray as x values
|
||||||
y: newArrayTemp,
|
y: valueArray,
|
||||||
mode: "lines",
|
mode: "lines",
|
||||||
line: { color: "#80CAF6" },
|
line: { color: "#80CAF6" },
|
||||||
name: "Temperature",
|
name: "Temperature",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
x: timeArray, // Use timeArray as x values
|
|
||||||
y: newArrayHumid,
|
|
||||||
mode: "lines",
|
|
||||||
line: { color: "#FFA500" },
|
|
||||||
name: "Humidity",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
x: timeArray, // Use timeArray as x values
|
|
||||||
y: newArrayLight,
|
|
||||||
mode: "lines",
|
|
||||||
line: { color: "#00FF00" },
|
|
||||||
name: "Light / 100",
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
@@ -28,10 +31,13 @@ let cnt = 0;
|
|||||||
// Update the graph every 1 ms
|
// Update the graph every 1 ms
|
||||||
let interval = setInterval(function () {
|
let interval = setInterval(function () {
|
||||||
var time = new Date();
|
var time = new Date();
|
||||||
|
timeArray.push(new Date());
|
||||||
|
|
||||||
|
valueArray.push(Math.random() * 10);
|
||||||
|
|
||||||
var update = {
|
var update = {
|
||||||
x: [[time]],
|
x: [[time]],
|
||||||
y: [[newArrayTemp], [newArrayHumid], [newArrayLight]],
|
y: [[newValueArray]],
|
||||||
};
|
};
|
||||||
|
|
||||||
var olderTime = time.setMinutes(time.getMinutes() - 1);
|
var olderTime = time.setMinutes(time.getMinutes() - 1);
|
||||||
@@ -45,19 +51,5 @@ let interval = setInterval(function () {
|
|||||||
};
|
};
|
||||||
Plotly.relayout("liveGraph", minuteView);
|
Plotly.relayout("liveGraph", minuteView);
|
||||||
|
|
||||||
apiGraph = document.getElementById("apiGraph");
|
|
||||||
Plotly.newPlot(
|
|
||||||
apiGraph,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
x: dateArray,
|
|
||||||
y: valueArray,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
{
|
|
||||||
margin: { t: 0 },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (cnt === 100) clearInterval(interval);
|
if (cnt === 100) clearInterval(interval);
|
||||||
}, 1);
|
}, 1);
|
259
web/styles.css
259
web/styles.css
@@ -1,128 +1,147 @@
|
|||||||
body {
|
body {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: "inter", sans-serif;
|
font-family: "inter", sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
opacity: 0.8;
|
||||||
|
color: green;
|
||||||
|
margin: auto;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
p1 {
|
||||||
|
color: solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.liveGraph{
|
||||||
|
width: 90%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.divCnt{
|
||||||
|
text-align: begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
.apiGraph{
|
||||||
|
height: 100%;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusElement{
|
||||||
|
display:inline-block;
|
||||||
|
border: solid #1f82d3 2px;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusText{
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-NodeData {
|
||||||
|
display: flex;
|
||||||
|
margin-left: 10%;
|
||||||
|
margin-right: 10;
|
||||||
|
height: 40%;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1px solid red;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nodeData {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: row;
|
||||||
|
border: 2px solid red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-LiveData {
|
||||||
|
display: flex;
|
||||||
|
align-content: begin;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.flex-LiveData > div {
|
||||||
|
|
||||||
|
border: solid #1f82d3 2px;
|
||||||
|
padding: 15px 0;
|
||||||
|
font-size: 30px;
|
||||||
|
border-radius: 10px;
|
||||||
|
height: fit-content;
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-graph {
|
||||||
|
display: flex;
|
||||||
|
align-content: begin;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-graph > div {
|
||||||
|
position: relative;
|
||||||
|
border: solid #1f82d3 2px;
|
||||||
|
padding: 15px 0;
|
||||||
|
font-size: 30px;
|
||||||
|
border-radius: 10px;
|
||||||
|
flex-basis: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 850px) {
|
||||||
|
.flex-LiveData>div {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
ul {
|
||||||
opacity: 0.8;
|
margin: 0;
|
||||||
color: black;
|
padding: 20px 0;
|
||||||
margin: auto;
|
}
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
.navbar {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: black;
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
opacity: 0.8;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
p1 {
|
a{
|
||||||
color: solid white;
|
padding: 10px;
|
||||||
}
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.liveGraph{
|
li{
|
||||||
width: 90%;
|
display: inline-block;
|
||||||
height: 100%;
|
padding: 10px;
|
||||||
|
margin: 0 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
.navbar a:hover {
|
||||||
|
background-color: #196bad;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
img {
|
||||||
|
max-width: 100%;
|
||||||
.divCnt{
|
height: auto;
|
||||||
text-align: begin;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.apiGraph{
|
|
||||||
height: 100%;
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statusElement{
|
|
||||||
display:inline-block;
|
|
||||||
border: solid #1f82d3 2px;
|
|
||||||
border-radius: 10px;
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statusText{
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-LiveData {
|
|
||||||
display: flex;
|
|
||||||
align-content: begin;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
gap: 5px;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-LiveData > div {
|
|
||||||
border: solid #1f82d3 2px;
|
|
||||||
padding: 15px 0;
|
|
||||||
font-size: 30px;
|
|
||||||
border-radius: 10px;
|
|
||||||
height: fit-content;
|
|
||||||
width: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-graph {
|
|
||||||
display: flex;
|
|
||||||
align-content: begin;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
gap: 5px;
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-graph > div {
|
|
||||||
position: relative;
|
|
||||||
border: solid #1f82d3 2px;
|
|
||||||
padding: 15px 0;
|
|
||||||
font-size: 30px;
|
|
||||||
border-radius: 10px;
|
|
||||||
flex-basis: 95%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 850px) {
|
|
||||||
.flex-LiveData>div {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar {
|
|
||||||
text-align: center;
|
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
a{
|
|
||||||
padding: 10px;
|
|
||||||
color: black;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
li{
|
|
||||||
display: inline-block;
|
|
||||||
padding: 10px;
|
|
||||||
margin: 0 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
transition: 0.3s;
|
|
||||||
}
|
|
||||||
.navbar a:hover {
|
|
||||||
background-color: #196bad;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
Reference in New Issue
Block a user