mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Add macro for sub sensor defining (#4315)
This commit is contained in:
parent
e4ca3b18cc
commit
f2eafa8fbe
1 changed files with 7 additions and 0 deletions
|
@ -31,6 +31,13 @@ namespace sensor {
|
|||
} \
|
||||
}
|
||||
|
||||
#define SUB_SENSOR(name) \
|
||||
protected: \
|
||||
sensor::Sensor *name##_sensor_{nullptr}; \
|
||||
\
|
||||
public: \
|
||||
void set_##name##_sensor(sensor::Sensor *sensor) { this->name##_sensor_ = sensor; }
|
||||
|
||||
/**
|
||||
* Sensor state classes
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue