mirror of
https://github.com/esphome/esphome.git
synced 2026-09-03 19:46:02 +00:00
[core] Move entity state publish and setting logs to VERBOSE level
Benchmarking in #15034 showed that esp_log_printf and vsnprintf_chk dominate sensor publish time (95%+ of internal_send_state_to_frontend). At the default DEBUG log level, every state change generates log output that overwhelms the log output making it hard to actually debug and wastes significant CPU time on string formatting. Move all entity state publish (>>) and setting logs from ESP_LOGD to ESP_LOGV across all base entity types: sensor, binary_sensor, switch, number, text_sensor, select, text, event, lock, cover, valve, climate, fan, light, media_player, alarm_control_panel, datetime, update, and water_heater.
This commit is contained in:
@@ -31,7 +31,7 @@ void AlarmControlPanel::publish_state(AlarmControlPanelState state) {
|
||||
this->last_update_ = millis();
|
||||
if (state != this->current_state_) {
|
||||
auto prev_state = this->current_state_;
|
||||
ESP_LOGD(TAG, "'%s' >> %s (was %s)", this->get_name().c_str(),
|
||||
ESP_LOGV(TAG, "'%s' >> %s (was %s)", this->get_name().c_str(),
|
||||
LOG_STR_ARG(alarm_control_panel_state_to_string(state)),
|
||||
LOG_STR_ARG(alarm_control_panel_state_to_string(prev_state)));
|
||||
this->current_state_ = state;
|
||||
|
||||
@@ -45,7 +45,7 @@ bool BinarySensor::set_new_state(const optional<bool> &new_state) {
|
||||
#if defined(USE_BINARY_SENSOR) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_binary_sensor_update(this);
|
||||
#endif
|
||||
ESP_LOGD(TAG, "'%s' >> %s", this->get_name().c_str(), ONOFFMAYBE(new_state));
|
||||
ESP_LOGV(TAG, "'%s' >> %s", this->get_name().c_str(), ONOFFMAYBE(new_state));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -46,45 +46,45 @@ constexpr StringToUint8 CLIMATE_SWING_MODES_BY_STR[] = {
|
||||
|
||||
void ClimateCall::perform() {
|
||||
this->parent_->control_callback_.call(*this);
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->mode_.has_value()) {
|
||||
const LogString *mode_s = climate_mode_to_string(*this->mode_);
|
||||
ESP_LOGD(TAG, " Mode: %s", LOG_STR_ARG(mode_s));
|
||||
ESP_LOGV(TAG, " Mode: %s", LOG_STR_ARG(mode_s));
|
||||
}
|
||||
if (this->custom_fan_mode_ != nullptr) {
|
||||
this->fan_mode_.reset();
|
||||
ESP_LOGD(TAG, " Custom Fan: %s", this->custom_fan_mode_);
|
||||
ESP_LOGV(TAG, " Custom Fan: %s", this->custom_fan_mode_);
|
||||
}
|
||||
if (this->fan_mode_.has_value()) {
|
||||
this->custom_fan_mode_ = nullptr;
|
||||
const LogString *fan_mode_s = climate_fan_mode_to_string(*this->fan_mode_);
|
||||
ESP_LOGD(TAG, " Fan: %s", LOG_STR_ARG(fan_mode_s));
|
||||
ESP_LOGV(TAG, " Fan: %s", LOG_STR_ARG(fan_mode_s));
|
||||
}
|
||||
if (this->custom_preset_ != nullptr) {
|
||||
this->preset_.reset();
|
||||
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset_);
|
||||
ESP_LOGV(TAG, " Custom Preset: %s", this->custom_preset_);
|
||||
}
|
||||
if (this->preset_.has_value()) {
|
||||
this->custom_preset_ = nullptr;
|
||||
const LogString *preset_s = climate_preset_to_string(*this->preset_);
|
||||
ESP_LOGD(TAG, " Preset: %s", LOG_STR_ARG(preset_s));
|
||||
ESP_LOGV(TAG, " Preset: %s", LOG_STR_ARG(preset_s));
|
||||
}
|
||||
if (this->swing_mode_.has_value()) {
|
||||
const LogString *swing_mode_s = climate_swing_mode_to_string(*this->swing_mode_);
|
||||
ESP_LOGD(TAG, " Swing: %s", LOG_STR_ARG(swing_mode_s));
|
||||
ESP_LOGV(TAG, " Swing: %s", LOG_STR_ARG(swing_mode_s));
|
||||
}
|
||||
if (this->target_temperature_.has_value()) {
|
||||
ESP_LOGD(TAG, " Target Temperature: %.2f", *this->target_temperature_);
|
||||
ESP_LOGV(TAG, " Target Temperature: %.2f", *this->target_temperature_);
|
||||
}
|
||||
if (this->target_temperature_low_.has_value()) {
|
||||
ESP_LOGD(TAG, " Target Temperature Low: %.2f", *this->target_temperature_low_);
|
||||
ESP_LOGV(TAG, " Target Temperature Low: %.2f", *this->target_temperature_low_);
|
||||
}
|
||||
if (this->target_temperature_high_.has_value()) {
|
||||
ESP_LOGD(TAG, " Target Temperature High: %.2f", *this->target_temperature_high_);
|
||||
ESP_LOGV(TAG, " Target Temperature High: %.2f", *this->target_temperature_high_);
|
||||
}
|
||||
if (this->target_humidity_.has_value()) {
|
||||
ESP_LOGD(TAG, " Target Humidity: %.0f", *this->target_humidity_);
|
||||
ESP_LOGV(TAG, " Target Humidity: %.0f", *this->target_humidity_);
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
@@ -435,43 +435,43 @@ void Climate::save_state_() {
|
||||
}
|
||||
|
||||
void Climate::publish_state() {
|
||||
ESP_LOGD(TAG, "'%s' >>", this->name_.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >>", this->name_.c_str());
|
||||
auto traits = this->get_traits();
|
||||
|
||||
ESP_LOGD(TAG, " Mode: %s", LOG_STR_ARG(climate_mode_to_string(this->mode)));
|
||||
ESP_LOGV(TAG, " Mode: %s", LOG_STR_ARG(climate_mode_to_string(this->mode)));
|
||||
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION)) {
|
||||
ESP_LOGD(TAG, " Action: %s", LOG_STR_ARG(climate_action_to_string(this->action)));
|
||||
ESP_LOGV(TAG, " Action: %s", LOG_STR_ARG(climate_action_to_string(this->action)));
|
||||
}
|
||||
if (traits.get_supports_fan_modes() && this->fan_mode.has_value()) {
|
||||
ESP_LOGD(TAG, " Fan Mode: %s", LOG_STR_ARG(climate_fan_mode_to_string(this->fan_mode.value())));
|
||||
ESP_LOGV(TAG, " Fan Mode: %s", LOG_STR_ARG(climate_fan_mode_to_string(this->fan_mode.value())));
|
||||
}
|
||||
if (!traits.get_supported_custom_fan_modes().empty() && this->has_custom_fan_mode()) {
|
||||
ESP_LOGD(TAG, " Custom Fan Mode: %s", this->custom_fan_mode_);
|
||||
ESP_LOGV(TAG, " Custom Fan Mode: %s", this->custom_fan_mode_);
|
||||
}
|
||||
if (traits.get_supports_presets() && this->preset.has_value()) {
|
||||
ESP_LOGD(TAG, " Preset: %s", LOG_STR_ARG(climate_preset_to_string(this->preset.value())));
|
||||
ESP_LOGV(TAG, " Preset: %s", LOG_STR_ARG(climate_preset_to_string(this->preset.value())));
|
||||
}
|
||||
if (!traits.get_supported_custom_presets().empty() && this->has_custom_preset()) {
|
||||
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset_);
|
||||
ESP_LOGV(TAG, " Custom Preset: %s", this->custom_preset_);
|
||||
}
|
||||
if (traits.get_supports_swing_modes()) {
|
||||
ESP_LOGD(TAG, " Swing Mode: %s", LOG_STR_ARG(climate_swing_mode_to_string(this->swing_mode)));
|
||||
ESP_LOGV(TAG, " Swing Mode: %s", LOG_STR_ARG(climate_swing_mode_to_string(this->swing_mode)));
|
||||
}
|
||||
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)) {
|
||||
ESP_LOGD(TAG, " Current Temperature: %.2f°C", this->current_temperature);
|
||||
ESP_LOGV(TAG, " Current Temperature: %.2f°C", this->current_temperature);
|
||||
}
|
||||
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
|
||||
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
|
||||
ESP_LOGD(TAG, " Target Temperature: Low: %.2f°C High: %.2f°C", this->target_temperature_low,
|
||||
ESP_LOGV(TAG, " Target Temperature: Low: %.2f°C High: %.2f°C", this->target_temperature_low,
|
||||
this->target_temperature_high);
|
||||
} else {
|
||||
ESP_LOGD(TAG, " Target Temperature: %.2f°C", this->target_temperature);
|
||||
ESP_LOGV(TAG, " Target Temperature: %.2f°C", this->target_temperature);
|
||||
}
|
||||
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY)) {
|
||||
ESP_LOGD(TAG, " Current Humidity: %.0f%%", this->current_humidity);
|
||||
ESP_LOGV(TAG, " Current Humidity: %.0f%%", this->current_humidity);
|
||||
}
|
||||
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
|
||||
ESP_LOGD(TAG, " Target Humidity: %.0f%%", this->target_humidity);
|
||||
ESP_LOGV(TAG, " Target Humidity: %.0f%%", this->target_humidity);
|
||||
}
|
||||
|
||||
// Send state to frontend
|
||||
|
||||
@@ -68,24 +68,24 @@ CoverCall &CoverCall::set_tilt(float tilt) {
|
||||
return *this;
|
||||
}
|
||||
void CoverCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
auto traits = this->parent_->get_traits();
|
||||
this->validate_();
|
||||
if (this->stop_) {
|
||||
ESP_LOGD(TAG, " Command: STOP");
|
||||
ESP_LOGV(TAG, " Command: STOP");
|
||||
}
|
||||
if (this->position_.has_value()) {
|
||||
if (traits.get_supports_position()) {
|
||||
ESP_LOGD(TAG, " Position: %.0f%%", *this->position_ * 100.0f);
|
||||
ESP_LOGV(TAG, " Position: %.0f%%", *this->position_ * 100.0f);
|
||||
} else {
|
||||
ESP_LOGD(TAG, " Command: %s", LOG_STR_ARG(cover_command_to_str(*this->position_)));
|
||||
ESP_LOGV(TAG, " Command: %s", LOG_STR_ARG(cover_command_to_str(*this->position_)));
|
||||
}
|
||||
}
|
||||
if (this->tilt_.has_value()) {
|
||||
ESP_LOGD(TAG, " Tilt: %.0f%%", *this->tilt_ * 100.0f);
|
||||
ESP_LOGV(TAG, " Tilt: %.0f%%", *this->tilt_ * 100.0f);
|
||||
}
|
||||
if (this->toggle_.has_value()) {
|
||||
ESP_LOGD(TAG, " Command: TOGGLE");
|
||||
ESP_LOGV(TAG, " Command: TOGGLE");
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
@@ -143,23 +143,23 @@ void Cover::publish_state(bool save) {
|
||||
this->position = clamp(this->position, 0.0f, 1.0f);
|
||||
this->tilt = clamp(this->tilt, 0.0f, 1.0f);
|
||||
|
||||
ESP_LOGD(TAG, "'%s' >>", this->name_.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >>", this->name_.c_str());
|
||||
auto traits = this->get_traits();
|
||||
if (traits.get_supports_position()) {
|
||||
ESP_LOGD(TAG, " Position: %.0f%%", this->position * 100.0f);
|
||||
ESP_LOGV(TAG, " Position: %.0f%%", this->position * 100.0f);
|
||||
} else {
|
||||
if (this->position == COVER_OPEN) {
|
||||
ESP_LOGD(TAG, " State: OPEN");
|
||||
ESP_LOGV(TAG, " State: OPEN");
|
||||
} else if (this->position == COVER_CLOSED) {
|
||||
ESP_LOGD(TAG, " State: CLOSED");
|
||||
ESP_LOGV(TAG, " State: CLOSED");
|
||||
} else {
|
||||
ESP_LOGD(TAG, " State: UNKNOWN");
|
||||
ESP_LOGV(TAG, " State: UNKNOWN");
|
||||
}
|
||||
}
|
||||
if (traits.get_supports_tilt()) {
|
||||
ESP_LOGD(TAG, " Tilt: %.0f%%", this->tilt * 100.0f);
|
||||
ESP_LOGV(TAG, " Tilt: %.0f%%", this->tilt * 100.0f);
|
||||
}
|
||||
ESP_LOGD(TAG, " Current Operation: %s", LOG_STR_ARG(cover_operation_to_str(this->current_operation)));
|
||||
ESP_LOGV(TAG, " Current Operation: %s", LOG_STR_ARG(cover_operation_to_str(this->current_operation)));
|
||||
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_COVER) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
@@ -30,7 +30,7 @@ void DateEntity::publish_state() {
|
||||
return;
|
||||
}
|
||||
this->set_has_state(true);
|
||||
ESP_LOGD(TAG, "'%s' >> %d-%d-%d", this->get_name().c_str(), this->year_, this->month_, this->day_);
|
||||
ESP_LOGV(TAG, "'%s' >> %d-%d-%d", this->get_name().c_str(), this->year_, this->month_, this->day_);
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_DATETIME_DATE) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_date_update(this);
|
||||
@@ -83,16 +83,16 @@ void DateCall::validate_() {
|
||||
|
||||
void DateCall::perform() {
|
||||
this->validate_();
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
|
||||
if (this->year_.has_value()) {
|
||||
ESP_LOGD(TAG, " Year: %d", *this->year_);
|
||||
ESP_LOGV(TAG, " Year: %d", *this->year_);
|
||||
}
|
||||
if (this->month_.has_value()) {
|
||||
ESP_LOGD(TAG, " Month: %d", *this->month_);
|
||||
ESP_LOGV(TAG, " Month: %d", *this->month_);
|
||||
}
|
||||
if (this->day_.has_value()) {
|
||||
ESP_LOGD(TAG, " Day: %d", *this->day_);
|
||||
ESP_LOGV(TAG, " Day: %d", *this->day_);
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void DateTimeEntity::publish_state() {
|
||||
return;
|
||||
}
|
||||
this->set_has_state(true);
|
||||
ESP_LOGD(TAG, "'%s' >> %04u-%02u-%02u %02d:%02d:%02d", this->get_name().c_str(), this->year_, this->month_,
|
||||
ESP_LOGV(TAG, "'%s' >> %04u-%02u-%02u %02d:%02d:%02d", this->get_name().c_str(), this->year_, this->month_,
|
||||
this->day_, this->hour_, this->minute_, this->second_);
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_DATETIME_DATETIME) && defined(USE_CONTROLLER_REGISTRY)
|
||||
@@ -127,25 +127,25 @@ void DateTimeCall::validate_() {
|
||||
|
||||
void DateTimeCall::perform() {
|
||||
this->validate_();
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
|
||||
if (this->year_.has_value()) {
|
||||
ESP_LOGD(TAG, " Year: %d", *this->year_);
|
||||
ESP_LOGV(TAG, " Year: %d", *this->year_);
|
||||
}
|
||||
if (this->month_.has_value()) {
|
||||
ESP_LOGD(TAG, " Month: %d", *this->month_);
|
||||
ESP_LOGV(TAG, " Month: %d", *this->month_);
|
||||
}
|
||||
if (this->day_.has_value()) {
|
||||
ESP_LOGD(TAG, " Day: %d", *this->day_);
|
||||
ESP_LOGV(TAG, " Day: %d", *this->day_);
|
||||
}
|
||||
if (this->hour_.has_value()) {
|
||||
ESP_LOGD(TAG, " Hour: %d", *this->hour_);
|
||||
ESP_LOGV(TAG, " Hour: %d", *this->hour_);
|
||||
}
|
||||
if (this->minute_.has_value()) {
|
||||
ESP_LOGD(TAG, " Minute: %d", *this->minute_);
|
||||
ESP_LOGV(TAG, " Minute: %d", *this->minute_);
|
||||
}
|
||||
if (this->second_.has_value()) {
|
||||
ESP_LOGD(TAG, " Second: %d", *this->second_);
|
||||
ESP_LOGV(TAG, " Second: %d", *this->second_);
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void TimeEntity::publish_state() {
|
||||
return;
|
||||
}
|
||||
this->set_has_state(true);
|
||||
ESP_LOGD(TAG, "'%s' >> %02d:%02d:%02d", this->get_name().c_str(), this->hour_, this->minute_, this->second_);
|
||||
ESP_LOGV(TAG, "'%s' >> %02d:%02d:%02d", this->get_name().c_str(), this->hour_, this->minute_, this->second_);
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_DATETIME_TIME) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_time_update(this);
|
||||
@@ -52,15 +52,15 @@ void TimeCall::validate_() {
|
||||
|
||||
void TimeCall::perform() {
|
||||
this->validate_();
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
if (this->hour_.has_value()) {
|
||||
ESP_LOGD(TAG, " Hour: %d", *this->hour_);
|
||||
ESP_LOGV(TAG, " Hour: %d", *this->hour_);
|
||||
}
|
||||
if (this->minute_.has_value()) {
|
||||
ESP_LOGD(TAG, " Minute: %d", *this->minute_);
|
||||
ESP_LOGV(TAG, " Minute: %d", *this->minute_);
|
||||
}
|
||||
if (this->second_.has_value()) {
|
||||
ESP_LOGD(TAG, " Second: %d", *this->second_);
|
||||
ESP_LOGV(TAG, " Second: %d", *this->second_);
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void Event::trigger(const std::string &event_type) {
|
||||
return;
|
||||
}
|
||||
this->last_event_type_ = found;
|
||||
ESP_LOGD(TAG, "'%s' >> '%s'", this->get_name().c_str(), this->last_event_type_);
|
||||
ESP_LOGV(TAG, "'%s' >> '%s'", this->get_name().c_str(), this->last_event_type_);
|
||||
this->event_callback_.call(StringRef(found));
|
||||
#if defined(USE_EVENT) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_event(this);
|
||||
|
||||
@@ -44,22 +44,22 @@ FanCall &FanCall::set_preset_mode(const char *preset_mode, size_t len) {
|
||||
}
|
||||
|
||||
void FanCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting:", this->parent_.get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting:", this->parent_.get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->binary_state_.has_value()) {
|
||||
ESP_LOGD(TAG, " State: %s", ONOFF(*this->binary_state_));
|
||||
ESP_LOGV(TAG, " State: %s", ONOFF(*this->binary_state_));
|
||||
}
|
||||
if (this->oscillating_.has_value()) {
|
||||
ESP_LOGD(TAG, " Oscillating: %s", YESNO(*this->oscillating_));
|
||||
ESP_LOGV(TAG, " Oscillating: %s", YESNO(*this->oscillating_));
|
||||
}
|
||||
if (this->speed_.has_value()) {
|
||||
ESP_LOGD(TAG, " Speed: %d", *this->speed_);
|
||||
ESP_LOGV(TAG, " Speed: %d", *this->speed_);
|
||||
}
|
||||
if (this->direction_.has_value()) {
|
||||
ESP_LOGD(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(*this->direction_)));
|
||||
ESP_LOGV(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(*this->direction_)));
|
||||
}
|
||||
if (this->preset_mode_ != nullptr) {
|
||||
ESP_LOGD(TAG, " Preset Mode: %s", this->preset_mode_);
|
||||
ESP_LOGV(TAG, " Preset Mode: %s", this->preset_mode_);
|
||||
}
|
||||
this->parent_.control(*this);
|
||||
}
|
||||
@@ -196,21 +196,21 @@ void Fan::apply_preset_mode_(const FanCall &call) {
|
||||
void Fan::publish_state() {
|
||||
auto traits = this->get_traits();
|
||||
|
||||
ESP_LOGD(TAG,
|
||||
ESP_LOGV(TAG,
|
||||
"'%s' >>\n"
|
||||
" State: %s",
|
||||
this->name_.c_str(), ONOFF(this->state));
|
||||
if (traits.supports_speed()) {
|
||||
ESP_LOGD(TAG, " Speed: %d", this->speed);
|
||||
ESP_LOGV(TAG, " Speed: %d", this->speed);
|
||||
}
|
||||
if (traits.supports_oscillation()) {
|
||||
ESP_LOGD(TAG, " Oscillating: %s", YESNO(this->oscillating));
|
||||
ESP_LOGV(TAG, " Oscillating: %s", YESNO(this->oscillating));
|
||||
}
|
||||
if (traits.supports_direction()) {
|
||||
ESP_LOGD(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(this->direction)));
|
||||
ESP_LOGV(TAG, " Direction: %s", LOG_STR_ARG(fan_direction_to_string(this->direction)));
|
||||
}
|
||||
if (this->preset_mode_ != nullptr) {
|
||||
ESP_LOGD(TAG, " Preset Mode: %s", this->preset_mode_);
|
||||
ESP_LOGV(TAG, " Preset Mode: %s", this->preset_mode_);
|
||||
}
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_FAN) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
@@ -62,9 +62,9 @@ static const LogString *color_mode_to_human(ColorMode color_mode) {
|
||||
}
|
||||
|
||||
// Helper to log percentage values
|
||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
|
||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
|
||||
static void log_percent(const LogString *param, float value) {
|
||||
ESP_LOGD(TAG, " %s: %.0f%%", LOG_STR_ARG(param), value * 100.0f);
|
||||
ESP_LOGV(TAG, " %s: %.0f%%", LOG_STR_ARG(param), value * 100.0f);
|
||||
}
|
||||
#else
|
||||
#define log_percent(param, value)
|
||||
@@ -76,20 +76,20 @@ void LightCall::perform() {
|
||||
const bool publish = this->get_publish_();
|
||||
|
||||
if (publish) {
|
||||
ESP_LOGD(TAG, "'%s' Setting:", name);
|
||||
ESP_LOGV(TAG, "'%s' Setting:", name);
|
||||
|
||||
// Only print color mode when it's being changed
|
||||
ColorMode current_color_mode = this->parent_->remote_values.get_color_mode();
|
||||
ColorMode target_color_mode = this->has_color_mode() ? this->color_mode_ : current_color_mode;
|
||||
if (target_color_mode != current_color_mode) {
|
||||
ESP_LOGD(TAG, " Color mode: %s", LOG_STR_ARG(color_mode_to_human(v.get_color_mode())));
|
||||
ESP_LOGV(TAG, " Color mode: %s", LOG_STR_ARG(color_mode_to_human(v.get_color_mode())));
|
||||
}
|
||||
|
||||
// Only print state when it's being changed
|
||||
bool current_state = this->parent_->remote_values.is_on();
|
||||
bool target_state = this->has_state() ? this->state_ : current_state;
|
||||
if (target_state != current_state) {
|
||||
ESP_LOGD(TAG, " State: %s", ONOFF(v.is_on()));
|
||||
ESP_LOGV(TAG, " State: %s", ONOFF(v.is_on()));
|
||||
}
|
||||
|
||||
if (this->has_brightness()) {
|
||||
@@ -100,7 +100,7 @@ void LightCall::perform() {
|
||||
log_percent(LOG_STR("Color brightness"), v.get_color_brightness());
|
||||
}
|
||||
if (this->has_red() || this->has_green() || this->has_blue()) {
|
||||
ESP_LOGD(TAG, " Red: %.0f%%, Green: %.0f%%, Blue: %.0f%%", v.get_red() * 100.0f, v.get_green() * 100.0f,
|
||||
ESP_LOGV(TAG, " Red: %.0f%%, Green: %.0f%%, Blue: %.0f%%", v.get_red() * 100.0f, v.get_green() * 100.0f,
|
||||
v.get_blue() * 100.0f);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,11 @@ void LightCall::perform() {
|
||||
log_percent(LOG_STR("White"), v.get_white());
|
||||
}
|
||||
if (this->has_color_temperature()) {
|
||||
ESP_LOGD(TAG, " Color temperature: %.1f mireds", v.get_color_temperature());
|
||||
ESP_LOGV(TAG, " Color temperature: %.1f mireds", v.get_color_temperature());
|
||||
}
|
||||
|
||||
if (this->has_cold_white() || this->has_warm_white()) {
|
||||
ESP_LOGD(TAG, " Cold white: %.0f%%, warm white: %.0f%%", v.get_cold_white() * 100.0f,
|
||||
ESP_LOGV(TAG, " Cold white: %.0f%%, warm white: %.0f%%", v.get_cold_white() * 100.0f,
|
||||
v.get_warm_white() * 100.0f);
|
||||
}
|
||||
}
|
||||
@@ -120,20 +120,20 @@ void LightCall::perform() {
|
||||
if (this->has_flash_()) {
|
||||
// FLASH
|
||||
if (publish) {
|
||||
ESP_LOGD(TAG, " Flash length: %.1fs", this->flash_length_ / 1e3f);
|
||||
ESP_LOGV(TAG, " Flash length: %.1fs", this->flash_length_ / 1e3f);
|
||||
}
|
||||
|
||||
this->parent_->start_flash_(v, this->flash_length_, publish);
|
||||
} else if (this->has_transition_()) {
|
||||
// TRANSITION
|
||||
if (publish) {
|
||||
ESP_LOGD(TAG, " Transition length: %.1fs", this->transition_length_ / 1e3f);
|
||||
ESP_LOGV(TAG, " Transition length: %.1fs", this->transition_length_ / 1e3f);
|
||||
}
|
||||
|
||||
// Special case: Transition and effect can be set when turning off
|
||||
if (this->has_effect_()) {
|
||||
if (publish) {
|
||||
ESP_LOGD(TAG, " Effect: 'None'");
|
||||
ESP_LOGV(TAG, " Effect: 'None'");
|
||||
}
|
||||
this->parent_->stop_effect_();
|
||||
}
|
||||
@@ -150,7 +150,7 @@ void LightCall::perform() {
|
||||
}
|
||||
|
||||
if (publish) {
|
||||
ESP_LOGD(TAG, " Effect: '%.*s'", (int) effect_s.size(), effect_s.c_str());
|
||||
ESP_LOGV(TAG, " Effect: '%.*s'", (int) effect_s.size(), effect_s.c_str());
|
||||
}
|
||||
|
||||
this->parent_->start_effect_(this->effect_);
|
||||
|
||||
@@ -41,7 +41,7 @@ void Lock::publish_state(LockState state) {
|
||||
|
||||
this->state = state;
|
||||
this->rtc_.save(&this->state);
|
||||
ESP_LOGD(TAG, "'%s' >> %s", this->name_.c_str(), LOG_STR_ARG(lock_state_to_string(state)));
|
||||
ESP_LOGV(TAG, "'%s' >> %s", this->name_.c_str(), LOG_STR_ARG(lock_state_to_string(state)));
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_LOCK) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_lock_update(this);
|
||||
@@ -49,10 +49,10 @@ void Lock::publish_state(LockState state) {
|
||||
}
|
||||
|
||||
void LockCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->state_.has_value()) {
|
||||
ESP_LOGD(TAG, " State: %s", LOG_STR_ARG(lock_state_to_string(*this->state_)));
|
||||
ESP_LOGV(TAG, " State: %s", LOG_STR_ARG(lock_state_to_string(*this->state_)));
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
|
||||
@@ -110,20 +110,20 @@ void MediaPlayerCall::validate_() {
|
||||
}
|
||||
|
||||
void MediaPlayerCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->command_.has_value()) {
|
||||
const char *command_s = media_player_command_to_string(this->command_.value());
|
||||
ESP_LOGD(TAG, " Command: %s", command_s);
|
||||
ESP_LOGV(TAG, " Command: %s", command_s);
|
||||
}
|
||||
if (this->media_url_.has_value()) {
|
||||
ESP_LOGD(TAG, " Media URL: %s", this->media_url_.value().c_str());
|
||||
ESP_LOGV(TAG, " Media URL: %s", this->media_url_.value().c_str());
|
||||
}
|
||||
if (this->volume_.has_value()) {
|
||||
ESP_LOGD(TAG, " Volume: %.2f", this->volume_.value());
|
||||
ESP_LOGV(TAG, " Volume: %.2f", this->volume_.value());
|
||||
}
|
||||
if (this->announcement_.has_value()) {
|
||||
ESP_LOGD(TAG, " Announcement: %s", this->announcement_.value() ? "yes" : "no");
|
||||
ESP_LOGV(TAG, " Announcement: %s", this->announcement_.value() ? "yes" : "no");
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void log_number(const char *tag, const char *prefix, const char *type, Number *o
|
||||
void Number::publish_state(float state) {
|
||||
this->set_has_state(true);
|
||||
this->state = state;
|
||||
ESP_LOGD(TAG, "'%s' >> %.2f", this->get_name().c_str(), state);
|
||||
ESP_LOGV(TAG, "'%s' >> %.2f", this->get_name().c_str(), state);
|
||||
this->state_callback_.call(state);
|
||||
#if defined(USE_NUMBER) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_number_update(this);
|
||||
|
||||
@@ -61,7 +61,7 @@ void NumberCall::perform() {
|
||||
float max_value = traits.get_max_value();
|
||||
|
||||
if (this->operation_ == NUMBER_OP_SET) {
|
||||
ESP_LOGD(TAG, "'%s': Setting value", name);
|
||||
ESP_LOGV(TAG, "'%s': Setting value", name);
|
||||
if (!this->value_.has_value() || std::isnan(*this->value_)) {
|
||||
this->log_perform_warning_(LOG_STR("No value"));
|
||||
return;
|
||||
@@ -80,7 +80,7 @@ void NumberCall::perform() {
|
||||
target_value = max_value;
|
||||
}
|
||||
} else if (this->operation_ == NUMBER_OP_INCREMENT) {
|
||||
ESP_LOGD(TAG, "'%s': Increment with%s cycling", name, this->cycle_ ? LOG_STR_LITERAL("") : LOG_STR_LITERAL("out"));
|
||||
ESP_LOGV(TAG, "'%s': Increment with%s cycling", name, this->cycle_ ? LOG_STR_LITERAL("") : LOG_STR_LITERAL("out"));
|
||||
if (!parent->has_state()) {
|
||||
this->log_perform_warning_(LOG_STR("Can't increment, no state"));
|
||||
return;
|
||||
@@ -90,7 +90,7 @@ void NumberCall::perform() {
|
||||
if (target_value > max_value)
|
||||
target_value = this->cycle_or_clamp_(max_value, min_value);
|
||||
} else if (this->operation_ == NUMBER_OP_DECREMENT) {
|
||||
ESP_LOGD(TAG, "'%s': Decrement with%s cycling", name, this->cycle_ ? LOG_STR_LITERAL("") : LOG_STR_LITERAL("out"));
|
||||
ESP_LOGV(TAG, "'%s': Decrement with%s cycling", name, this->cycle_ ? LOG_STR_LITERAL("") : LOG_STR_LITERAL("out"));
|
||||
if (!parent->has_state()) {
|
||||
this->log_perform_warning_(LOG_STR("Can't decrement, no state"));
|
||||
return;
|
||||
@@ -110,7 +110,7 @@ void NumberCall::perform() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, " New value: %f", target_value);
|
||||
ESP_LOGV(TAG, " New value: %f", target_value);
|
||||
this->parent_->control(target_value);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void Select::publish_state(size_t index) {
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
this->state = option; // Update deprecated member for backward compatibility
|
||||
#pragma GCC diagnostic pop
|
||||
ESP_LOGD(TAG, "'%s' >> %s (%zu)", this->get_name().c_str(), option, index);
|
||||
ESP_LOGV(TAG, "'%s' >> %s (%zu)", this->get_name().c_str(), option, index);
|
||||
this->state_callback_.call(index);
|
||||
#if defined(USE_SELECT) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_select_update(this);
|
||||
|
||||
@@ -64,7 +64,7 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
|
||||
}
|
||||
|
||||
if (this->operation_ == SELECT_OP_SET) {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", name);
|
||||
ESP_LOGV(TAG, "'%s' - Setting", name);
|
||||
if (!this->index_.has_value()) {
|
||||
ESP_LOGW(TAG, "'%s' - No option set", name);
|
||||
return nullopt;
|
||||
@@ -73,7 +73,7 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
|
||||
}
|
||||
|
||||
// SELECT_OP_NEXT or SELECT_OP_PREVIOUS
|
||||
ESP_LOGD(TAG, "'%s' - Selecting %s, with%s cycling", name,
|
||||
ESP_LOGV(TAG, "'%s' - Selecting %s, with%s cycling", name,
|
||||
this->operation_ == SELECT_OP_NEXT ? LOG_STR_LITERAL("next") : LOG_STR_LITERAL("previous"),
|
||||
this->cycle_ ? LOG_STR_LITERAL("") : LOG_STR_LITERAL("out"));
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ void Sensor::clear_filters() {
|
||||
void Sensor::internal_send_state_to_frontend(float state) {
|
||||
this->set_has_state(true);
|
||||
this->state = state;
|
||||
ESP_LOGD(TAG, "'%s' >> %.*f %s", this->get_name().c_str(), std::max(0, (int) this->get_accuracy_decimals()), state,
|
||||
ESP_LOGV(TAG, "'%s' >> %.*f %s", this->get_name().c_str(), std::max(0, (int) this->get_accuracy_decimals()), state,
|
||||
this->get_unit_of_measurement_ref().c_str());
|
||||
this->callback_.call(state);
|
||||
#if defined(USE_SENSOR) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
@@ -61,7 +61,7 @@ void Switch::publish_state(bool state) {
|
||||
if (restore_mode & RESTORE_MODE_PERSISTENT_MASK)
|
||||
this->rtc_.save(&this->state);
|
||||
|
||||
ESP_LOGD(TAG, "'%s' >> %s", this->name_.c_str(), ONOFF(this->state));
|
||||
ESP_LOGV(TAG, "'%s' >> %s", this->name_.c_str(), ONOFF(this->state));
|
||||
this->state_callback_.call(this->state);
|
||||
#if defined(USE_SWITCH) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_switch_update(this);
|
||||
|
||||
@@ -19,9 +19,9 @@ void Text::publish_state(const char *state, size_t len) {
|
||||
this->state.assign(state, len);
|
||||
}
|
||||
if (this->traits.get_mode() == TEXT_MODE_PASSWORD) {
|
||||
ESP_LOGD(TAG, "'%s' >> " LOG_SECRET("'%s'"), this->get_name().c_str(), this->state.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >> " LOG_SECRET("'%s'"), this->get_name().c_str(), this->state.c_str());
|
||||
} else {
|
||||
ESP_LOGD(TAG, "'%s' >> '%s'", this->get_name().c_str(), this->state.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >> '%s'", this->get_name().c_str(), this->state.c_str());
|
||||
}
|
||||
this->state_callback_.call(this->state);
|
||||
#if defined(USE_TEXT) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
@@ -48,10 +48,10 @@ void TextCall::perform() {
|
||||
std::string target_value = this->value_.value();
|
||||
|
||||
if (this->parent_->traits.get_mode() == TEXT_MODE_PASSWORD) {
|
||||
ESP_LOGD(TAG, "'%s' - Setting password value: " LOG_SECRET("'%s'"), this->parent_->get_name().c_str(),
|
||||
ESP_LOGV(TAG, "'%s' - Setting password value: " LOG_SECRET("'%s'"), this->parent_->get_name().c_str(),
|
||||
target_value.c_str());
|
||||
} else {
|
||||
ESP_LOGD(TAG, "'%s' - Setting text value: %s", this->parent_->get_name().c_str(), target_value.c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting text value: %s", this->parent_->get_name().c_str(), target_value.c_str());
|
||||
}
|
||||
this->parent_->control(target_value);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void TextSensor::internal_send_state_to_frontend(const char *state, size_t len)
|
||||
|
||||
void TextSensor::notify_frontend_() {
|
||||
this->set_has_state(true);
|
||||
ESP_LOGD(TAG, "'%s' >> '%s'", this->name_.c_str(), this->state.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >> '%s'", this->name_.c_str(), this->state.c_str());
|
||||
this->callback_.call(this->state);
|
||||
#if defined(USE_TEXT_SENSOR) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_text_sensor_update(this);
|
||||
|
||||
@@ -18,28 +18,28 @@ const LogString *update_state_to_string(UpdateState state) {
|
||||
}
|
||||
|
||||
void UpdateEntity::publish_state() {
|
||||
ESP_LOGD(TAG,
|
||||
ESP_LOGV(TAG,
|
||||
"'%s' >>\n"
|
||||
" Current Version: %s",
|
||||
this->name_.c_str(), this->update_info_.current_version.c_str());
|
||||
|
||||
if (!this->update_info_.md5.empty()) {
|
||||
ESP_LOGD(TAG, " Latest Version: %s", this->update_info_.latest_version.c_str());
|
||||
ESP_LOGV(TAG, " Latest Version: %s", this->update_info_.latest_version.c_str());
|
||||
}
|
||||
if (!this->update_info_.firmware_url.empty()) {
|
||||
ESP_LOGD(TAG, " Firmware URL: %s", this->update_info_.firmware_url.c_str());
|
||||
ESP_LOGV(TAG, " Firmware URL: %s", this->update_info_.firmware_url.c_str());
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, " Title: %s", this->update_info_.title.c_str());
|
||||
ESP_LOGV(TAG, " Title: %s", this->update_info_.title.c_str());
|
||||
if (!this->update_info_.summary.empty()) {
|
||||
ESP_LOGD(TAG, " Summary: %s", this->update_info_.summary.c_str());
|
||||
ESP_LOGV(TAG, " Summary: %s", this->update_info_.summary.c_str());
|
||||
}
|
||||
if (!this->update_info_.release_url.empty()) {
|
||||
ESP_LOGD(TAG, " Release URL: %s", this->update_info_.release_url.c_str());
|
||||
ESP_LOGV(TAG, " Release URL: %s", this->update_info_.release_url.c_str());
|
||||
}
|
||||
|
||||
if (this->update_info_.has_progress) {
|
||||
ESP_LOGD(TAG, " Progress: %.0f%%", this->update_info_.progress);
|
||||
ESP_LOGV(TAG, " Progress: %.0f%%", this->update_info_.progress);
|
||||
}
|
||||
|
||||
this->set_has_state(true);
|
||||
|
||||
@@ -68,21 +68,21 @@ ValveCall &ValveCall::set_position(float position) {
|
||||
return *this;
|
||||
}
|
||||
void ValveCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
auto traits = this->parent_->get_traits();
|
||||
this->validate_();
|
||||
if (this->stop_) {
|
||||
ESP_LOGD(TAG, " Command: STOP");
|
||||
ESP_LOGV(TAG, " Command: STOP");
|
||||
}
|
||||
if (this->position_.has_value()) {
|
||||
if (traits.get_supports_position()) {
|
||||
ESP_LOGD(TAG, " Position: %.0f%%", *this->position_ * 100.0f);
|
||||
ESP_LOGV(TAG, " Position: %.0f%%", *this->position_ * 100.0f);
|
||||
} else {
|
||||
ESP_LOGD(TAG, " Command: %s", LOG_STR_ARG(valve_command_to_str(*this->position_)));
|
||||
ESP_LOGV(TAG, " Command: %s", LOG_STR_ARG(valve_command_to_str(*this->position_)));
|
||||
}
|
||||
}
|
||||
if (this->toggle_.has_value()) {
|
||||
ESP_LOGD(TAG, " Command: TOGGLE");
|
||||
ESP_LOGV(TAG, " Command: TOGGLE");
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
@@ -128,20 +128,20 @@ ValveCall Valve::make_call() { return {this}; }
|
||||
void Valve::publish_state(bool save) {
|
||||
this->position = clamp(this->position, 0.0f, 1.0f);
|
||||
|
||||
ESP_LOGD(TAG, "'%s' >>", this->name_.c_str());
|
||||
ESP_LOGV(TAG, "'%s' >>", this->name_.c_str());
|
||||
auto traits = this->get_traits();
|
||||
if (traits.get_supports_position()) {
|
||||
ESP_LOGD(TAG, " Position: %.0f%%", this->position * 100.0f);
|
||||
ESP_LOGV(TAG, " Position: %.0f%%", this->position * 100.0f);
|
||||
} else {
|
||||
if (this->position == VALVE_OPEN) {
|
||||
ESP_LOGD(TAG, " State: OPEN");
|
||||
ESP_LOGV(TAG, " State: OPEN");
|
||||
} else if (this->position == VALVE_CLOSED) {
|
||||
ESP_LOGD(TAG, " State: CLOSED");
|
||||
ESP_LOGV(TAG, " State: CLOSED");
|
||||
} else {
|
||||
ESP_LOGD(TAG, " State: UNKNOWN");
|
||||
ESP_LOGV(TAG, " State: UNKNOWN");
|
||||
}
|
||||
}
|
||||
ESP_LOGD(TAG, " Current Operation: %s", LOG_STR_ARG(valve_operation_to_str(this->current_operation)));
|
||||
ESP_LOGV(TAG, " Current Operation: %s", LOG_STR_ARG(valve_operation_to_str(this->current_operation)));
|
||||
|
||||
this->state_callback_.call();
|
||||
#if defined(USE_VALVE) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
@@ -83,25 +83,25 @@ WaterHeaterCall &WaterHeaterCall::set_on(bool on) {
|
||||
}
|
||||
|
||||
void WaterHeaterCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
ESP_LOGV(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
this->validate_();
|
||||
if (this->mode_.has_value()) {
|
||||
ESP_LOGD(TAG, " Mode: %s", LOG_STR_ARG(water_heater_mode_to_string(*this->mode_)));
|
||||
ESP_LOGV(TAG, " Mode: %s", LOG_STR_ARG(water_heater_mode_to_string(*this->mode_)));
|
||||
}
|
||||
if (!std::isnan(this->target_temperature_)) {
|
||||
ESP_LOGD(TAG, " Target Temperature: %.2f", this->target_temperature_);
|
||||
ESP_LOGV(TAG, " Target Temperature: %.2f", this->target_temperature_);
|
||||
}
|
||||
if (!std::isnan(this->target_temperature_low_)) {
|
||||
ESP_LOGD(TAG, " Target Temperature Low: %.2f", this->target_temperature_low_);
|
||||
ESP_LOGV(TAG, " Target Temperature Low: %.2f", this->target_temperature_low_);
|
||||
}
|
||||
if (!std::isnan(this->target_temperature_high_)) {
|
||||
ESP_LOGD(TAG, " Target Temperature High: %.2f", this->target_temperature_high_);
|
||||
ESP_LOGV(TAG, " Target Temperature High: %.2f", this->target_temperature_high_);
|
||||
}
|
||||
if (this->state_mask_ & WATER_HEATER_STATE_AWAY) {
|
||||
ESP_LOGD(TAG, " Away: %s", (this->state_ & WATER_HEATER_STATE_AWAY) ? "YES" : "NO");
|
||||
ESP_LOGV(TAG, " Away: %s", (this->state_ & WATER_HEATER_STATE_AWAY) ? "YES" : "NO");
|
||||
}
|
||||
if (this->state_mask_ & WATER_HEATER_STATE_ON) {
|
||||
ESP_LOGD(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO");
|
||||
ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO");
|
||||
}
|
||||
this->parent_->control(*this);
|
||||
}
|
||||
@@ -158,24 +158,24 @@ void WaterHeaterCall::validate_() {
|
||||
|
||||
void WaterHeater::publish_state() {
|
||||
auto traits = this->get_traits();
|
||||
ESP_LOGD(TAG,
|
||||
ESP_LOGV(TAG,
|
||||
"'%s' >>\n"
|
||||
" Mode: %s",
|
||||
this->name_.c_str(), LOG_STR_ARG(water_heater_mode_to_string(this->mode_)));
|
||||
if (!std::isnan(this->current_temperature_)) {
|
||||
ESP_LOGD(TAG, " Current Temperature: %.2f°C", this->current_temperature_);
|
||||
ESP_LOGV(TAG, " Current Temperature: %.2f°C", this->current_temperature_);
|
||||
}
|
||||
if (traits.get_supports_two_point_target_temperature()) {
|
||||
ESP_LOGD(TAG, " Target Temperature: Low: %.2f°C High: %.2f°C", this->target_temperature_low_,
|
||||
ESP_LOGV(TAG, " Target Temperature: Low: %.2f°C High: %.2f°C", this->target_temperature_low_,
|
||||
this->target_temperature_high_);
|
||||
} else if (!std::isnan(this->target_temperature_)) {
|
||||
ESP_LOGD(TAG, " Target Temperature: %.2f°C", this->target_temperature_);
|
||||
ESP_LOGV(TAG, " Target Temperature: %.2f°C", this->target_temperature_);
|
||||
}
|
||||
if (this->state_ & WATER_HEATER_STATE_AWAY) {
|
||||
ESP_LOGD(TAG, " Away: YES");
|
||||
ESP_LOGV(TAG, " Away: YES");
|
||||
}
|
||||
if (traits.has_feature_flags(WATER_HEATER_SUPPORTS_ON_OFF)) {
|
||||
ESP_LOGD(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO");
|
||||
ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO");
|
||||
}
|
||||
|
||||
#if defined(USE_WATER_HEATER) && defined(USE_CONTROLLER_REGISTRY)
|
||||
|
||||
Reference in New Issue
Block a user