import biplane
server = biplane.Server()
@server.route("/", "GET")
def main(query_parameters, headers, body):
html = """
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CTA Weather</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f7f7f7;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
max-width: 800px;
margin: 20px;
padding: 20pä x;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.weather-info {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
}
.weather-info div {
padding: 20px;
border-radius: 8px;
background-color: #f0f0f0;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
text-align: center;
}
h2 {
margin-top: 0;
font-size: 20px;
color: #555;
}
p {
margin-bottom: 0;
font-size: 18px;
color: #777;
}
footer {
margin-top: 20px;
text-align: center;
color: #888;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<h1>Willkommen bei CTA Weather</h1>
<div class="weather-info">
<div>
<h2>Temperatur</h2>
<p id="temperature">xxxtemperaturxxx</p>
</div>
<div>
<h2>Luftdruck</h2>
<p id="pressure">xxxpressurexxx</p>
</div>
<div>
<h2>Luftgeschwindigkeit</h2>
<p id="wind-speed">xxxwind-speedxxx</p>
</div>
<div>
<h2>Windrichtung</h2>
<p id="wind-direction">xxxwind-directionxxx</p>
</div>
<div>
<h2>Luftfeuchtigkeit</h2>
<p id="humidity">xxxhumidityxxx</p>
</div>
<div>
<h2>Nässe</h2>
<p id="wetness">xxxwetnessxxx</p>
</div>
<div>
<h2>Höhe</h2>
<p id="Altitude">xxxaltitudexxx</p>
</div>
<div>
<h2>Gas</h2>
<p id="gas">xxxgasxxx</p>
</div>
</div>
<footer>
© CTA Weather 2024
</footer>
</div>
<script>
setInterval(updateWeather, 1000); // Funktion alle 1 Sekunde aufrufen
function updateWeather() {
// Hier würde der Code stehen, um die Wetterdaten zu aktualisieren
}
</script>
</body>
</html>
"""
html = html.replace("xxxtemperaturxxx", % bme680.temperature)
html = html.replace("xxxpressurexxx", % bme680.pressure)
html = html.replace("xxxhumidityxxx", % bme680.relative_hunidity)
html = html.replace("xxxaltitudexxx", % bme680.altitude)
html = html.replace("xxxgasxxx", % bme680.gas)
html = html.replace("xxxwetnessxxx", pin_counter_Hall_sensor_Water)
html = html.replace("xxxwind-speedxxx", pin_counter_Hall_sesnor_Speed)
html = html.replace("xxxwind-directionxxx", windrichtung)
return biplane.Response(html, content_type="text/html")
for _ in server.circuitpython_start_wifi_ap("test", "some_password", "app"):
pass