2.3 KiB
Entities
ArduinoHA supports these Home Assistant MQTT discovery entity classes. Choose the focused example where possible; it shows the entity's update or command callback pattern in a runnable sketch.
| Entity | Example |
|---|---|
| Binary sensor | binary-sensor |
| Button | button |
| Camera | esp32-cam |
| Cover | cover |
| Device tracker | Use the API header; no dedicated sketch yet |
| Device trigger | multi-state-button |
| Fan | fan |
| HVAC | hvac |
| Light | light |
| Lock | lock |
| Number | number |
| Scene | scene |
| Select | select |
| Sensor | sensor, sensor-analog, or sensor-integer |
| Switch | led-switch or multi-switch |
| Tag scanner | tag-scanner |
| Text | Use the API header; no dedicated sketch yet |
The library does not currently implement alarm control panels, events, humidifiers, images, lawn mowers, sirens, updates, vacuums, valves, or water heaters. They cannot be enabled through configuration.
Common lifecycle
Create long-lived HADevice, HAMqtt, and entity objects, then call mqtt.begin(...) once and mqtt.loop() regularly. Entities may be constructed before or after HAMqtt; both orders register safely. Read Getting started for the connection flow and device discovery for discovery settings.
For shared online/offline state, use device.enableSharedAvailability() and device.enableLastWill() before connecting. The availability examples show the simplest setup, while advanced availability covers custom payloads and Last Will behaviour.
Back to the documentation map.