A HomeKit-enabled automatic generator controller for ESP32 that monitors grid power and manages generator operations. Built with HomeSpan.
- HomeKit integration for remote monitoring and control
- Three operating modes:
- Auto Mode: Automatically starts generator on grid failure
- Manual Mode: Manual generator control
- Off Mode: Completely disables generator
- Real-time status updates in Apple Home app
- Grid power monitoring with configurable delays
- Intelligent generator start sequence with choke control
- Transfer switch management
- Multiple start attempts with configurable retry logic
- Safe mode switching with proper shutdown sequences
- Serial monitor status reporting
- ESP32 development board
- HomeSpan library
- Arduino IDE
- Apple HomeKit compatible device
- Generator with:
- Electric start
- Choke control
- Transfer switch
- Running status sensor
Required connections:
- Grid Monitor Pin (32): Connect to grid power sensor (LOW = power present)
- Generator Monitor Pin (33): Connect to generator running sensor (HIGH = running)
- Generator Power Pin (25): Controls main generator power (LOW = ON)
- Generator Choke Pin (26): Controls generator choke (LOW = ON)
- Generator Starter Pin (27): Controls starter motor (LOW = ON)
- Transfer Switch Pin (14): Controls transfer switch (LOW = ON)
- Install HomeSpan library in Arduino IDE
- Clone or download this repository
- Edit config.h with your settings:
- WiFi credentials
- HomeKit pairing code
- Timing adjustments if needed
- GPIO pin configuration
- Upload to your ESP32
- Monitors grid power status
- On grid failure:
- Confirms outage (10s delay)
- Starts generator
- Manages choke
- Engages transfer switch
- On grid restoration:
- Confirms stable power (10s delay)
- Disables transfer switch
- Stops generator
- Starts generator on demand
- Manages choke sequence
- Controls transfer switch
- Provides safe shutdown
- Safely shuts down generator
- Disables transfer switch
- Prevents automatic operation
- Appears as three switches in Apple Home:
- Auto Mode Switch
- Manual Mode Switch
- Off Mode Switch
- Only one mode active at a time
- Real-time status updates
- Remote control capability
- Grid power confirmation delays
- Multiple start attempt protection (3 attempts max)
- Safe mode switching
- Proper shutdown sequences
- Transfer switch safety delays
- Choke control management
- Immediate stop on mode change
Commands:
- 's': Display current status Output includes:
- Mode changes
- Grid status
- Generator state
- Start/stop sequences
- Error conditions
-
Generator won't start
- Check pin connections
- Verify power connections
- Check serial output for errors
- Ensure proper timing settings
-
HomeKit not connecting
- Verify WiFi credentials
- Check HomeKit code
- Reset ESP32
- Check network connectivity
-
Mode changes not updating
- Check WiFi connection
- Monitor serial output
- Verify HomeKit connectivity
- Fork the repository
- Create feature branch
- Submit pull request
- HomeSpan library: HomeSpan on GitHub
- Developed by: Manuel Duarte
- Version: 1.0.0