# reTerminal E1004

## Overview

The reTerminal E1004 is a 13.3" **6-colour (Spectra 6)** e-paper display mounted in the **kuchyň (kitchen)**. It is the household's central family dashboard: a colour calendar/agenda on the left, and a stacked column of live information on the right (weather, home &amp; outdoor climate, upcoming family celebrations, waste-collection schedule, solar/car batteries, and a weekly temperature chart).

It is the colour companion to the **E1001** (mono weather display in the living room) and shares the same icon language, footer style, and refresh philosophy.

<table id="bkmrk-property-value-model"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody><tr><td>Model</td><td>Seeed reTerminal E1004 (13.3" Spectra 6 colour e-paper)</td></tr><tr><td>Resolution</td><td>1200 × 1600, portrait</td></tr><tr><td>Colours</td><td>Black, white, red, green, blue, yellow (6-colour palette)</td></tr><tr><td>Panel model (ESPHome)</td><td>`Seeed-reTerminal-E1004`</td></tr><tr><td>MCU</td><td>ESP32-S3 with 8 MB PSRAM (octal, 80 MHz)</td></tr><tr><td>Power</td><td>Permanently powered (deep sleep disabled)</td></tr><tr><td>Location</td><td>Kuchyň (kitchen)</td></tr><tr><td>Firmware</td><td>ESPHome</td></tr><tr><td>Flashing</td><td>Wireless (OTA)</td></tr></tbody></table>

---

## Data flow

<div drawio-diagram="15"><img src="https://bs.sevcik.tech/uploads/images/drawio/2026-08/drawing-1-1787169129.png" alt=""/></div>

---

## What it displays

### Header

- Full Czech day name + date (e.g. *"Pondělí 17.08.2026"*)
- Today's Czech name-day (*svátek*) on the right

### Left column – Agenda

- Upcoming calendar events grouped by day (Czech day labels: Po, Út, St…)
- Event titles **colour-coded by calendar**: green = Family, red = Naďa a Pavel
- Time or "Celý den" (all-day) below each event
- Multi-day events show "· do DD.MM"
- **Long titles are truncated with "…"** so they don't overflow into the right column

### Right column (top to bottom)

1. **Blíží se** – next 3 upcoming family celebrations (birthdays with age, and name-days). Red = birthday, green = name-day. Twins Daniel &amp; Dominik are combined onto one birthday line.
2. **Svoz odpadu** – next collection date per waste type: BIO (leaf), Papír (newspaper), Plast (bottle), Směsný (bin) — each with a coloured icon.
3. **Baterie** – FVE (home solar) % with a house icon, Tesla % with a car icon.
4. **Doma / Venku** – indoor and outdoor temperature + humidity, with thermometer and droplet icons.
5. **Počasí** – 6-day forecast with colour weather icons (red sun, blue rain, clouds) and high/low temps.
6. **Týden** – a 6-day high-temperature bar chart, bars colour-coded (red ≥ 28°, blue ≤ 18°, black otherwise).

### Footer

- **Aktualizováno HH:MM** – last refresh time
- **WiFi** signal strength bars

---

## Home Assistant sensors that power it

These are custom template sensors built in `configuration.yaml`:

<table id="bkmrk-sensor-purpose-senso"><thead><tr><th>Sensor</th><th>Purpose</th></tr></thead><tbody><tr><td>`sensor.svatek_dnes`</td><td>Today's Czech name-day, from an embedded 366-day table</td></tr><tr><td>`sensor.rodina_oslavy`</td><td>Family birthdays + name-days; `state` = today's celebrations, `upcoming` attribute = next celebrations (JSON)</td></tr><tr><td>`sensor.svoz_odpadu`</td><td>Scans both calendars for BIO/PAPÍR/PLAST/SMĚSNÝ keywords; attributes `bio`,`papir`,`plast`,`smesny` hold the next date per type</td></tr><tr><td>`sensor.forecast_day_0..5_*`</td><td>Per-day condition / temp / templow</td></tr><tr><td>`sensor.forecast_week`</td><td>Weekly highs as a pipe-separated string (`Po:26</td></tr><tr><td>`sensor.e1004_event_1..10`</td><td>Per-event agenda data (title, day label, time, colour)</td></tr><tr><td>Ecowitt climate sensors</td><td>Indoor/outdoor temperature &amp; humidity</td></tr><tr><td>`sensor.solax_battery_capacity_2`</td><td>FVE battery %</td></tr><tr><td>`sensor.tesla_model_y_battery`</td><td>Tesla battery %</td></tr></tbody></table>

---

## Refresh behaviour

```mermaid
flowchart TD
    A["Calendar event changes"] -->|instant, debounced 8s| R["request_redraw script"]
    B["5-minute interval"] --> D["Display refresh"]
    C["Manual button in HA"] --> D
    R --> D
    D --> S["Redraw e-paper"]

```

- **Every 5 minutes** – scheduled refresh (keeps weather, climate, batteries current)
- **Calendar event change** – triggers the debounced redraw (new events appear promptly)
- **Manual button** – `button.reterminal_e1004_e1004_refresh_display`
- Temperature/weather changes do **not** trigger refreshes directly (they ride the 5-minute interval), to avoid constant flashing.

---

## Key lessons learned (build history)

- **String vs float sensors:** several HA-attribute sensors return **strings** (e.g. "17.8.", family lines). These must be defined as `text_sensor` in ESPHome, not numeric `sensor`. Mixing them up caused compile errors (`.c_str()` on a float) and a firmware that never built — so the device kept running old firmware.
- **`to_json` spacing:** an early approach passed data as JSON attributes and parsed it on-device; HA's `to_json` adds spaces after colons (`"d": 17`), which broke a strict parser. Solved by switching to simple pre-formatted string attributes (`bio`, `papir`, …) instead of JSON.
- **Entity name typos:** `forecast_dayN` vs `forecast_day_N` (missing underscore) and `run__state` (double underscore, unrelated washer bug) both caused silent failures. Lesson: verify entity IDs against **Developer Tools → States**.
- **MDI codepoints:** several icon glyphs were initially wrong (cake, party-popper, night) and rendered as empty boxes — codepoints must be verified against the actual font.
- **Yellow on white is unreadable** on e-paper: the "sunny" icon was switched from yellow to **red** for contrast.
- **Refresh discipline:** the display only redraws on meaningful changes + a 5-minute interval, because colour e-paper refresh is slow and visually distracting.

---

## Configuration reference

> **Sanitised.** The real config contains an API encryption key, an OTA password, and WiFi credentials. **These secrets are NOT included here** — see the password manager. Full config stored at \[link to your config location\].

```yaml
# ── reTerminal E1004 (excerpt, secrets removed) ──
esphome:
  name: reterminal-e1004

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

psram:
  mode: octal
  speed: 80MHz

spi:
  clk_pin: GPIO7
  mosi_pin: GPIO9

# Secrets removed – see password manager:
#   api / ota / wifi

display:
  - platform: epaper_spi
    model: Seeed-reTerminal-E1004
    update_interval: never       # driven by interval + triggers instead
    rotation: 0
    # lambda: two-column layout (agenda left, info column right)

interval:
  - interval: 5min
    then:
      - component.update: epaper_display

button:
  - platform: template
    name: "E1004 Refresh Display"
    on_press:
      then:
        - component.update: epaper_display

```