Update templates/index.html
Browse files- templates/index.html +20 -0
templates/index.html
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Smart Home Control</title>
|
| 5 |
+
</head>
|
| 6 |
+
<body>
|
| 7 |
+
<h1>Управление умным домом</h1>
|
| 8 |
+
<div>
|
| 9 |
+
<button onclick="sendCommand('led1', 'on')">Включить свет</button>
|
| 10 |
+
<button onclick="sendCommand('led1', 'off')">Выключить свет</button>
|
| 11 |
+
</div>
|
| 12 |
+
<script>
|
| 13 |
+
function sendCommand(device, command) {
|
| 14 |
+
fetch(`/set_command?device_id=${device}&command=${command}`)
|
| 15 |
+
.then(response => response.json())
|
| 16 |
+
.then(data => console.log(data));
|
| 17 |
+
}
|
| 18 |
+
</script>
|
| 19 |
+
</body>
|
| 20 |
+
</html>
|