ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
user_services.cpp
Go to the documentation of this file.
1#include "user_services.h"
2#include "esphome/core/log.h"
3
4namespace esphome::api {
5
6template<> bool get_execute_arg_value<bool>(const ExecuteServiceArgument &arg) { return arg.bool_; }
8 if (arg.legacy_int != 0)
9 return arg.legacy_int;
10 return arg.int_;
11}
12template<> float get_execute_arg_value<float>(const ExecuteServiceArgument &arg) { return arg.float_; }
13template<> std::string get_execute_arg_value<std::string>(const ExecuteServiceArgument &arg) { return arg.string_; }
14template<> std::vector<bool> get_execute_arg_value<std::vector<bool>>(const ExecuteServiceArgument &arg) {
15 return arg.bool_array;
16}
17template<> std::vector<int32_t> get_execute_arg_value<std::vector<int32_t>>(const ExecuteServiceArgument &arg) {
18 return arg.int_array;
19}
20template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) {
21 return arg.float_array;
22}
23template<> std::vector<std::string> get_execute_arg_value<std::vector<std::string>>(const ExecuteServiceArgument &arg) {
24 return arg.string_array;
25}
26
41
42} // namespace esphome::api
@ SERVICE_ARG_TYPE_BOOL_ARRAY
Definition api_pb2.h:72
@ SERVICE_ARG_TYPE_STRING_ARRAY
Definition api_pb2.h:75
@ SERVICE_ARG_TYPE_FLOAT_ARRAY
Definition api_pb2.h:74
float get_execute_arg_value< float >(const ExecuteServiceArgument &arg)
bool get_execute_arg_value< bool >(const ExecuteServiceArgument &arg)
int32_t get_execute_arg_value< int32_t >(const ExecuteServiceArgument &arg)
enums::ServiceArgType to_service_arg_type()
enums::ServiceArgType to_service_arg_type< int32_t >()
enums::ServiceArgType to_service_arg_type< bool >()
enums::ServiceArgType to_service_arg_type< std::string >()
std::string get_execute_arg_value< std::string >(const ExecuteServiceArgument &arg)
T get_execute_arg_value(const ExecuteServiceArgument &arg)
enums::ServiceArgType to_service_arg_type< float >()