mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 21:23:53 +01:00
climate: add on_control callbacks (#4511)
This lets downstream components respond to climate configuration changes, which take place through ClimateCall objects, without also being notified every time the state changes, which happens every time the input sensor announces a new value. FIXES https://github.com/esphome/feature-requests/issues/2136
This commit is contained in:
committed by
GitHub
parent
3773c385c7
commit
05ab49a615
@@ -219,6 +219,14 @@ class Climate : public EntityBase {
|
||||
*/
|
||||
void add_on_state_callback(std::function<void()> &&callback);
|
||||
|
||||
/**
|
||||
* Add a callback for the climate device configuration; each time the configuration parameters of a climate device
|
||||
* is updated (using perform() of a ClimateCall), this callback will be called, before any on_state callback.
|
||||
*
|
||||
* @param callback The callback to call.
|
||||
*/
|
||||
void add_on_control_callback(std::function<void()> &&callback);
|
||||
|
||||
/** Make a climate device control call, this is used to control the climate device, see the ClimateCall description
|
||||
* for more info.
|
||||
* @return A new ClimateCall instance targeting this climate device.
|
||||
@@ -285,6 +293,7 @@ class Climate : public EntityBase {
|
||||
void dump_traits_(const char *tag);
|
||||
|
||||
CallbackManager<void()> state_callback_{};
|
||||
CallbackManager<void()> control_callback_{};
|
||||
ESPPreferenceObject rtc_;
|
||||
optional<float> visual_min_temperature_override_{};
|
||||
optional<float> visual_max_temperature_override_{};
|
||||
|
||||
Reference in New Issue
Block a user