Synchronous, single-threaded client.
More...
#include <sync_client.hpp>
Synchronous, single-threaded client.
Construct, connect(), issue blocking requests, then disconnect(). Not thread-safe.
◆ SyncClient()
| esphome::api::SyncClient::SyncClient |
( |
const ClientOptions & |
options | ) |
|
|
explicit |
◆ async()
| Client & esphome::api::SyncClient::async |
( |
| ) |
|
|
inline |
Access the underlying async client (register handlers, send raw, etc.).
◆ bluetooth()
◆ connect()
| void esphome::api::SyncClient::connect |
( |
| ) |
const |
◆ device_info()
| DeviceInfo esphome::api::SyncClient::device_info |
( |
| ) |
const |
Request the device's DeviceInfoResponse and return it as a typed struct.
◆ disconnect()
| void esphome::api::SyncClient::disconnect |
( |
| ) |
const |
Gracefully disconnect, blocking briefly for the close to settle.
◆ entities()
Object-oriented view of the discovered entities: entities().switches(), entities().light("ceiling").turn_on(), etc.
◆ home_assistant()
◆ is_connected()
| bool esphome::api::SyncClient::is_connected |
( |
| ) |
const |
|
inline |
◆ list_entities()
| void esphome::api::SyncClient::list_entities |
( |
| ) |
const |
Request the full entity list and block until ListEntitiesDoneResponse.
The entities are available afterwards via entities().
◆ logs()
| LogStream & esphome::api::SyncClient::logs |
( |
| ) |
|
|
inline |
◆ pump_until()
| void esphome::api::SyncClient::pump_until |
( |
const std::function< bool()> & |
predicate, |
|
|
std::chrono::milliseconds |
timeout |
|
) |
| const |
Pump the loop until predicate is true or timeout elapses.
Exposed for building custom blocking request/response flows on top of async().
◆ serial()
◆ serial_proxy() [1/2]
| SerialPort esphome::api::SyncClient::serial_proxy |
( |
const std::string & |
name | ) |
|
Serial-proxy handle by advertised name.
Fetches device info on first use to resolve the name; throws ApiError if the name is unknown.
◆ serial_proxy() [2/2]
| SerialPort esphome::api::SyncClient::serial_proxy |
( |
std::uint32_t |
instance | ) |
|
Instance-bound serial-proxy handle: sync.serial_proxy(0).write(...).
◆ server_hello()
| const ServerHello & esphome::api::SyncClient::server_hello |
( |
| ) |
const |
|
inline |
◆ set_request_timeout()
| void esphome::api::SyncClient::set_request_timeout |
( |
const std::chrono::milliseconds |
timeout | ) |
|
|
inline |
Default per-request deadline (does not apply to connect, which uses the connection's own handshake timeout).
◆ state()
◆ store() [1/2]
| const EntityStore & esphome::api::SyncClient::store |
( |
| ) |
const |
|
inlinenoexcept |
◆ store() [2/2]
The underlying entity store (raw typed info/state access).
◆ subscribe_states()
| void esphome::api::SyncClient::subscribe_states |
( |
| ) |
const |
Subscribe to live state updates.
They are applied to entities() as the loop is pumped (e.g. inside pump_until or run_for on the async client).
◆ voice()
◆ zwave()
The documentation for this class was generated from the following file: