diff --git a/index.js b/index.js index b954305..766313d 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ import WebSocketClient from 'dlink_websocketclient'; import { serve } from '@hono/node-server'; import { Hono } from 'hono'; +import { readFileSync } from 'fs'; const client = new WebSocketClient({ ip: process.env.IP, @@ -8,6 +9,10 @@ const client = new WebSocketClient({ }); const app = new Hono(); +app.get('/switch', async (c) => { + const file = readFileSync('./switch.html', 'utf8'); + return c.html(file); +}) app.get('/status', async (c) => { const status = await client.state(); return c.text(status ? 'on' : 'off'); diff --git a/switch.html b/switch.html new file mode 100644 index 0000000..544f41a --- /dev/null +++ b/switch.html @@ -0,0 +1,106 @@ + + + + + + Light lightSwitch Control + + + +
+
+
+
+
OFF
+
+ + + +