This repository contains ESPHome YAML configuration files for remote devices and sensors, specifically designed for AC (Air Conditioning) control using ESP32 boards with OLED displays.
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Assistant. This repository serves as a centralized location for managing ESPHome device configurations for AC remote control devices.
esphome_remote/
├── README.md # This file
└── devices/
└── oled_remote/
├── oled_remote.yaml # Main OLED AC remote configuration
├── oled_remote_battery.yaml # Battery-powered variant
└── ac_entities.h # C++ header for AC entities
- ESP32 development board (Lolin D32 or compatible)
- ESPHome installed (
pip install esphome) - Home Assistant instance with API access
- OLED display (SSD1306/SH1106 128x64)
-
Copy the main configuration file to your ESPHome device directory:
cp devices/oled_remote/oled_remote.yaml /path/to/esphome/your_device_name.yaml
-
Edit the substitutions section at the top of the YAML file. You only need to change:
DEVICE_NAME: Your unique device name (lowercase, use underscores)FRIENDLY_NAME: Human-readable device nameAPI_KEY: Your Home Assistant API encryption key
Example:
substitutions: BOARD: "esp32dev" # Leave unchanged for Lolin board DEVICE_NAME: "bedroom-ac-remote" # Change this FRIENDLY_NAME: "Bedroom AC Remote" # Change this API_KEY: "your_api_encryption_key_here" # Change this PIN_WAKE: "0" # Leave unchanged for Lolin board PIN_I2C_SDA: "27" # Leave unchanged for Lolin board PIN_I2C_SCL: "25" # Leave unchanged for Lolin board PIN_BTN_CONTRAST: "32" # Leave unchanged for Lolin board PIN_BTN_SWITCH_AC: "14" # Leave unchanged for Lolin board PIN_BTN_TOGGLE: "26" # Leave unchanged for Lolin board PIN_BTN_FAN: "33" # Leave unchanged for Lolin board PIN_BTN_MODE: "22" # Leave unchanged for Lolin board PIN_BTN_TEMP_UP: "23" # Leave unchanged for Lolin board PIN_BTN_TEMP_DOWN: "19" # Leave unchanged for Lolin board
-
Configure WiFi credentials in your ESPHome secrets:
- Create or edit your
secrets.yamlfile in your ESPHome directory - Add your WiFi credentials:
wifi_ssid: "YourWiFiName" wifi_password: "YourWiFiPassword"
- Create or edit your
-
Update AC entities (if needed):
- Edit
ac_entities.hto match your Home Assistant climate entities - The default configuration includes: Living Room, Office, and Bedroom AC units
- Edit
-
Compile and upload to your ESP32:
esphome run your_device_name.yaml
If you're using the ESP32 Lolin or compatible board, DO NOT change the pin configuration. The pins are already optimized for this hardware:
- I2C pins (SDA: GPIO27, SCL: GPIO25) - for OLED display
- Button pins - pre-configured for the physical button layout
- Wake pin (GPIO0) - for deep sleep functionality
Only change the pins if you're using a different board or custom hardware layout.
Must customize:
DEVICE_NAME- Make it unique for each deviceFRIENDLY_NAME- Descriptive name for Home AssistantAPI_KEY- Your Home Assistant API encryption key
Optional customization:
- WiFi power settings (if signal issues occur)
- Deep sleep duration (default: 3 days)
- Idle timeout (default: 2 minutes)
- Display contrast settings
- AC entity IDs in
ac_entities.h
Leave unchanged (for Lolin board):
BOARDsetting- All
PIN_*configurations - I2C frequency and settings
- Display model and configuration
To get your Home Assistant API encryption key:
-
Generate a new key using ESPHome:
esphome wizard temp.yaml
Or manually generate one:
python3 -c "import secrets; print(secrets.token_hex(32))" -
Use this key in your
substitutionssection -
Add the device to Home Assistant using this same key
- ESP32 Lolin development board
- SH1106 128x64 OLED display (I2C)
- Push buttons (7 total for full functionality)
- Optional: Battery for portable operation (see
oled_remote_battery.yaml)
- Wake/Power (GPIO0) - Turn on/off the remote
- Contrast (GPIO32) - Adjust display brightness
- Switch AC (GPIO14) - Cycle between different AC units
- Toggle (GPIO26) - Turn AC on/off
- Fan (GPIO33) - Change fan speed
- Mode (GPIO22) - Switch AC mode (cool/fan/dry)
- Temp Up (GPIO23) - Increase temperature
- Temp Down (GPIO19) - Decrease temperature
- Multi-AC Control: Control multiple AC units from one device
- Deep Sleep: Battery-efficient operation with automatic sleep
- OLED Display: Real-time status display with custom fonts
- Button Interface: Physical buttons for all common operations
- Home Assistant Integration: Full API integration with encryption
- Auto-sync: Automatically syncs with Home Assistant AC states
- Verify WiFi credentials in
secrets.yaml - Check WiFi signal strength
- Try increasing
output_powerin the WiFi section
- Verify I2C pin connections (SDA: GPIO27, SCL: GPIO25)
- Check display model in configuration (SH1106 vs SSD1306)
- Verify display I2C address (default: 0x3C)
- Check pin assignments match your hardware
- Verify pull-up resistor configuration
- Test with a multimeter for button continuity
- Verify API key matches in both ESPHome and Home Assistant
- Check Home Assistant is accessible from ESP32 network
- Ensure firewall allows API connections
Feel free to submit issues and enhancement requests!
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the ESPHome documentation
- Review the Home Assistant Climate integration
- Open an issue in this repository