-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
161 lines (143 loc) · 6.19 KB
/
dashboard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html>
<head>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
<title>Bhasim</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<style>
.container {
width: 100vw;
height: calc(fit-content + 10vh);
display: grid;
grid-template-areas:
'time time'
'temp1 temp2'
'lumen aquarium';
gap: 1rem;
border: 3px solid black;
padding: 1rem;
text-align: center;
font-size: 4rem;
}
.container>div {
margin-top: 1rem;
margin-bottom: 1rem;
border: 3px solid black;
box-shadow: 2px 2px 2px 2px gray;
}
.center {
margin-left: auto;
margin-right: auto;
text-align: center;
}
@media only screen and (max-width: 750px) {
.container {
display: block;
padding: 0.25rem;
}
}
p {
font-size: 2rem;
max-width: 100vw;
}
svg {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 4rem;
}
#time {
grid-area: time;
}
#temp1 {
grid-area: temp1;
}
#temp2 {
grid-area: temp2;
}
#lumen {
grid-area: lumen;
}
#aquarium {
grid-area: aquarium;
}
</style>
<div class="container center">
<?php
date_default_timezone_set('CET');
$time = date('r');
echo "<p id='time'>" . $time . "</p>";
?>
<?php
$tempgarten = (int)file_get_contents("/sys/devices/w1_bus_master1/28-38db0d1e64ff/temperature") / 1000;
?>
<div id="temp1">
<h1>Temperatuer im Garten</h1>
<?php echo "<p>" . $tempgarten . "</p>";
if ($tempgarten >= 25) {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-high" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V2.5a.5.5 0 0 1 1 0v8.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
} elseif ($tempgarten <= 5) {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-low" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V9.5a.5.5 0 0 1 1 0v1.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
} else {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-half" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V6.5a.5.5 0 0 1 1 0v4.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
};
echo "</div>";
?>
<?php
$templennox = (int)file_get_contents("/sys/devices/w1_bus_master1/10-000802d784f9/temperature") / 1000;
?>
<div id="temp2">
<h1>Temperatuer in Lennox Zimmer</h1>
<?php echo "<p>" . $templennox . "</p>";
if ($templennox >= 25) {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-high" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V2.5a.5.5 0 0 1 1 0v8.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
} elseif ($templennox <= 5) {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-low" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V9.5a.5.5 0 0 1 1 0v1.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
} else {
echo '<svg xmlns="http://www.w3.org/2000/svg" id="svgtemp" fill="currentColor" class="bi bi-thermometer-half" viewBox="0 0 16 16">
<path d="M9.5 12.5a1.5 1.5 0 1 1-2-1.415V6.5a.5.5 0 0 1 1 0v4.585a1.5 1.5 0 0 1 1 1.415z"/>
<path d="M5.5 2.5a2.5 2.5 0 0 1 5 0v7.55a3.5 3.5 0 1 1-5 0V2.5zM8 1a1.5 1.5 0 0 0-1.5 1.5v7.987l-.167.15a2.5 2.5 0 1 0 3.333 0l-.166-.15V2.5A1.5 1.5 0 0 0 8 1z"/>
</svg>';
};
echo "</div>";
?>
<div id="lumen">
<h1>Lumen im Garten</h1>
<?php
$lumen = (float)shell_exec("python3 getlumen.py");
echo "<p> im Garten sind gerade " . $lumen . " lumen</p>";
?>
</div>
<div id="aquarium">
<h1>Ist das Aquarium an?</h1>
<?php
$lumen = (bool)file_get_contents("/home/pi/aquariumstate.txt");
if ($lumen) {
echo "<p> Ja</p>";
} else {
echo "<p> Nein</p>";
}
?>
</div>
</div>
</body>
</html>