mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 12:55:46 +01:00
add SUB_BINARY_SENSOR macro (#4447)
This commit is contained in:
parent
66eecd3675
commit
77db8c8401
@ -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.
|
/** Base class for all binary_sensor-type classes.
|
||||||
*
|
*
|
||||||
* This class includes a callback that components such as MQTT can subscribe to for state changes.
|
* This class includes a callback that components such as MQTT can subscribe to for state changes.
|
||||||
|
Loading…
Reference in New Issue
Block a user