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.
This commit is contained in:
2026-04-01 19:09:59 +03:00
parent d755d3c1ed
commit 0af21f4dc3
16 changed files with 579 additions and 220 deletions

View File

@@ -0,0 +1,70 @@
# Uniform lighting naming rules
This project uses one canonical naming strategy for CODESYS, Node-RED, and Home Assistant.
## 1) Canonical token format
- All tokens are `snake_case`.
- Allowed chars: `a-z`, `0-9`, `_`.
- Normalize free text by:
- lowercasing
- trimming spaces
- replacing spaces and dashes with `_`
- collapsing repeated `_`
- applying typo fixes (`ktchen -> kitchen`, `guiest -> guest`, `wachine -> laundry`)
## 2) Canonical data columns
Source of truth is `lights_zones_canonical.csv` with:
- `circuit_no`
- `zone`
- `area`
- `room`
- `light_type`
- `index` (duplicate counter for same area+room+light_type)
- `light_no` (PLC light channel inside room, 1..6)
- `codesys_in_key`
- `codesys_out_key`
- `nodered_room_key`
- `ha_entity_id`
## 3) ID generation formulas
- `codesys_in_key` = `<area>_<room>`
- `codesys_out_key` = `l_<area>_<room>`
- `nodered_room_key` = `<area>_<room>`
- `ha_entity_id` = `input_boolean.<area>_<room>_<light_type>_<index>`
Examples:
- `input_boolean.open_plan_living_room_main_1`
- `open_plan_guest_wc`
- `l_master_bedroom_suite`
## 4) PLC mapping rule
- `light_no` maps to CODESYS `l_<N>` and Node-RED `light`:
- `light_no = 1` -> `l_1`
- `light_no = 2` -> `l_2`
- ...
- `light_no = 6` -> `l_6`
## 5) Reserved room keys used in this migration
- `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`