| <html> | |
| <head> | |
| <title>Smart Home Control</title> | |
| </head> | |
| <body> | |
| <h1>Управление умным домом</h1> | |
| <div> | |
| <button onclick="sendCommand('led1', 'on')">Включить свет</button> | |
| <button onclick="sendCommand('led1', 'off')">Выключить свет</button> | |
| </div> | |
| <script> | |
| function sendCommand(device, command) { | |
| fetch(`/set_command?device_id=${device}&command=${command}`) | |
| .then(response => response.json()) | |
| .then(data => console.log(data)); | |
| } | |
| </script> | |
| </body> | |
| </html> |