mirror of
https://github.com/esphome/esphome.git
synced 2024-11-09 16:57:47 +01:00
add SUB_BINARY_SENSOR macro (#4447)
This commit is contained in:
parent
66eecd3675
commit
77db8c8401
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,15 @@ namespace binary_sensor {
|
|||
} \
|
||||
}
|
||||
|
||||
#define SUB_BINARY_SENSOR(name) \
|
||||
protected: \
|
||||
binary_sensor::BinarySensor *name##_binary_sensor_{nullptr}; \
|
||||
\
|
||||
public: \
|
||||
void set_##name##_binary_sensor(binary_sensor::BinarySensor *binary_sensor) { \
|
||||
this->name##_binary_sensor_ = binary_sensor; \
|
||||
}
|
||||
|
||||
/** Base class for all binary_sensor-type classes.
|
||||
*
|
||||
* This class includes a callback that components such as MQTT can subscribe to for state changes.
|
||||
|
|
Loading…
Reference in a new issue