26 std::uint32_t
key = 0;
27 std::vector<UserServiceArg>
args;
38 std::vector<std::int32_t>,
40 std::vector<std::string>>;
55 execute(std::uint32_t key,
const std::vector<ServiceValue>& args,
bool return_response =
false);
57 [[nodiscard]]
const std::vector<UserService>&
services() const noexcept {
63 std::vector<UserService> services_;
64 std::uint32_t next_call_id_ = 1;
Async client for a single device.
Definition client.hpp:38
Discovers user-defined services and invokes them.
Definition home_assistant_services.hpp:43
void on_service(ServiceHandler handler)
Register a callback fired for each ListEntitiesServicesResponse (call before list_entities()).
std::function< void(const UserService &)> ServiceHandler
Definition home_assistant_services.hpp:45
HomeAssistantServices(Client &client)
Definition home_assistant_services.hpp:47
void execute(std::uint32_t key, const std::vector< ServiceValue > &args, bool return_response=false)
Invoke a service by key with positional arguments.
const std::vector< UserService > & services() const noexcept
Definition home_assistant_services.hpp:57
Shared base for the subsystems exposed by Client (log streaming, the various proxies,...
Definition subsystem.hpp:18
Typed mirrors of the ESPHome protobuf enums.
std::variant< bool, std::int32_t, float, std::string, std::vector< bool >, std::vector< std::int32_t >, std::vector< float >, std::vector< std::string > > ServiceValue
A value passed to a service invocation.
Definition home_assistant_services.hpp:40
SupportsResponseType
Mirror of proto enum SupportsResponseType.
Definition enums.hpp:123
ServiceArgType
Mirror of proto enum ServiceArgType.
Definition enums.hpp:111
One argument of a user-defined service.
Definition home_assistant_services.hpp:18
ServiceArgType type
Definition home_assistant_services.hpp:20
std::string name
Definition home_assistant_services.hpp:19
A user-defined service advertised by the device (api: api.services).
Definition home_assistant_services.hpp:24
std::uint32_t key
Definition home_assistant_services.hpp:26
SupportsResponseType supports_response
Definition home_assistant_services.hpp:28
std::vector< UserServiceArg > args
Definition home_assistant_services.hpp:27
std::string name
Definition home_assistant_services.hpp:25
Common base for the Client-owned subsystems.