Skip to content
/ cyd_HA Public

ESP32 CYD Touch Panel for Home Assistant - Multi-page display with weather, sensors, and 3D printer control

License

Notifications You must be signed in to change notification settings

gubas/cyd_HA

Repository files navigation

ESP32 CYD Home Assistant Touch Panel

Current version: v3.5

ESPHome Build

ESPHome Home Assistant

A smart touch panel to control Home Assistant using an ESP32-2432S028R (CYD - Cheap Yellow Display).

πŸ“‹ Features

  • Multi-page display: 3 screens with 8-second auto-cycling
    • Weather Page: Current conditions with animated weather icon, outdoor temperature, rain, wind, snow, frost, and real-time MΓ©tΓ©o-France alerts (yellow/orange/red vigilance)
    • 🌧️ Rain forecast: 9 colored rectangles showing minute-by-minute forecast (0–55 min) with intuitive color coding (empty=dry, light/medium/dark blue = light/moderate/heavy rain)
    • Sensors Page: Temperature and humidity from up to 4 zones in a 2x2 grid layout
    • Media Page: Now Playing (Artist & Title) with automatic text wrapping and dynamic layout
    • Dynamic Pagination: Dots indicator adjusts automatically (2/3/4 dots) based on active pages (Media/Printer hidden when unused)
    • Printer Page: Real-time BambuLab status (file, progress, nozzle/bed temps, remaining time)
  • Control menu: Touch-activated, 8 configurable buttons to control Home Assistant entities (covers, lights, 3D printer)
    • Clean interface without header to maximize button space
    • Visual feedback with colored icons (blue = active, grey = inactive)
    • Full internationalization (EN/FR/ES) via dedicated language files
  • Global header: Device name and date/time (DD/MM HH:MM) on data pages
  • Responsive touch interface: Precise detection with XPT2046 calibration
  • Secure connection: Encrypted API, password-protected OTA
  • Modular architecture: Configuration split into separate files for easy maintenance
  • Auto-return: Automatic return to display cycle after 10s menu inactivity

πŸ› οΈ Required Hardware

  • ESP32-2432S028R (Cheap Yellow Display)
    • ESP32 (240 MHz dual-core)
    • ILI9342 320x240 TFT display
    • XPT2046 touch controller
    • Built-in RGB LED
    • PWM backlight

πŸ“ Project Structure

cyd_HA/
β”œβ”€β”€ cyd_ha_refactored.yaml     # βœ… Main file (USE THIS)
β”œβ”€β”€ cyd_ha/                    # πŸ“‚ Module subfolder
β”‚   β”œβ”€β”€ substitutions.yaml     # βš™οΈ All user configuration
β”‚   β”œβ”€β”€ common.yaml            # 🎨 UI resources (fonts, colors, icons)
β”‚   β”œβ”€β”€ hardware.yaml          # πŸ”§ Hardware config (SPI, touch, outputs)
β”‚   β”œβ”€β”€ sensors.yaml           # πŸ“Š Home Assistant sensor integration
β”‚   β”œβ”€β”€ buttons.yaml           # πŸ”˜ Touch zone definitions
β”‚   β”œβ”€β”€ display_pages.yaml     # πŸ–₯️ UI rendering logic
β”‚   └── i18n/                  # 🌍 Language packs
β”‚       β”œβ”€β”€ en.yaml
β”‚       β”œβ”€β”€ fr.yaml
β”‚       └── es.yaml
β”œβ”€β”€ secrets.yaml               # πŸ” Credentials (shared across ESPHome projects)
β”œβ”€β”€ secrets.yaml.example       # πŸ“„ Secrets template
β”œβ”€β”€ materialdesignicons-webfont.ttf  # 🎨 Weather icon font
β”œβ”€β”€ CHANGELOG.md               # πŸ“ Version history
└── README.md                  # πŸ“– This file

πŸš€ Quick Start

1. Prerequisites

  • ESPHome installed
  • Working Home Assistant with API enabled
  • USB connection to ESP32

2. Configuration

a) Create secrets.yaml

Create secrets.yaml (can be shared across all ESPHome projects):

# Global WiFi (shared)
wifi_ssid: "YOUR_SSID"
wifi_password: "YOUR_WIFI_PASSWORD"

# Project-specific secrets (prefixed with "cyd_ha")
cyd_ha_api_encryption_key: "YOUR_API_KEY"
cyd_ha_ota_password: "YOUR_OTA_PASSWORD"
cyd_ha_ap_ssid: "CYD HA Fallback Hotspot"
cyd_ha_ap_password: "CHANGE_ME_12345"

b) Download Material Design Icons font

Download MaterialDesignIcons

c) Customize entities in cyd_ha/substitutions.yaml

