-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
162 lines (159 loc) · 9.05 KB
/
index.html
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
162
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sonoff - ewelink device monitoring</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="css/styles.css?v=5">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
</head>
<body>
<div class="container mt-5">
<div class="d-flex justify-content-between align-items-center">
<h1 class="text-center w-100" id="animatedTitle">
<i class="fas fa-chart-line me-2"></i>
Sonoff - ewelink device monitoring
</h1>
<div class="form-check form-switch ms-auto">
<input class="form-check-input" type="checkbox" id="darkModeToggle">
<label class="form-check-label" for="darkModeToggle"><span id="darkModeIcon" class="fa"></span></label>
</div>
</div>
<div class="d-flex justify-content-center mb-3">
<button id="useHttp" class="btn btn-outline-primary me-2">
<i class="fas fa-bolt me-2"></i>Use HTTP
</button>
<button id="useWebSocket" class="btn btn-outline-secondary">
<i class="fas fa-hourglass-half me-2"></i>Use WebSocket
</button>
</div>
<div id="loader" class="mt-2">
<div class="progress" style="height: 30px;">
<div id="loader-progress" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%;">0%</div>
</div>
<div id="loader-text" class="mt-2">Connecting and fetching data...</div>
</div>
<h2><i class="fas fa-cogs me-2"></i>Choosing Device</h2>
<div class="mb-3">
<label for="deviceId" class="form-label">Select device:</label>
<select id="deviceId" name="deviceId" class="form-control"></select>
</div>
<div id="parameters" class="mb-3" style="display: none;">
<h2 class="text-decoration-underline"><i class="fas fa-sliders-h me-2"></i>Select Parameters to Monitor <span>▼</span></h2>
<div id="parameters-content">
<div class="row">
<div class="form-check col-md-4">
<input class="form-check-input" type="checkbox" id="selectAll">
<label class="form-check-label font-weight-bold" for="selectAll">Select All</label>
</div>
</div>
<div id="paramForm" class="row mt-2"></div>
</div>
<button id="startMonitoring" class="btn btn-success mt-2" style="display: none;">Start Monitoring</button>
</div>
<div id="monitoringControls" class="mb-3" style="display: none;">
<div class="form-group">
<label for="requestInterval" class="form-label">Request Interval (seconds):</label>
<input type="number" id="requestInterval" name="requestInterval" class="form-control" value="5">
</div>
</div>
<div id="deviceControlSection" style="display: none;">
<h2><i class="fas fa-toggle-on me-2"></i>Device Control</h2>
<div id="deviceControl" class="mb-3 border p-3">
<div id="multiChannelToggles">
<!-- Dynamic Toggle Switches will be added here -->
</div>
<div class="d-flex justify-content-start mt-2">
<button id="advancedControl" class="btn btn-warning me-2">Advanced Control</button>
<button id="stopMonitoring" class="btn btn-danger">Stop Monitoring</button>
</div>
</div>
</div>
<div id="deviceData" class="mb-3" style="display: none;">
<h2><i class="fas fa-wave-square me-2"></i>Live Data</h2>
<pre id="liveData" class="border p-3"></pre>
</div>
<div id="heartbeat" class="mb-3" style="display: none;">
<h2><i class="fas fa-heartbeat me-2"></i>Heartbeat <span id="ws-icon" class="ws-icon ws-offline"></span></h2>
<pre id="heartbeatLog" class="border p-3"></pre>
</div>
<div id="websocketsStats" class="mb-3" style="display: none;">
<h2><i class="fas fa-chart-bar me-2"></i>Websockets Stats</h2>
<pre id="answerTimeLog" class="border p-3"></pre>
</div>
<div id="httpStats" class="mb-3" style="display: none;">
<h2><i class="fas fa-signal me-2"></i>HTTP Stats</h2>
<pre id="answerTimeLogHttp" class="border p-3"></pre>
</div>
<div id="changesLog" class="mb-3" style="display: none;">
<h2><i class="fas fa-history me-2"></i>Changes Log</h2>
<div id="changesContainer" class="log-container"></div>
</div>
</div>
<audio id="notificationSound" src="audio/ding.wav" preload="auto"></audio>
<footer class="text-center mt-5">
<p>© powered by <a href="https://github.com/PJanisio/ewelinkApiPhp" target="_blank">ewelinkApiPhp</a> and <a href="https://github.com/PJanisio/ewelinkapiphp-device-monitoring" target="_blank">Device Monitoring</a></p>
</footer>
<!-- Modal for Advanced Control -->
<div class="modal fade" id="advancedControlModal" tabindex="-1" aria-labelledby="advancedControlModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="advancedControlModalLabel">Advanced Control</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="text-danger">Please carefully choose parameters and values for change, in case of error you could have to pair device again and in worst case your device can be broken.</p>
<form id="advancedControlForm">
<div class="row" id="advancedControlFormContent">
<!-- Dynamic form content will be loaded here -->
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="sendAdvancedControl">Send</button>
</div>
</div>
</div>
</div>
<!-- Modal for Progress -->
<div class="modal fade" id="progressModal" tabindex="-1" aria-labelledby="progressModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="progressModalLabel">Working...</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="progress" style="height: 30px;">
<div id="progressBar" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%;">0%</div>
</div>
<div id="progressText" class="mt-2">Initializing...</div>
</div>
</div>
</div>
</div>
<!-- Small Modal for Advanced Control Progress -->
<div class="modal fade" id="modalProgressModal" tabindex="-1" aria-labelledby="modalProgressModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalProgressModalLabel">Working...</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="progress" style="height: 30px;">
<div id="modal-loader-progress" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%;">0%</div>
</div>
<div id="modal-loader-text" class="mt-2">Initializing...</div>
</div>
</div>
</div>
</div>
<script src="js/scripts.js?v=<?php echo time(); ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>