|
esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
|
Optional JSON (de)serialization for the public value types. More...
Go to the source code of this file.
Optional JSON (de)serialization for the public value types.
This header is opt-in and dependency-light: it only does anything when <nlohmann/json.hpp> is available (auto-detected via __has_include, or forced with ESPHOME_API_WITH_JSON). It is intentionally not pulled in by <esphome/api/api.hpp>, so the core library never depends on nlohmann::json — include this header explicitly from a consumer (e.g. a CLI) that already links nlohmann::json to get ADL to_json / from_json for every type.
Only std::optional-free value types are covered here (all the info, state, device-info, discovery, log, Bluetooth and serial-proxy types). The command structs carry std::optional fields and are intentionally left out: a consumer that needs them can supply its own adl_serializer<std::optional>.