# Quick Reference Guide

## System Overview

- **Control System**: CODESYS on Raspberry Pi
- **Automation**: Node-RED
- **Message Bus**: MQTT (LXC container)
- **Zigbee Bridge**: Zigbee2MQTT
- **Dashboard**: Home Assistant

## Quick Access

### Service URLs

- **Home Assistant**: [To be filled]
- **Node-RED**: [To be filled]
- **Zigbee2MQTT**: [To be filled]
- **MQTT Broker**: [To be filled]

### Important IPs

- **Raspberry Pi (CODESYS)**: [To be filled]
- **MQTT Broker**: [To be filled]

### Important Ports

- **MQTT**: 1883 (or 8883 for TLS)
- **Node-RED**: [To be filled]
- **Home Assistant**: [To be filled]

## Common Tasks

### Restart Services

```bash
# MQTT Broker (LXC)
lxc restart [container-name]

# Node-RED
systemctl restart nodered

# Home Assistant
[Command to restart]

# Zigbee2MQTT
[Command to restart]
```

### Check Service Status

```bash
# MQTT
mosquitto_sub -h [broker-ip] -t '#' -v

# Node-RED
[Command]

# Home Assistant
[Command]
```

### View Logs

- **Node-RED**: [Location]
- **Home Assistant**: [Location]
- **Zigbee2MQTT**: [Location]
- **MQTT**: [Location]

## MQTT Topics

### Key Topics

- `zigbee2mqtt/[device]/set` - Control Zigbee device
- `zigbee2mqtt/[device]` - Device state
- `codesys/[variable]` - CODESYS variables
- `homeassistant/[entity]` - Home Assistant entities

## Device Control

### Control Light via MQTT

```bash
mosquitto_pub -h [broker-ip] -t "zigbee2mqtt/[switch-name]/set" -m '{"state": "ON"}'
```

### Control Relay via CODESYS

[Instructions]

## Troubleshooting Quick Fixes

### Light Not Responding

1. Check Zigbee device status in Zigbee2MQTT
2. Verify MQTT message flow
3. Check Node-RED flow
4. Verify CODESYS network variable
5. Check relay state

### MQTT Connection Issues

1. Verify broker is running
2. Check network connectivity
3. Verify credentials
4. Check firewall rules

### CODESYS Not Communicating

1. Check network variables configuration
2. Verify Node-RED connection
3. Check CODESYS runtime status

## Emergency Procedures

### Manual Override

[How to manually control devices if automation fails]

### System Reset

[Procedure for resetting the system]

---

**Status**: Template - needs actual values and commands
