feat: Implement real-time rule status updates and dashboard display via WebSockets.
This commit is contained in:
@@ -4,7 +4,7 @@ import path from 'path';
|
||||
import sqlite3 from 'sqlite3';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { initRuleEngine, loadRules, runRules, watchRules } from './rule_engine.js';
|
||||
import { broadcastEvent, startStatusServer } from './status_server.js';
|
||||
import { broadcastEvent, broadcastRuleUpdate, startStatusServer } from './status_server.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -174,7 +174,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
||||
console.log('Shelly Agent Server listening on port 8080');
|
||||
|
||||
// Initialize and load rules
|
||||
initRuleEngine(db, sendRPCToDevice);
|
||||
initRuleEngine(db, sendRPCToDevice, broadcastRuleUpdate);
|
||||
loadRules().then(() => {
|
||||
console.log('Rule engine ready');
|
||||
watchRules(); // Auto-reload rules when files change
|
||||
|
||||
Reference in New Issue
Block a user