mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 20:53:26 +02:00
23 lines
523 B
C++
23 lines
523 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/switch/switch.h"
|
|
|
|
namespace esphome {
|
|
namespace custom {
|
|
|
|
class CustomSwitchConstructor : public Component {
|
|
public:
|
|
CustomSwitchConstructor(const std::function<std::vector<switch_::Switch *>()> &init) { this->switches_ = init(); }
|
|
|
|
switch_::Switch *get_switch(int i) { return this->switches_[i]; }
|
|
|
|
void dump_config() override;
|
|
|
|
protected:
|
|
std::vector<switch_::Switch *> switches_;
|
|
};
|
|
|
|
} // namespace custom
|
|
} // namespace esphome
|