mirror of
https://github.com/esphome/esphome.git
synced 2025-09-16 18:22:22 +01:00
climate triggers Climate and ClimateCall references (#5028)
This commit is contained in:
@@ -7,6 +7,7 @@ namespace climate {
|
||||
static const char *const TAG = "climate";
|
||||
|
||||
void ClimateCall::perform() {
|
||||
this->parent_->control_callback_.call(*this);
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->mode_.has_value()) {
|
||||
@@ -44,7 +45,6 @@ void ClimateCall::perform() {
|
||||
if (this->target_temperature_high_.has_value()) {
|
||||
ESP_LOGD(TAG, " Target Temperature High: %.2f", *this->target_temperature_high_);
|
||||
}
|
||||
this->parent_->control_callback_.call();
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
void ClimateCall::validate_() {
|
||||
@@ -300,11 +300,11 @@ ClimateCall &ClimateCall::set_swing_mode(optional<ClimateSwingMode> swing_mode)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Climate::add_on_state_callback(std::function<void()> &&callback) {
|
||||
void Climate::add_on_state_callback(std::function<void(Climate &)> &&callback) {
|
||||
this->state_callback_.add(std::move(callback));
|
||||
}
|
||||
|
||||
void Climate::add_on_control_callback(std::function<void()> &&callback) {
|
||||
void Climate::add_on_control_callback(std::function<void(ClimateCall &)> &&callback) {
|
||||
this->control_callback_.add(std::move(callback));
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ void Climate::publish_state() {
|
||||
}
|
||||
|
||||
// Send state to frontend
|
||||
this->state_callback_.call();
|
||||
this->state_callback_.call(*this);
|
||||
// Save state
|
||||
this->save_state_();
|
||||
}
|
||||
|
Reference in New Issue
Block a user