All configuration is centralized in this file:

# ─── Device ──────────────────────────────────────────────────
device_name: cydhapanel
device_friendly_name: CYD HA Panel

# ─── Location ────────────────────────────────────────────────
location_name: Paris

# ─── Weather ─────────────────────────────────────────────────
weather_entity: weather.paris
rain_chance_entity: sensor.paris_rain_chance
# ... more entities

# ─── Media Player ────────────────────────────────────────────────────────────
media_player_entity: media_player.example

# ─── Sensor Blocks (up to 4) ─────────────────────────────────
sensor_bloc1_temp_entity: sensor.living_room_temperature
sensor_bloc1_hum_entity: sensor.living_room_humidity
sensor_bloc1_icon: hometemperature
# ... repeat for bloc2, bloc3, bloc4 (use sensor.none to disable)

# ─── Menu Buttons ────────────────────────────────────────────
btn1_service: cover.open_cover
btn1_entity: cover.living_room_blinds
# ... configure all 7 buttons

3. Flash

# Compile and upload
esphome run cyd_ha_refactored.yaml

Or use the helper script:

./esphome-build-upload.sh        # OTA upload
./esphome-build-upload.sh -u     # USB upload

🎨 Customization

Change colors

Edit cyd_ha/common.yaml:

color:
  - id: blue
    hex: 'F39621'  # Change this value (BGR format)

Add icons

  1. Find icon on Material Design Icons
  2. Add to cyd_ha/common.yaml:
image:
  - file: mdi:YOUR_ICON
    id: my_icon
    resize: 40x40
    type: BINARY

🌍 Localization (i18n)

The UI uses dedicated language packs.

Available packs: en.yaml, fr.yaml, es.yaml

Activate by uncommenting ONE line at the top of cyd_ha/substitutions.yaml:

<<: !include i18n/en.yaml     # ← English
# <<: !include i18n/fr.yaml
# <<: !include i18n/es.yaml

Translated keys:

  • Page titles: i18n_weather_title, i18n_sensors_title, i18n_printer_title
  • Menu buttons: btn1_label to btn8_label
  • Sensor blocks: sensor_bloc1_label to sensor_bloc4_label
  • Rain messages: i18n_next_rain_prefix, i18n_next_rain_none

πŸ› Troubleshooting

"Could not connect to WiFi"

  • Check secrets.yaml (correct SSID/password)
  • 5GHz WiFi is not supported (use 2.4GHz)

Touchscreen not responding

  • Adjust calibration in cyd_ha/hardware.yaml:
touchscreen:
  calibration:
    x_min: 280
    x_max: 3860
    y_min: 280
    y_max: 3860

Sensors show "--"

  • Verify entity_id in substitutions.yaml matches Home Assistant entities
  • Check API connection in Home Assistant

πŸ“Š Technical Architecture

Data Flow

Home Assistant API
        ↓
  cyd_ha/sensors.yaml (import entities)
        ↓
  cyd_ha/display_pages.yaml (rendering with 8s auto-cycle)
        ↓
    ESP32 Display (ILI9342 - 320x240, 90Β° rotation)

Pages & Navigation

Dynamic Pages with auto-cycling (8s):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Page 0: Weather                     β”‚
β”‚  - Large animated weather icon      β”‚
β”‚  - MΓ©tΓ©o-France alerts (πŸ”΄πŸŸ πŸŸ‘)     β”‚
β”‚  - Rain forecast: 9 colored bars    β”‚
β”‚  - "Next rain: X min" text          β”‚
β”‚  - Temp/Rain/Wind/Snow/Frost grid   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Page 1: Home Sensors                β”‚
β”‚  - 4 blocks in 2x2 grid             β”‚
β”‚  - Each: icon + label + temp + hum  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Page 2: BambuLab Printer            β”‚
β”‚  - Scrolling filename               β”‚
β”‚  - Progress bar with percentage     β”‚
β”‚  - Status / Time remaining / End    β”‚
β”‚  - Nozzle/Bed temperatures          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Touch anywhere β†’ 8-button menu (10s timeout)

πŸ“ Changelog

See CHANGELOG.md for version history.

🀝 Contributing

To improve this project:

  1. Test on your hardware
  2. Report bugs via issues
  3. Suggest improvements
  4. Share your custom configurations

πŸ“„ License

This project is licensed under the GNU General Public License v2.0. You are free to use, modify, and distribute this software under the terms of the GPL v2.

πŸ™ Acknowledgments

This project was inspired by the excellent tutorial from Aguacatec:

πŸ”— Resources


Made with ❀️ for the Home Assistant community

About

ESP32 CYD Touch Panel for Home Assistant - Multi-page display with weather, sensors, and 3D printer control

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages