Files

2.4 KiB

ArduinoHA examples

Start with a guided PlatformIO project when you are new to the library. Each one builds for ESP8266 and ESP32, contains safe placeholder credentials, and explains the Home Assistant result you should see.

pio run -d examples/01-esp-sensor -e esp8266
pio run -d examples/01-esp-sensor -e esp8266 -t upload

The checked-in esp32 environment uses Arduino-ESP32 3.3.11. A consuming application should choose and pin its complete PlatformIO platform stack.

Guided example What it demonstrates
ESP Sensor Wi-Fi application wiring, a unique device ID, and changing numeric telemetry
Switch Callback A Home Assistant command callback and local state acknowledgement
Multi-entity Device Multiple entities, shared availability, and MQTT Last Will
Device Discovery One device-discovery document for a newly deployed device

Entity recipes

The original focused sketches remain useful as short API recipes. They are intentionally transport-specific Arduino sketches, rather than full product firmware.

Recipe Home Assistant behaviour
binary-sensor Door/contact-style binary state
button Press action
cover Open, close, and stop commands
esp32-cam ESP32 camera preview
fan State and speed commands
hvac Modes, power, and target temperature
led-switch Basic writable switch
light Brightness, colour temperature, and RGB
lock Writable lock state
multi-state-button Device triggers from a wall switch
multi-switch Multiple writable switches
number Writable numeric value
scene Scene trigger
select Writable option list
sensor String state sensor
sensor-analog Analog voltage measurement
sensor-integer Integer uptime measurement
tag-scanner RFID tag reporting

See the entity guide and project overview.