-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
61 lines (59 loc) · 1.8 KB
/
index.php
File metadata and controls
61 lines (59 loc) · 1.8 KB
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
<?php require_once("auth.inc.php"); ?>
<?php require_once("header.inc.php"); ?>
<?php
require_once("data.inc.php");
require_once("status.inc.php");
$state = get_home_state();
$recentCheckins = get_recent_checkins();
?>
<div class="container">
<div class="mainInfo">
<div class="mainInfoHeader display-6">
<i class="bi bi-lg bi-<?php echo $state["status"]["icon"]; ?>-circle"></i> Your home is <em style="color: <?php echo $state["status"]["color"]; ?>;"><?php echo $state["status"]["text"]; ?></em>.
</div>
<div class="mainInfoSubheader lead">
Last check-in: <?php echo $state["lastCheckinDisplay"]; ?>
</div>
</div>
<div class="recentCheckins">
<h4>Recent check-ins</h4>
<table class="table">
<thead>
<tr>
<th scope="col">Time</th>
<th scope="col">Powered?</th>
<th scope="col">Battery level</th>
<th scope="col">Battery voltage</th>
<th scope="col">IP</th>
</tr>
</thead>
<tbody>
<?php foreach ($recentCheckins as $checkin) { ?>
<tr>
<td><?php echo relative_time_html($checkin["timestamp"]); ?></td>
<td><?php echo ($checkin["powered"] == 1 ? "yes" : "no"); ?></td>
<?php if ($checkin["batteryLevel"] == -1) { ?>
<td>error</td>
<?php } else { ?>
<td><?php echo htmlspecialchars($checkin["batteryLevel"]) ?>%</td>
<?php } ?>
<?php if ($checkin["batteryVoltage"] == -1) { ?>
<td>error</td>
<?php } else { ?>
<td><?php echo htmlspecialchars($checkin["batteryVoltage"] / 1000) ?> V</td>
<?php } ?>
<td>
<?php echo htmlspecialchars($checkin["ip"]) ?>
(<?php if ($checkin["transport"] == 1) {
echo "UDP";
} else {
echo "HTTP";
} ?>)
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php require_once("footer.inc.php"); ?>