/** * Single source of truth for rooms and lights. * Lives on the Node-RED server at /root/.node-red/room-config.js * All function nodes use: global.get('roomConfig') * Loaded at startup from settings.js (functionGlobalContext). To reload without restart, use the * "Reload room config" flow: see node-red/reload-room-config-docs.md */ const ROOM_CONFIG = { // Order must match CODESYS NVL_In. Used by NVL SEND (state-to-nvl-send-payload). roomNames: [ 'cmd_livingroom', 'cmd_out', // add other NVL room keys as needed // 'masterBedroom', // 'masterBathroom', // 'bedroom_1', // 'bedroom_2', // 'bathroom', // 'guestWc', // 'kitchen', // 'pantry', // 'livingRoom', // 'dinningRoom', // 'entrance', // 'hallway', // 'outVeranda', // 'outFront', // 'outBack', // 'outSide', ], // PLC → HA sync. room = key in nvl-receive payload, light = 1..6, entityId = HA entity. lightEntityMap: [ { room: 'light_livingRoom', light: 1, entityId: 'input_boolean.living_room_new' }, // { room: 'light_livingRoom', light: 2, entityId: 'input_boolean.living_room_2' }, // { room: 'l_kitchen', light: 1, entityId: 'input_boolean.kitchen_1' }, ], // HA entity_id substring (after domain.) without trailing _N → NVL room key. For HA to NVL. entityToRoom: { // living_room: 'livingRoom', living_room_new: 'cmd_livingroom', // kitchen: 'kitchen', // master_bedroom: 'masterBedroom', // bathroom: 'bathroom', // bedroom_1: 'bedroom_1', // bedroom_2: 'bedroom_2', // dinning_room: 'dinningRoom', // entrance: 'entrance', // hallway: 'hallway', // pantry: 'pantry', // guest_wc: 'guestWc', // out_veranda: 'outVeranda', // out_front: 'outFront', // out_back: 'outBack', // out_side: 'outSide', }, // Zigbee: friendly_name → single room (fallback when switchBindings missing). deviceToRoom: { 'Office Switch': 'cmd_livingroom', }, // When using a multi-device Zigbee node, payload is keyed by IEEE (e.g. 0xa4c138a5b9771b05). Map IEEE → friendly name so switchBindings by name still works. deviceIdToName: { // '0xa4c138a5b9771b05': 'Office Switch', // uncomment and add your device IEEE from the payload }, // Optional: bind by IEEE instead of friendly name (same shape as switchBindings). Use if the node never sends friendly_name. // switchBindingsByDeviceId: { // '0xa4c138a5b9771b05': { 1: { room: 'cmd_livingroom', light: 1 }, 2: { room: 'cmd_out', light: 2 } }, // }, /** * Which (room, light) each physical button controls. Key = button number (1..6), value = { room, light }. * Button and light are independent: e.g. button 2 can control light 1, or light 2 in another room. * One button can target one { room, light } or an array for multiple lights. */ switchBindings: { 'Office Switch': { 1: { room: 'cmd_livingroom', light: 1 }, // button 1 → light 1 2: { room: 'cmd_livingroom', light: 1 }, // button 2 → light 1 (same light; other switches could do button 2 → light 2) }, }, }; module.exports = ROOM_CONFIG;