diff --git a/status_server.js b/status_server.js index af4e701..567465e 100644 --- a/status_server.js +++ b/status_server.js @@ -631,6 +631,10 @@ const dashboardHTML = ` if (!devices[mac]) { // New device, request full refresh + console.log('New device detected (' + mac + '), requesting refresh...'); + if (ws && ws.readyState === WebSocket.OPEN) { + ws.send(JSON.stringify({ type: 'get_status' })); + } return; } @@ -961,6 +965,11 @@ wss.on('connection', async (ws) => { } } ws.send(JSON.stringify({ type: 'set_config_result', success })); + } else if (data.type === 'get_status') { + // Client requested full status refresh + const devices = await getStatusData(); + const rules = await getRulesStatus(); + ws.send(JSON.stringify({ type: 'init', devices, rules })); } } catch (err) { console.error('[Status] Error processing message:', err);