ESPHome  2024.10.2
custom_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <vector>
7 
8 namespace esphome {
9 namespace custom {
10 
12  public:
13  CustomSensorConstructor(const std::function<std::vector<sensor::Sensor *>()> &init) { this->sensors_ = init(); }
14 
15  sensor::Sensor *get_sensor(int i) { return this->sensors_[i]; }
16 
17  void dump_config() override;
18 
19  protected:
20  std::vector<sensor::Sensor *> sensors_;
21 };
22 
23 } // namespace custom
24 } // namespace esphome
CustomSensorConstructor(const std::function< std::vector< sensor::Sensor *>()> &init)
Definition: custom_sensor.h:13
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void init()
Definition: core.cpp:80
std::vector< sensor::Sensor * > sensors_
Definition: custom_sensor.h:20
Base-class for all sensors.
Definition: sensor.h:57