22 :
TemplatableValue<std::string, X...>([f](X...
x) -> std::string { return to_string(f(
x...)); }) {}
36 template<
typename T>
void set_service(T service) { this->service_ = service; }
38 template<
typename T>
void add_data(std::string key, T value) {
50 resp.
service = this->service_.value(
x...);
52 for (
auto &it : this->data_) {
55 kv.
value = it.value.value(
x...);
56 resp.
data.push_back(kv);
58 for (
auto &it : this->data_template_) {
61 kv.
value = it.value.value(
x...);
64 for (
auto &it : this->variables_) {
67 kv.
value = it.value.value(
x...);
70 this->parent_->send_homeassistant_service_call(resp);
std::string value(X... x)
void set_service(T service)
HomeAssistantServiceCallAction(APIServer *parent, bool is_event)
std::vector< TemplatableKeyValuePair< Ts... > > variables_
void play(Ts... x) override
void add_variable(std::string key, T value)
std::vector< TemplatableKeyValuePair< Ts... > > data_template_
void add_data(std::string key, T value)
void add_data_template(std::string key, T value)
std::vector< TemplatableKeyValuePair< Ts... > > data_
std::vector< HomeassistantServiceMap > data_template
std::vector< HomeassistantServiceMap > data
std::vector< HomeassistantServiceMap > variables
TemplatableKeyValuePair(std::string key, T value)
TemplatableStringValue< Ts... > value
TemplatableStringValue(F value)
TemplatableStringValue(F f)
Providing packet encoding functions for exchanging data with a remote host.
typename std::enable_if< B, T >::type enable_if_t