Created
July 1, 2026 14:42
-
-
Save saamerm/df3e08e9564c5a65b1cbf41b6c5be6ea to your computer and use it in GitHub Desktop.
This is the front end code for an online remote control for your Hisense with in-built Fire TV. The server code is here: https://gist.github.com/saamerm/e0fc57906a31535fea6591a8650e92b2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Hisense Fire TV Controller</title> | |
| <style> | |
| body { font-family: 'Segoe UI', system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; background: #121214; color: #fff; margin: 0; padding: 20px; } | |
| .grid-container { display: grid; grid-template-columns: repeat(3, 90px); gap: 12px; margin-top: 20px; justify-content: center;} | |
| button { font-size: 1rem; font-weight: 600; padding: 16px; border-radius: 12px; border: none; cursor: pointer; background: #202024; color: #fff; transition: background 0.2s; } | |
| button:hover { background: #2a2a30; } | |
| button:active { background: #007bff; } | |
| .span-3 { grid-column: span 3; } | |
| .empty { background: transparent; cursor: default; } | |
| .empty:hover { background: transparent; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Fire OS Controller</h1> | |
| <div class="grid-container"> | |
| <!-- Power Management --> | |
| <button onclick="wakeTV()" style="background: #28a745;">Wake ON</button> | |
| <!-- KeyCode 26 handles both power on and sleep off toggles in Fire OS --> | |
| <button onclick="sendKey(26)" style="background: #dc3545;">Power</button> | |
| <!-- KeyCode 178 switches or opens the TV input menu --> | |
| <button onclick="sendKey(178)">Input</button> | |
| <!-- Navigation D-Pad Layout --> | |
| <button class="empty"></button> | |
| <button onclick="sendKey(19)">▲</button> | |
| <button class="empty"></button> | |
| <button onclick="sendKey(21)">◀</button> | |
| <!-- You can try to change this to 66 depending on your need --> | |
| <button onclick="sendKey(23)" style="background: #343a40;">OK</button> | |
| <button onclick="sendKey(22)">▶</button> | |
| <button class="empty"></button> | |
| <button onclick="sendKey(20)">▼</button> | |
| <button class="empty"></button> | |
| <!-- Menu Action Row --> | |
| <button onclick="sendKey(4)">Back</button> | |
| <button onclick="sendKey(3)" style="background: #007bff;">Home</button> | |
| <button onclick="sendKey(82)">Menu</button> | |
| <!-- Volume Utility Row --> | |
| <button class="span-3" onclick="sendKey(24)">Volume +</button> | |
| <button class="span-3" onclick="sendKey(25)">Volume -</button> | |
| </div> | |
| <script> | |
| // Sends regular keystroke commands using Android KeyCodes | |
| async function sendKey(numericKeycode) { | |
| try { | |
| await fetch('http://localhost:3000/api/command', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ key: numericKeycode }) | |
| }); | |
| } catch (error) { | |
| console.error("Local network relay communication error:", error); | |
| } | |
| } | |
| // Sends the wake-on-lan packet sequence | |
| async function wakeTV() { | |
| try { | |
| await fetch('http://localhost:3000/api/wakeup', { | |
| method: 'POST' | |
| }); | |
| } catch (error) { | |
| console.error("Failed to send Wake-on-LAN command:", error); | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment