infrapuzzle/esphome/README.md

49 lines
2.0 KiB
Markdown

# ESPHome Use-Cases & e-Paper Display
This directory contains ESPHome configuration files for various IoT and monitoring devices, using environment variables to keep credentials local and gitignored.
## Get Started
### 1. Configure Credentials
Copy `.env.template` to `.env` and fill in your Wi-Fi credentials:
```bash
cp .env.template .env
```
Inside `.env`, configure:
- `WIFI_SSID`: Your local Wi-Fi Name.
- `WIFI_PASSWORD`: Your local Wi-Fi Password.
### 2. Run the Flashing Wizard
Use the interactive Python script to flash your microcontroller:
```bash
uv run flash.py
```
This wizard will prompt you to:
1. Select which `.yaml` configuration file to use.
2. Select the command to run (such as `Run`, `Compile`, `Upload`, `Logs`, `Validate`, or `Clean`).
*Note: `uv run` handles the required dependencies (`questionary` and `python-dotenv`) automatically inside an isolated ephemeral environment, so there is no need to manually manage virtualenvs or pip installs.*
---
## Home Assistant Integration
The configurations in this directory connect directly to Home Assistant using the **ESPHome Native API**.
### Dynamic Sensor Subscriptions
Instead of pushing raw screens from Home Assistant, we pull the required entities dynamically into ESPHome's internal variables.
1. **Outdoor Temperature (`sensor.regensburg_regensburg_temperatur`)**:
Pulled automatically via the `homeassistant` platform sensor.
2. **Kitchen Temperature (`sensor.home_kuche_wandthermostat_temperature`)**:
Pulled automatically from the kitchen wall thermostat.
3. **Kitchen Message (`input_text.epaper_message`)**:
A Home Assistant `input_text` helper. When the state changes, Home Assistant pushes the new text to the display.
### Sending Messages from Command Line
You can push text warnings or messages directly to the display from the terminal using the helper script:
```bash
./send_message.sh "Your custom display message here"
```
This script reads the long-lived API token from the `k8s/home-assistant` secrets folder to authenticate against the Home Assistant API automatically.