[api] Store YAML service names in flash instead of heap (#11744)

This commit is contained in:
J. Nick Koston
2025-11-06 15:31:59 +13:00
committed by GitHub
parent 5eea7bdb44
commit 83f30a64ed
4 changed files with 136 additions and 10 deletions
+2 -2
View File
@@ -9,11 +9,11 @@
namespace esphome::api {
#ifdef USE_API_SERVICES
template<typename T, typename... Ts> class CustomAPIDeviceService : public UserServiceBase<Ts...> {
template<typename T, typename... Ts> class CustomAPIDeviceService : public UserServiceDynamic<Ts...> {
public:
CustomAPIDeviceService(const std::string &name, const std::array<std::string, sizeof...(Ts)> &arg_names, T *obj,
void (T::*callback)(Ts...))
: UserServiceBase<Ts...>(name, arg_names), obj_(obj), callback_(callback) {}
: UserServiceDynamic<Ts...>(name, arg_names), obj_(obj), callback_(callback) {}
protected:
void execute(Ts... x) override { (this->obj_->*this->callback_)(x...); } // NOLINT