- Reorganized project: codesys/, docs/codesys|redesign|integration|reference/, scripts/ - CODESYS project and exports in codesys/ - Documentation index in docs/README.md - Redesign and light naming configuration - Water boiler control and safety design Co-authored-by: Cursor <cursoragent@cursor.com>
5.3 KiB
5.3 KiB
System Architecture
Overview
The home automation system uses a distributed architecture with multiple components communicating over network protocols.
Component Diagram
┌─────────────────────────────────────────────────────────────┐
│ Physical Layer │
├─────────────────────────────────────────────────────────────┤
│ Zigbee Switches │ Relays │ Water Boiler │ Lights │
└─────────────────────────────────────────────────────────────┘
│
│
┌─────────────────────────────────────────────────────────────┐
│ Control Layer │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ CODESYS │◄────►│ Node-RED │ │
│ │ (Raspberry │ │ │ │
│ │ Pi) │ │ │ │
│ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │
│ │ │ │
│ ┌──────▼───────┐ ┌──────▼───────┐ │
│ │ EtherCAT │ │ MQTT │ │
│ │ IO Card │ │ Broker │ │
│ └──────────────┘ │ (LXC) │ │
│ └──────┬───────┘ │
│ │ │
│ ┌──────▼───────┐ │
│ │ Zigbee2MQTT │ │
│ └──────┬───────┘ │
│ │ │
│ ┌──────▼───────┐ │
│ │ Home │ │
│ │ Assistant │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
Communication Flow
Light Switch Control Flow
- User Action: Physical Zigbee switch is pressed
- Zigbee2MQTT: Receives Zigbee message, converts to MQTT
- MQTT Broker: Routes message to subscribers
- Node-RED: Receives MQTT message, processes automation logic
- CODESYS: Node-RED sends network variable to CODESYS
- EtherCAT IO: CODESYS activates relay via EtherCAT
- Physical Device: Relay controls light
Water Boiler Control Flow
- Trigger: Time-based, sensor-based, or manual trigger
- Node-RED/Home Assistant: Processes automation logic
- CODESYS: Receives control command via network variable
- EtherCAT IO: CODESYS activates relay for boiler
- Water Boiler: Receives control signal
Protocols Used
- EtherCAT: Industrial communication between CODESYS and IO card
- MQTT: Message queuing for device communication
- Zigbee: Wireless mesh network for switches
- Network Variables: CODESYS to Node-RED communication
- HTTP/REST: Home Assistant API and Node-RED HTTP nodes
Data Flow
Inputs
- Zigbee switch states
- Sensor data (if applicable)
- Time-based triggers
- Manual commands from Home Assistant
Processing
- Node-RED flows for automation logic
- CODESYS control logic
- Home Assistant automations
Outputs
- Relay control signals
- Light states
- Water boiler control
- Dashboard updates
Security Considerations
- MQTT authentication (to be documented)
- Network isolation (to be documented)
- CODESYS access control (to be documented)
- Zigbee network security (to be documented)
Redundancy and Reliability
- Backup procedures
- Failover mechanisms
- Error recovery
- Monitoring and alerting
Status: Initial structure - needs detailed information to complete