Initial commit: CODESYS tree, integration docs, Node-RED scripts.

PLC application sources (NVL, rooms, boiler), HA/Node-RED integration guide, and NVL patch utilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-26 21:21:56 +03:00
commit d98c44bfa3
27 changed files with 3844 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
(* === DECLARATION === *)
TYPE struct_boiler_cmd :
STRUCT
// Control Commands
ha_on: BOOL; // Home Assistant: Turn ON
ha_off: BOOL; // Home Assistant: Turn OFF
schedule_on: BOOL; // Scheduled ON (from automation)
schedule_off: BOOL; // Scheduled OFF (from automation)
// Safety Input
emergency_stop: BOOL; // Emergency stop (physical button or HA)
// Configuration (can be set via Node-RED)
max_on_time_minutes: INT; // Maximum ON time in minutes (default: 480 = 8 hours)
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,22 @@
(* === DECLARATION === *)
TYPE struct_boiler_status :
STRUCT
// State
state: BOOL; // Current boiler state (ON/OFF)
relay_output: BOOL; // Actual relay output state
// Runtime Info
on_time_minutes: INT; // Current ON time in minutes
remaining_minutes: INT; // Remaining time before auto-shutoff
// Safety Status
emergency_active: BOOL; // Emergency stop is active
time_limit_reached: BOOL; // Max time limit was reached
// Error Handling
error_state: BOOL; // Error detected
error_code: INT; // Error code (0=none, 1=emergency, 2=time limit)
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,13 @@
(* === DECLARATION === *)
TYPE struct_lights:
STRUCT
l_1 : BOOL;
l_2 : BOOL;
l_3 : BOOL;
l_4 : BOOL;
l_5 : BOOL;
l_6 : BOOL;
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,32 @@
(* === DECLARATION === *)
TYPE struct_room_cmds :
STRUCT
// Home Assistant Commands (set/reset)
ha_l1_on: BOOL; // HA command: Light 1 ON
ha_l1_off: BOOL; // HA command: Light 1 OFF
ha_l2_on: BOOL;
ha_l2_off: BOOL;
ha_l3_on: BOOL;
ha_l3_off: BOOL;
ha_l4_on: BOOL;
ha_l4_off: BOOL;
ha_l5_on: BOOL;
ha_l5_off: BOOL;
ha_l6_on: BOOL;
ha_l6_off: BOOL;
// Zigbee Switch Inputs (edge detection for toggle)
zigbee_sw1: BOOL; // Zigbee switch 1 (edge detected)
zigbee_sw2: BOOL;
zigbee_sw3: BOOL;
zigbee_sw4: BOOL;
zigbee_sw5: BOOL;
zigbee_sw6: BOOL;
// Global Commands
ha_all_on: BOOL; // HA: All lights ON
ha_all_off: BOOL; // HA: All lights OFF
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,21 @@
(* === DECLARATION === *)
TYPE struct_room_outs :
STRUCT
l_1: BOOL; // Light 1 control output
l_2: BOOL; // Light 2 control output
l_3: BOOL; // Light 3 control output
l_4: BOOL; // Light 4 control output
l_5: BOOL; // Light 5 control output
l_6: BOOL; // Light 6 control output
// Status feedback (read from actual relay outputs)
l_1_status: BOOL; // Actual relay 1 state
l_2_status: BOOL; // Actual relay 2 state
l_3_status: BOOL; // Actual relay 3 state
l_4_status: BOOL; // Actual relay 4 state
l_5_status: BOOL; // Actual relay 5 state
l_6_status: BOOL; // Actual relay 6 state
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,15 @@
(* === DECLARATION === *)
TYPE struct_switches :
STRUCT
all_off:BOOL;
all_on:BOOL;
sw_1:BOOL;
sw_2:BOOL;
sw_3:BOOL;
sw_4:BOOL;
sw_5:BOOL;
sw_6:BOOL;
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)

View File

@@ -0,0 +1,23 @@
(* === DECLARATION === *)
TYPE struct_zones :
STRUCT
masterBedroom: struct_room_outs;
masterBathroom: struct_room_outs;
bedroom_1: struct_room_outs;
bedroom_2: struct_room_outs;
bathroom: struct_room_outs;
guest_wc: struct_room_outs;
kitchen: struct_room_outs;
pantry: struct_room_outs;
livingRoom: struct_room_outs;
diningRoom: struct_room_outs;
entrance: struct_room_outs;
hallway: struct_room_outs;
veranda: struct_room_outs;
front: struct_room_outs;
back: struct_room_outs;
side: struct_room_outs;
END_STRUCT
END_TYPE
(* === IMPLEMENTATION === *)