2023-08-19 18:34:10 +02:00
|
|
|
#include "globalvars.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2023-08-19 19:19:25 +02:00
|
|
|
void reload_home() // generates current time and changes variables in home_html
|
|
|
|
{
|
2023-11-12 22:45:47 +01:00
|
|
|
sprintf(home_html, "<!DOCTYPE html>\
|
2023-08-19 18:34:10 +02:00
|
|
|
<html lang='de'>\
|
|
|
|
<head>\
|
2023-08-19 19:19:25 +02:00
|
|
|
<meta charset='UTF-8'>\
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge'>\
|
|
|
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>\
|
|
|
|
<title>Home</title>\
|
|
|
|
<style>\
|
|
|
|
* {\
|
|
|
|
font-family: Arial, Helvetica, sans-serif;\
|
|
|
|
font-size: 40px;\
|
|
|
|
user-select: none;\
|
|
|
|
text-decoration: none;\
|
|
|
|
}\
|
|
|
|
h2 {\
|
|
|
|
font-size: 28px;\
|
|
|
|
}\
|
|
|
|
h2 span{\
|
|
|
|
font-size: inherit;\
|
|
|
|
font-family: monospace;\
|
|
|
|
}\
|
|
|
|
.wrapper_main {\
|
|
|
|
margin: 0 auto;\
|
|
|
|
width: fit-content;\
|
|
|
|
width: -moz-fit-content;\
|
|
|
|
text-align: center;\
|
|
|
|
background-color: rgb(202, 202, 202);\
|
|
|
|
padding: 1px 8px 8px 8px;\
|
|
|
|
border-radius: 4px;\
|
|
|
|
}\
|
|
|
|
.wrapper_form div a {\
|
|
|
|
width: 100px;\
|
|
|
|
}\
|
|
|
|
.wrapper_form div a, .animated_a {\
|
|
|
|
background-color: rgb(252, 255, 104);\
|
|
|
|
border: none;\
|
|
|
|
border-radius: 4px;\
|
|
|
|
box-shadow: rgb(180, 172, 59) 0 4px;\
|
|
|
|
position: relative;\
|
|
|
|
margin: 8px 0;\
|
|
|
|
padding: 2px;\
|
|
|
|
}\
|
|
|
|
.wrapper_form div a, .animated_a {\
|
|
|
|
display: inline-block;\
|
|
|
|
}\
|
|
|
|
a {\
|
|
|
|
color: black;\
|
|
|
|
}\
|
|
|
|
.wrapper_form div a, .animated_a {\
|
|
|
|
cursor: pointer;\
|
|
|
|
}\
|
|
|
|
.animated_a:active, .wrapper_form div a:active {\
|
|
|
|
box-shadow: rgb(180, 172, 59) 0 2px;\
|
|
|
|
top: 2px;\
|
|
|
|
}\
|
|
|
|
</style>\
|
2023-08-19 18:34:10 +02:00
|
|
|
</head>\
|
|
|
|
<body>\
|
2023-08-19 19:19:25 +02:00
|
|
|
<div class='wrapper_main'>\
|
|
|
|
<h1>Übersicht</h1>\
|
2023-11-13 22:33:19 +01:00
|
|
|
<h2>Uhrzeit: <span>%02d:%02d:%02d</span></h2>\
|
2023-08-19 19:19:25 +02:00
|
|
|
<div class='wrapper_form'>\
|
|
|
|
<div>\
|
|
|
|
<span>Ventil 1: </span>\
|
|
|
|
<a href='/toggle?number=0'>%s</a>\
|
|
|
|
</div>\
|
|
|
|
<a class='animated_a' href='/settings'>Einstellungen</a>\
|
|
|
|
<br>\
|
|
|
|
<a class='animated_a' href='http://192.168.2.5'>Garten Anlage</a>\
|
|
|
|
</div>\
|
|
|
|
</div>\
|
2023-08-19 18:34:10 +02:00
|
|
|
</body>\
|
|
|
|
</html>",
|
2023-11-13 22:33:19 +01:00
|
|
|
myTime.hour(), myTime.minute(), myTime.second(), stat[0]);
|
2023-08-19 18:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void reload_settings() {
|
2023-11-12 22:45:47 +01:00
|
|
|
sprintf(
|
|
|
|
settings_html,
|
|
|
|
"<span> Ziel: </span><input type='number' min=0 max=50 name='temperature' value='%d' class='temperature'>°C <span>\
|
2023-11-13 20:41:30 +01:00
|
|
|
<br><span> Minimum: </span><input type='number' min=0 max=50 name='min_temperature' value='%d' class='temperature'>°C <span>\
|
2023-08-19 19:19:25 +02:00
|
|
|
<br>Aktuell: %d°C</span>\
|
|
|
|
<br>\
|
|
|
|
<input type='submit'>\
|
|
|
|
</form>\
|
|
|
|
<div class='wrapper_table'>\
|
|
|
|
<table>\
|
|
|
|
<tr>\
|
|
|
|
<th style='background-color: gray;'></th>\
|
|
|
|
<th>von:</th>\
|
|
|
|
<th>bis:</th>\
|
|
|
|
<th>von:</th>\
|
|
|
|
<th>bis:</th>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>1</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>2</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>3</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>4</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>5</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>6</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>7</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
<tr>\
|
|
|
|
<td>8</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
<td>%s:%s</td>\
|
|
|
|
</tr>\
|
|
|
|
</table>\
|
|
|
|
</div>\
|
|
|
|
<a class='animated_a' href='/'>Übersicht</a>\
|
|
|
|
</div>\
|
|
|
|
</body>\
|
2023-08-19 18:34:10 +02:00
|
|
|
</html>",
|
2023-11-13 20:41:30 +01:00
|
|
|
temperatureSet, minTemperatureSet, temperature, time_all[0][0],
|
|
|
|
time_all[1][0], time_all[2][0], time_all[3][0], time_all[4][0],
|
|
|
|
time_all[5][0], time_all[6][0], time_all[7][0], time_all[0][1],
|
|
|
|
time_all[1][1], time_all[2][1], time_all[3][1], time_all[4][1],
|
|
|
|
time_all[5][1], time_all[6][1], time_all[7][1], time_all[0][2],
|
|
|
|
time_all[1][2], time_all[2][2], time_all[3][2], time_all[4][2],
|
|
|
|
time_all[5][2], time_all[6][2], time_all[7][2], time_all[0][3],
|
|
|
|
time_all[1][3], time_all[2][3], time_all[3][3], time_all[4][3],
|
|
|
|
time_all[5][3], time_all[6][3], time_all[7][3], time_all[0][4],
|
|
|
|
time_all[1][4], time_all[2][4], time_all[3][4], time_all[4][4],
|
|
|
|
time_all[5][4], time_all[6][4], time_all[7][4], time_all[0][5],
|
|
|
|
time_all[1][5], time_all[2][5], time_all[3][5], time_all[4][5],
|
|
|
|
time_all[5][5], time_all[6][5], time_all[7][5], time_all[0][6],
|
|
|
|
time_all[1][6], time_all[2][6], time_all[3][6], time_all[4][6],
|
|
|
|
time_all[5][6], time_all[6][6], time_all[7][6], time_all[0][7],
|
|
|
|
time_all[1][7], time_all[2][7], time_all[3][7], time_all[4][7],
|
|
|
|
time_all[5][7], time_all[6][7], time_all[7][7]);
|
2023-08-19 18:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void handleToggle() {
|
2023-11-12 22:45:47 +01:00
|
|
|
int i =
|
|
|
|
server.arg("number")
|
|
|
|
.toInt(); // handles manual toggle and converts GET argument to int
|
|
|
|
override[i] = !override[i];
|
|
|
|
debugln(F("---------------------------"));
|
|
|
|
debug(F("[RECIVED] for: "));
|
|
|
|
debugln(i);
|
|
|
|
digitalWrite(pins[i], !digitalRead(pins[i]));
|
|
|
|
digitalWrite(2, !digitalRead(2));
|
|
|
|
if (digitalRead(pins[i]) == HIGH) {
|
|
|
|
sprintf(stat[i], "AN");
|
|
|
|
} else {
|
|
|
|
sprintf(stat[i], "AUS");
|
|
|
|
}
|
|
|
|
debug(F("Status: "));
|
|
|
|
debugln(stat[i]);
|
|
|
|
reload_home();
|
|
|
|
server.sendHeader(F("Location"), F("/"), true);
|
|
|
|
server.send(302, F("text/html"), home_html);
|
|
|
|
debugln(override[i]);
|
|
|
|
debugln(F("---------------------------"));
|
2023-08-19 18:34:10 +02:00
|
|
|
}
|