add SUB_BINARY_SENSOR macro (#4447)

This commit is contained in:
Regev Brody 2023-02-19 21:11:21 +02:00 committed by GitHub
parent 66eecd3675
commit 77db8c8401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.