first commit

This commit is contained in:
Myk
2024-04-05 18:51:21 +03:00
commit 90fde56762
13 changed files with 735 additions and 0 deletions

97
src/static/index.html Normal file
View File

@@ -0,0 +1,97 @@
<!DOCTYPE HTML>
<html>
<head>
<title>ESP32 WxServer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<style>
html {
font-family: Arial;
display: inline-block;
margin: 0px auto;
text-align: center;
}
h2 { font-size: 3.0rem; }
p { font-size: 3.0rem; }
.units { font-size: 1.2rem; }
.sensor-lable{
font-size: 1.5rem;
vertical-align:middle;
padding-bottom: 15px;
}
</style>
</head>
<body>
<h2>ESP32 CCS881 & HDC1080 Server</h2>
<h3>Loaded: %TIMESTAMP%</h3>
<p>
<i class="fas fa-thermometer-half" style="color:#059e8a;"></i>
<span class="sensor-lable">Temperature</span>
<span id="temperature">%TEMPERATURE%</span>
<sup class="units">&deg;C</sup>
</p>
<p>
<i class="fas fa-tint" style="color:#00add6;"></i>
<span class="sensor-lable">Humidity</span>
<span id="humidity">%HUMIDITY%</span>
<sup class="units">&percnt;</sup>
</p>
<p>
<i class="fas fa-gas-pump" style="color:#6959cd;"></i>
<span class="sensor-lable">CO2 concentration</span>
<span id="eco2">%ECO2%</span>
<sup class="units">ppm</sup>
</p>
<p>
<i class="fas fa-smog" style="color:#8b008b;"></i>
<span class="sensor-lable">TVOC concentration:</span>
<span id="tvoc">%TVOC%</span>
<sup class="units">ppb</sup>
</p>
</body>
<script>
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("temperature").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/temperature", true);
xhttp.send();
}, 10000 ) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("tvoc").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/tvoc", true);
xhttp.send();
}, 10000 ) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("eco2").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/eco2", true);
xhttp.send();
}, 10000 ) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("humidity").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/humidity", true);
xhttp.send();
}, 10000 ) ;
</script>
</html>

View File

@@ -0,0 +1,105 @@
{
"id": "urn:myweatherstation:sensor1",
"name": "WeatherStation001",
"description": "A weather station providing temperature, humidity, TVOC, and eCO2 readings",
"encodingType": "application/json",
"metadata": "https://myweatherstation.com/metadata",
"Datastreams": [
{
"id": "urn:myweatherstation:datastream:temperature",
"name": "Temperature",
"description": "Temperature readings",
"unitOfMeasurement": {
"name": "Degree Celsius",
"symbol": "°C",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#DegreeCelsius"
},
"ObservedProperty": {
"name": "Temperature",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#Temperature"
},
"Sensor": {
"name": "Temperature Sensor",
"description": "Sensor for measuring temperature"
},
"Observations": [
{
"phenomenonTime": "%TIMESTAMP%",
"result": "%TEMPERATURE%"
}
]
},
{
"id": "urn:myweatherstation:datastream:humidity",
"name": "Humidity",
"description": "Humidity readings",
"unitOfMeasurement": {
"name": "Percent",
"symbol": "%%",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Percent"
},
"ObservedProperty": {
"name": "Relative Humidity",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#RelativeHumidity"
},
"Sensor": {
"name": "Humidity Sensor",
"description": "Sensor for measuring humidity"
},
"Observations": [
{
"phenomenonTime": "%TIMESTAMP%",
"result": "%HUMIDITY%"
}
]
},
{
"id": "urn:myweatherstation:datastream:TVOC",
"name": "TVOC",
"description": "Total Volatile Organic Compounds readings",
"unitOfMeasurement": {
"name": "Parts Per Billion",
"symbol": "ppb",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#PartsPerBillion"
},
"ObservedProperty": {
"name": "Total Volatile Organic Compounds",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#TotalVolatileOrganicCompounds"
},
"Sensor": {
"name": "TVOC Sensor",
"description": "Sensor for measuring Total Volatile Organic Compounds"
},
"Observations": [
{
"phenomenonTime": "%TIMESTAMP%",
"result": "%TVOC%"
}
]
},
{
"id": "urn:myweatherstation:datastream:eCO2",
"name": "eCO2",
"description": "Equivalent Carbon Dioxide readings",
"unitOfMeasurement": {
"name": "Parts Per Million",
"symbol": "ppm",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#PartsPerMillion"
},
"ObservedProperty": {
"name": "Equivalent Carbon Dioxide",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#CarbonDioxideConcentration"
},
"Sensor": {
"name": "eCO2 Sensor",
"description": "Sensor for measuring Equivalent Carbon Dioxide"
},
"Observations": [
{
"phenomenonTime": "%TIMESTAMP%",
"result": "%ECO2%"
}
]
}
]
}