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:
42
docs/Electrical/Ligts_Zones.csv
Normal file
42
docs/Electrical/Ligts_Zones.csv
Normal file
@@ -0,0 +1,42 @@
|
||||
#,Zone,Area,Light
|
||||
1,L1,Open Plan,Living Room Main
|
||||
2,L1,Open Plan,Living Room Spots
|
||||
3,L1,Open Plan,Dining room Main
|
||||
4,L1,Open Plan,Dining room Spots
|
||||
5,L1,Open Plan,Entrance Mirror
|
||||
6,L1,Open Plan,Entrance Main
|
||||
7,L1,Open Plan,Guest WC Main
|
||||
8,L1,Open Plan,Guiest WC Strip
|
||||
9,L1,Open Plan,Guest WC Fan
|
||||
10,L1,Open Plan,Living Room Strip
|
||||
11,L1,Open Plan,Living Room Strip
|
||||
12,L2,Ktchen,Kitchen Main
|
||||
13,L2,Ktchen,Island
|
||||
14,L2,Ktchen,Kitchen Cabinets
|
||||
15,L2,Ktchen,Fridge
|
||||
16,L2,Ktchen,Pantry
|
||||
17,L3,Bedrooms,Office Main
|
||||
18,L3,Bedrooms,Office Strip
|
||||
19,L3,Bedrooms,Hallway
|
||||
20,L3,Bedrooms,Wachine Machine
|
||||
21,L3,Bedrooms,Shower spots
|
||||
22,L3,Bedrooms,Shower fan
|
||||
23,L3,Bedrooms,Bedroom Main
|
||||
24,L3,Bedrooms,Bedroom Spots
|
||||
25,L4,Master Bedroom,Main
|
||||
26,L4,Master Bedroom,Spots
|
||||
27,L4,Master Bedroom,Strip
|
||||
28,L4,Master Bedroom,Door
|
||||
29,L4,Master Bedroom,Dresser
|
||||
30,L4,Master Bedroom,bathroom spots
|
||||
31,L4,Master Bedroom,bathroom fan
|
||||
32,L5,Exterior,Veranda
|
||||
33,L5,Exterior,BBQ
|
||||
34,L5,Exterior,Entrance Door
|
||||
35,L5,Exterior,Front Lights
|
||||
36,L5,Exterior,backyard flood light 1
|
||||
37,L5,Exterior,backyard flood light 2
|
||||
38,L5,Exterior,Master Bedroom flood light
|
||||
39,L5,exterior,Driveway
|
||||
40,L5,,
|
||||
41,L5,,
|
||||
|
40
docs/Electrical/lights_zones_canonical.csv
Normal file
40
docs/Electrical/lights_zones_canonical.csv
Normal file
@@ -0,0 +1,40 @@
|
||||
circuit_no,zone,area,room,light_type,index,light_no,codesys_in_key,codesys_out_key,nodered_room_key,ha_entity_id,source_light_label
|
||||
1,l1,open_plan,living_room,main,1,1,open_plan_living_room,l_open_plan_living_room,open_plan_living_room,input_boolean.open_plan_living_room_main_1,Living Room Main
|
||||
2,l1,open_plan,living_room,spots,1,2,open_plan_living_room,l_open_plan_living_room,open_plan_living_room,input_boolean.open_plan_living_room_spots_1,Living Room Spots
|
||||
3,l1,open_plan,dining_room,main,1,1,open_plan_dining_room,l_open_plan_dining_room,open_plan_dining_room,input_boolean.open_plan_dining_room_main_1,Dining room Main
|
||||
4,l1,open_plan,dining_room,spots,1,2,open_plan_dining_room,l_open_plan_dining_room,open_plan_dining_room,input_boolean.open_plan_dining_room_spots_1,Dining room Spots
|
||||
5,l1,open_plan,entrance,mirror,1,1,open_plan_entrance,l_open_plan_entrance,open_plan_entrance,input_boolean.open_plan_entrance_mirror_1,Entrance Mirror
|
||||
6,l1,open_plan,entrance,main,1,2,open_plan_entrance,l_open_plan_entrance,open_plan_entrance,input_boolean.open_plan_entrance_main_1,Entrance Main
|
||||
7,l1,open_plan,guest_wc,main,1,1,open_plan_guest_wc,l_open_plan_guest_wc,open_plan_guest_wc,input_boolean.open_plan_guest_wc_main_1,Guest WC Main
|
||||
8,l1,open_plan,guest_wc,strip,1,2,open_plan_guest_wc,l_open_plan_guest_wc,open_plan_guest_wc,input_boolean.open_plan_guest_wc_strip_1,Guiest WC Strip
|
||||
9,l1,open_plan,guest_wc,fan,1,3,open_plan_guest_wc,l_open_plan_guest_wc,open_plan_guest_wc,input_boolean.open_plan_guest_wc_fan_1,Guest WC Fan
|
||||
10,l1,open_plan,living_room,strip,1,3,open_plan_living_room,l_open_plan_living_room,open_plan_living_room,input_boolean.open_plan_living_room_strip_1,Living Room Strip
|
||||
11,l1,open_plan,living_room,strip,2,4,open_plan_living_room,l_open_plan_living_room,open_plan_living_room,input_boolean.open_plan_living_room_strip_2,Living Room Strip
|
||||
12,l2,kitchen,kitchen,main,1,1,kitchen_kitchen,l_kitchen_kitchen,kitchen_kitchen,input_boolean.kitchen_kitchen_main_1,Kitchen Main
|
||||
13,l2,kitchen,kitchen,island,1,2,kitchen_kitchen,l_kitchen_kitchen,kitchen_kitchen,input_boolean.kitchen_kitchen_island_1,Island
|
||||
14,l2,kitchen,kitchen,cabinets,1,3,kitchen_kitchen,l_kitchen_kitchen,kitchen_kitchen,input_boolean.kitchen_kitchen_cabinets_1,Kitchen Cabinets
|
||||
15,l2,kitchen,kitchen,fridge,1,4,kitchen_kitchen,l_kitchen_kitchen,kitchen_kitchen,input_boolean.kitchen_kitchen_fridge_1,Fridge
|
||||
16,l2,kitchen,pantry,main,1,1,kitchen_pantry,l_kitchen_pantry,kitchen_pantry,input_boolean.kitchen_pantry_main_1,Pantry
|
||||
17,l3,bedrooms,office,main,1,1,bedrooms_office,l_bedrooms_office,bedrooms_office,input_boolean.bedrooms_office_main_1,Office Main
|
||||
18,l3,bedrooms,office,strip,1,2,bedrooms_office,l_bedrooms_office,bedrooms_office,input_boolean.bedrooms_office_strip_1,Office Strip
|
||||
19,l3,bedrooms,hallway,main,1,1,bedrooms_hallway,l_bedrooms_hallway,bedrooms_hallway,input_boolean.bedrooms_hallway_main_1,Hallway
|
||||
20,l3,bedrooms,laundry,main,1,1,bedrooms_laundry,l_bedrooms_laundry,bedrooms_laundry,input_boolean.bedrooms_laundry_main_1,Wachine Machine
|
||||
21,l3,bedrooms,shower,spots,1,1,bedrooms_shower,l_bedrooms_shower,bedrooms_shower,input_boolean.bedrooms_shower_spots_1,Shower spots
|
||||
22,l3,bedrooms,shower,fan,1,2,bedrooms_shower,l_bedrooms_shower,bedrooms_shower,input_boolean.bedrooms_shower_fan_1,Shower fan
|
||||
23,l3,bedrooms,bedroom,main,1,1,bedrooms_bedroom,l_bedrooms_bedroom,bedrooms_bedroom,input_boolean.bedrooms_bedroom_main_1,Bedroom Main
|
||||
24,l3,bedrooms,bedroom,spots,1,2,bedrooms_bedroom,l_bedrooms_bedroom,bedrooms_bedroom,input_boolean.bedrooms_bedroom_spots_1,Bedroom Spots
|
||||
25,l4,master_bedroom,suite,main,1,1,master_bedroom_suite,l_master_bedroom_suite,master_bedroom_suite,input_boolean.master_bedroom_suite_main_1,Main
|
||||
26,l4,master_bedroom,suite,spots,1,2,master_bedroom_suite,l_master_bedroom_suite,master_bedroom_suite,input_boolean.master_bedroom_suite_spots_1,Spots
|
||||
27,l4,master_bedroom,suite,strip,1,3,master_bedroom_suite,l_master_bedroom_suite,master_bedroom_suite,input_boolean.master_bedroom_suite_strip_1,Strip
|
||||
28,l4,master_bedroom,suite,door,1,4,master_bedroom_suite,l_master_bedroom_suite,master_bedroom_suite,input_boolean.master_bedroom_suite_door_1,Door
|
||||
29,l4,master_bedroom,suite,dresser,1,5,master_bedroom_suite,l_master_bedroom_suite,master_bedroom_suite,input_boolean.master_bedroom_suite_dresser_1,Dresser
|
||||
30,l4,master_bedroom,bathroom,spots,1,1,master_bedroom_bathroom,l_master_bedroom_bathroom,master_bedroom_bathroom,input_boolean.master_bedroom_bathroom_spots_1,bathroom spots
|
||||
31,l4,master_bedroom,bathroom,fan,1,2,master_bedroom_bathroom,l_master_bedroom_bathroom,master_bedroom_bathroom,input_boolean.master_bedroom_bathroom_fan_1,bathroom fan
|
||||
32,l5,exterior,veranda,main,1,1,exterior_veranda,l_exterior_veranda,exterior_veranda,input_boolean.exterior_veranda_main_1,Veranda
|
||||
33,l5,exterior,yard,bbq,1,1,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_bbq_1,BBQ
|
||||
34,l5,exterior,entrance,door,1,1,exterior_entrance,l_exterior_entrance,exterior_entrance,input_boolean.exterior_entrance_door_1,Entrance Door
|
||||
35,l5,exterior,yard,front_lights,1,2,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_front_lights_1,Front Lights
|
||||
36,l5,exterior,yard,backyard_flood_light,1,3,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_backyard_flood_light_1,backyard flood light 1
|
||||
37,l5,exterior,yard,backyard_flood_light,2,4,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_backyard_flood_light_2,backyard flood light 2
|
||||
38,l5,exterior,yard,master_bedroom_flood_light,1,5,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_master_bedroom_flood_light_1,Master Bedroom flood light
|
||||
39,l5,exterior,yard,driveway,1,6,exterior_yard,l_exterior_yard,exterior_yard,input_boolean.exterior_yard_driveway_1,Driveway
|
||||
|
40
docs/Electrical/lights_zones_cleaned.csv
Normal file
40
docs/Electrical/lights_zones_cleaned.csv
Normal file
@@ -0,0 +1,40 @@
|
||||
#,zone,area,light
|
||||
1,l1,open_plan,living_room_main
|
||||
2,l1,open_plan,living_room_spots
|
||||
3,l1,open_plan,dining_room_main
|
||||
4,l1,open_plan,dining_room_spots
|
||||
5,l1,open_plan,entrance_mirror
|
||||
6,l1,open_plan,entrance_main
|
||||
7,l1,open_plan,guest_wc_main
|
||||
8,l1,open_plan,guest_wc_strip
|
||||
9,l1,open_plan,guest_wc_fan
|
||||
10,l1,open_plan,living_room_strip
|
||||
11,l1,open_plan,living_room_strip
|
||||
12,l2,kitchen,kitchen_main
|
||||
13,l2,kitchen,island
|
||||
14,l2,kitchen,kitchen_cabinets
|
||||
15,l2,kitchen,fridge
|
||||
16,l2,kitchen,pantry
|
||||
17,l3,bedrooms,office_main
|
||||
18,l3,bedrooms,office_strip
|
||||
19,l3,bedrooms,hallway
|
||||
20,l3,bedrooms,laundry
|
||||
21,l3,bedrooms,shower_spots
|
||||
22,l3,bedrooms,shower_fan
|
||||
23,l3,bedrooms,bedroom_main
|
||||
24,l3,bedrooms,bedroom_spots
|
||||
25,l4,master_bedroom,main
|
||||
26,l4,master_bedroom,spots
|
||||
27,l4,master_bedroom,strip
|
||||
28,l4,master_bedroom,door
|
||||
29,l4,master_bedroom,dresser
|
||||
30,l4,master_bedroom,bathroom_spots
|
||||
31,l4,master_bedroom,bathroom_fan
|
||||
32,l5,exterior,veranda
|
||||
33,l5,exterior,bbq
|
||||
34,l5,exterior,entrance_door
|
||||
35,l5,exterior,front_lights
|
||||
36,l5,exterior,backyard_flood_light_1
|
||||
37,l5,exterior,backyard_flood_light_2
|
||||
38,l5,exterior,master_bedroom_flood_light
|
||||
39,l5,exterior,driveway
|
||||
|
70
docs/Electrical/naming_rules.md
Normal file
70
docs/Electrical/naming_rules.md
Normal 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`
|
||||
37
docs/Electrical/validation_report.md
Normal file
37
docs/Electrical/validation_report.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Validation report (uniform lighting naming migration)
|
||||
|
||||
## Static consistency checks completed
|
||||
|
||||
- Canonical lighting rows: `39` (`lights_zones_canonical.csv`)
|
||||
- CODESYS `NVL_In` room structs: `16`
|
||||
- CODESYS `NVL_Out` room structs: `16`
|
||||
- Node-RED `roomNames` entries: `16`
|
||||
- Node-RED `lightEntityMap` entries: `39`
|
||||
|
||||
## Mapping status
|
||||
|
||||
- `circuit_no -> area/room/type/index/light_no` is defined for all non-empty circuits.
|
||||
- `codesys_in_key` / `codesys_out_key` are defined for every canonical row.
|
||||
- `room-config.js` is aligned with canonical keys:
|
||||
- `roomNames` matches the 16-room CODESYS layout.
|
||||
- `lightEntityMap` has one entry per canonical row.
|
||||
- `entityToRoom` base keys map all canonical HA entity patterns.
|
||||
|
||||
## Verified constraints
|
||||
|
||||
- Canonical naming style: `snake_case`
|
||||
- Entity ID pattern: `input_boolean.<area>_<room>_<light_type>_<index>`
|
||||
- CODESYS legacy room names replaced in `codesys/src` runtime files:
|
||||
- `GVL_NVL_placeholders.gvl`
|
||||
- `GVL_IO.gvl`
|
||||
- `PLC_App.st`
|
||||
|
||||
## Residual runtime checks to perform on target system
|
||||
|
||||
Because this repository environment has no runtime binaries for Node-RED/CODESYS/HA validation, perform these on your deployed setup:
|
||||
|
||||
1. Deploy updated CODESYS project and confirm NVL sender/receiver symbol binding still resolves.
|
||||
2. Load updated `/root/.node-red/room-config.js` and redeploy flows.
|
||||
3. Import HA helpers from `lights_by_area_room_type_index.yaml`.
|
||||
4. Test one circuit per area end-to-end:
|
||||
- HA toggle -> Node-RED -> NVL_In -> PLC output -> NVL_Out -> HA sync.
|
||||
Reference in New Issue
Block a user