feat: improve MQTT discovery publishing and examples

This commit is contained in:
2026-09-04 09:52:20 +10:00
parent 7f28604887
commit 35b375b497
28 changed files with 696 additions and 153 deletions
+7 -9
View File
@@ -1,14 +1,12 @@
# Documentation
User-facing notes for this library. API details live in the headers under [`src/`](../src/).
# ArduinoHA documentation
| Topic | What it covers |
| ----- | ---------------- |
| [Getting started](getting-started.md) | Prerequisites, installing the library, minimal sketches |
| [Device & discovery](device-and-discovery.md) | `HADevice`, MQTT connection, discovery prefixes, entity IDs |
| [MQTT usage](mqtt-usage.md) | Callbacks, custom topics, availability, compiler flags |
| [Entities](entities.md) | Supported Home Assistant entity classes and example selection |
| [Examples](../examples/README.md) | Curated paths through the standalone sketches |
| [Getting started](getting-started.md) | Connecting a `Client`, installing the library, and the first MQTT lifecycle |
| [Device & discovery](device-and-discovery.md) | `HADevice`, discovery modes, metadata, identifiers, and migration |
| [MQTT usage](mqtt-usage.md) | Callbacks, custom topics, availability, logging, and footprint flags |
| [Entities](entities.md) | Supported Home Assistant entity classes and the best matching example |
| [Examples](../examples/README.md) | Guided PlatformIO projects and focused entity recipes |
| [Compatibility baseline](compatibility.md) | Supported Home Assistant capabilities and fork-specific compatibility notes |
Class-level API details live in headers under [`src/`](../src/). Return to the [project overview](../README.md).
| [Compatibility baseline](compatibility.md) | Audited upstream/HA targets and deliberate exclusions |
+2 -2
View File
@@ -140,9 +140,9 @@ public:
};
```
`arduinoHALog(...)` and `arduinoHALogf(...)` support subsystem-tagged messages such as `mqtt`, `discovery`, `availability`, `serializer`, `entity`, and `device`. `DeviceFramework` installs a structured sink so ArduinoHA messages follow the same main log stream as the rest of the firmware.
`arduinoHALog(...)` and `arduinoHALogf(...)` support subsystem-tagged messages such as `mqtt`, `discovery`, `availability`, `serializer`, `entity`, and `device`. Install a sink when you want those messages to join your application’s normal serial or structured log stream.
Optional transport context for diagnostics (registered automatically by **DeviceFramework**): **`arduinoHASetNetworkStatusFn`** (for example returning `WiFi.status()` so publish failure lines can include `wifi=`).
Applications that use Wi-Fi can register **`arduinoHASetNetworkStatusFn`** with a callback returning `WiFi.status()`. Publish failure diagnostics can then include the current Wi-Fi status without coupling ArduinoHA to a particular network library.
**Exclude unused device types** (saves flash from vtables), e.g.: