Files
kkelomatic_home/node-red/room-config-loader.js
nearxos 0af21f4dc3 Refactor room and light configurations for Node-RED integration
- Updated global variable lists in GVL_IO.gvl and GVL_NVL_placeholders.gvl to reflect new room naming conventions and structures.
- Revised PLC_App.st to map new room configurations for lighting control.
- Enhanced documentation in all-lights-and-rooms.md and ha-lights-and-rooms.md to align with updated room and light entity naming.
- Adjusted room-config.js and related Node-RED flows to support the new configuration structure.

This update improves the organization and clarity of room and light management within the Node-RED integration, ensuring consistency across the system.
2026-04-01 19:09:59 +03:00

42 lines
1.4 KiB
JavaScript

// Load room config into global (no require - Function nodes can't use it).
// 1. Open node-red/config_files/room-config.js in the repo (mirror of server file).
// 2. Copy the whole object: from "const ROOM_CONFIG = {" up to "};" (do NOT copy "module.exports").
// 3. Replace the ROOM_CONFIG below with your paste. Keep the two lines at the end.
const ROOM_CONFIG = {
roomNames: [
'open_plan_living_room',
'open_plan_dining_room',
'open_plan_entrance',
'open_plan_guest_wc',
'kitchen_kitchen',
'kitchen_pantry',
'bedrooms_office',
'bedrooms_hallway',
'bedrooms_laundry',
'bedrooms_shower',
'bedrooms_bedroom',
'master_bedroom_suite',
'master_bedroom_bathroom',
'exterior_veranda',
'exterior_entrance',
'exterior_yard',
],
lightEntityMap: [
{ room: 'l_open_plan_living_room', light: 1, entityId: 'input_boolean.open_plan_living_room_main_1' },
],
entityToRoom: { open_plan_living_room_main: 'open_plan_living_room' },
deviceToRoom: { 'Office Switch': 'open_plan_living_room' },
deviceIdToName: {},
switchBindings: {
'Office Switch': {
1: { room: 'open_plan_living_room', light: 1 },
2: { room: 'open_plan_dining_room', light: 1 },
},
},
};
global.set('roomConfig', ROOM_CONFIG);
node.warn('[Load room config] loaded: ' + ROOM_CONFIG.roomNames.length + ' rooms');
return null;