diff --git a/esphome/components/aqi/aqi_sensor.cpp b/esphome/components/aqi/aqi_sensor.cpp index 4bb964d5ee..e78f301b30 100644 --- a/esphome/components/aqi/aqi_sensor.cpp +++ b/esphome/components/aqi/aqi_sensor.cpp @@ -23,8 +23,10 @@ void AQISensor::setup() { void AQISensor::dump_config() { ESP_LOGCONFIG(TAG, "AQI Sensor:"); - ESP_LOGCONFIG(TAG, " Calculation Type: %s", this->aqi_calc_type_ == AQI_TYPE ? "AQI" : "CAQI"); - ESP_LOGCONFIG(TAG, " Extended Range: %s", this->extended_range_ ? "enabled" : "disabled"); + ESP_LOGCONFIG(TAG, " Calculation Type: %s", + this->aqi_calc_type_ == AQI_TYPE ? LOG_STR_LITERAL("AQI") : LOG_STR_LITERAL("CAQI")); + ESP_LOGCONFIG(TAG, " Extended Range: %s", + this->extended_range_ ? LOG_STR_LITERAL("enabled") : LOG_STR_LITERAL("disabled")); if (this->pm_2_5_sensor_ != nullptr) { ESP_LOGCONFIG(TAG, " PM2.5 Sensor: '%s'", this->pm_2_5_sensor_->get_name().c_str()); } diff --git a/esphome/components/binary_sensor/automation.cpp b/esphome/components/binary_sensor/automation.cpp index 1a3c1f7536..65c7dbbdb6 100644 --- a/esphome/components/binary_sensor/automation.cpp +++ b/esphome/components/binary_sensor/automation.cpp @@ -100,13 +100,15 @@ void MultiClickTriggerBase::schedule_is_valid_(uint32_t min_length) { } this->is_valid_ = false; this->set_timeout(MULTICLICK_IS_VALID_ID, min_length, [this]() { - ESP_LOGV(TAG, "Multi Click: You can now %s the button.", this->parent_->state ? "RELEASE" : "PRESS"); + ESP_LOGV(TAG, "Multi Click: You can now %s the button.", + this->parent_->state ? LOG_STR_LITERAL("RELEASE") : LOG_STR_LITERAL("PRESS")); this->is_valid_ = true; }); } void MultiClickTriggerBase::schedule_is_not_valid_(uint32_t max_length) { this->set_timeout(MULTICLICK_IS_NOT_VALID_ID, max_length, [this]() { - ESP_LOGV(TAG, "Multi Click: You waited too long to %s.", this->parent_->state ? "RELEASE" : "PRESS"); + ESP_LOGV(TAG, "Multi Click: You waited too long to %s.", + this->parent_->state ? LOG_STR_LITERAL("RELEASE") : LOG_STR_LITERAL("PRESS")); this->is_valid_ = false; this->schedule_cooldown_(); }); diff --git a/esphome/components/bme680_bsec/bme680_bsec.cpp b/esphome/components/bme680_bsec/bme680_bsec.cpp index 823f32c446..8e16a28e33 100644 --- a/esphome/components/bme680_bsec/bme680_bsec.cpp +++ b/esphome/components/bme680_bsec/bme680_bsec.cpp @@ -162,8 +162,9 @@ void BME680BSECComponent::dump_config() { " Supply Voltage: %sV\n" " Sample Rate: %s\n" " State Save Interval: %" PRIu32 "ms", - this->temperature_offset_, this->iaq_mode_ == IAQ_MODE_STATIC ? "Static" : "Mobile", - this->supply_voltage_ == SUPPLY_VOLTAGE_3V3 ? "3.3" : "1.8", + this->temperature_offset_, + this->iaq_mode_ == IAQ_MODE_STATIC ? LOG_STR_LITERAL("Static") : LOG_STR_LITERAL("Mobile"), + this->supply_voltage_ == SUPPLY_VOLTAGE_3V3 ? LOG_STR_LITERAL("3.3") : LOG_STR_LITERAL("1.8"), BME680_BSEC_SAMPLE_RATE_LOG(this->sample_rate_), this->state_save_interval_ms_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); diff --git a/esphome/components/cs5460a/cs5460a.cpp b/esphome/components/cs5460a/cs5460a.cpp index c9e8f3cf47..1f9233841a 100644 --- a/esphome/components/cs5460a/cs5460a.cpp +++ b/esphome/components/cs5460a/cs5460a.cpp @@ -249,7 +249,7 @@ bool CS5460AComponent::check_status_() { bool dir = status & (1 << 21); if (current_gain_ < 0) dir = !dir; - ESP_LOGI(TAG, "Energy counter %s pulse", dir ? "negative" : "positive"); + ESP_LOGI(TAG, "Energy counter %s pulse", dir ? LOG_STR_LITERAL("negative") : LOG_STR_LITERAL("positive")); clear |= 1 << 22; } @@ -319,7 +319,9 @@ void CS5460AComponent::dump_config() { ESP_LOGCONFIG(TAG, "CS5460A:\n" " Init status: %s", - state == COMPONENT_STATE_LOOP ? "OK" : (state == COMPONENT_STATE_FAILED ? "failed" : "other")); + state == COMPONENT_STATE_LOOP + ? LOG_STR_LITERAL("OK") + : (state == COMPONENT_STATE_FAILED ? LOG_STR_LITERAL("failed") : LOG_STR_LITERAL("other"))); LOG_PIN(" CS Pin: ", cs_); ESP_LOGCONFIG(TAG, " Samples / cycle: %" PRIu32 "\n" @@ -330,9 +332,10 @@ void CS5460AComponent::dump_config() { " Current HPF: %s\n" " Voltage HPF: %s\n" " Pulse energy: %.2f Wh", - samples_, phase_offset_, pga_gain_ == CS5460A_PGA_GAIN_50X ? "50x" : "10x", current_gain_, - voltage_gain_, current_hpf_ ? "enabled" : "disabled", voltage_hpf_ ? "enabled" : "disabled", - pulse_energy_wh_); + samples_, phase_offset_, + pga_gain_ == CS5460A_PGA_GAIN_50X ? LOG_STR_LITERAL("50x") : LOG_STR_LITERAL("10x"), current_gain_, + voltage_gain_, current_hpf_ ? LOG_STR_LITERAL("enabled") : LOG_STR_LITERAL("disabled"), + voltage_hpf_ ? LOG_STR_LITERAL("enabled") : LOG_STR_LITERAL("disabled"), pulse_energy_wh_); LOG_SENSOR(" ", "Voltage", voltage_sensor_); LOG_SENSOR(" ", "Current", current_sensor_); LOG_SENSOR(" ", "Power", power_sensor_); diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 5b7b6a268f..a9117be4e1 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -20,8 +20,8 @@ void DHT::dump_config() { "DHT:\n" " %sModel: %s\n" " Internal pull-up: %s", - this->is_auto_detect_ ? "Auto-detected " : "", - this->model_ == DHT_MODEL_DHT11 ? "DHT11" : "DHT22 or equivalent", + this->is_auto_detect_ ? LOG_STR_LITERAL("Auto-detected ") : "", + this->model_ == DHT_MODEL_DHT11 ? LOG_STR_LITERAL("DHT11") : LOG_STR_LITERAL("DHT22 or equivalent"), ONOFF(this->t_pin_->get_flags() & gpio::FLAG_PULLUP)); LOG_PIN(" Pin: ", this->t_pin_); LOG_UPDATE_INTERVAL(this); diff --git a/esphome/components/emc2101/emc2101.cpp b/esphome/components/emc2101/emc2101.cpp index f46082f5e7..bb041bfd6d 100644 --- a/esphome/components/emc2101/emc2101.cpp +++ b/esphome/components/emc2101/emc2101.cpp @@ -93,7 +93,7 @@ void Emc2101Component::dump_config() { if (this->is_failed()) { ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL); } - ESP_LOGCONFIG(TAG, " Mode: %s", this->dac_mode_ ? "DAC" : "PWM"); + ESP_LOGCONFIG(TAG, " Mode: %s", this->dac_mode_ ? LOG_STR_LITERAL("DAC") : LOG_STR_LITERAL("PWM")); if (this->dac_mode_) { ESP_LOGCONFIG(TAG, " DAC Conversion Rate: %X", this->dac_conversion_rate_); } else { diff --git a/esphome/components/ens210/ens210.cpp b/esphome/components/ens210/ens210.cpp index 468c627d4b..11b73afe37 100644 --- a/esphome/components/ens210/ens210.cpp +++ b/esphome/components/ens210/ens210.cpp @@ -216,7 +216,7 @@ void ENS210Component::extract_measurement_(uint32_t val, int *data, int *status) // Sets ENS210 to low (true) or high (false) power. Returns false on I2C problems. bool ENS210Component::set_low_power_(bool enable) { uint8_t low_power_cmd = enable ? 0x01 : 0x00; - ESP_LOGD(TAG, "Enable low power: %s", enable ? "true" : "false"); + ESP_LOGD(TAG, "Enable low power: %s", enable ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false")); bool result = this->write_byte(ENS210_REGISTER_SYS_CTRL, low_power_cmd); delay(ENS210_BOOTING_MS); return result; diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index 74f84b71fb..9f15eaaede 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -128,7 +128,8 @@ void ESPHomeOTAComponent::dump_config() { esp_partition_iterator_release(it); esp_bootloader_desc_t bootloader_desc; esp_err_t err = esp_ota_get_bootloader_description(nullptr, &bootloader_desc); - ESP_LOGCONFIG(TAG, " Bootloader: ESP-IDF %s", (err == ESP_OK) ? bootloader_desc.idf_ver : "version unknown"); + ESP_LOGCONFIG(TAG, " Bootloader: ESP-IDF %s", + (err == ESP_OK) ? bootloader_desc.idf_ver : LOG_STR_LITERAL("version unknown")); #endif // USE_ESP32 #endif // USE_OTA_PARTITIONS } diff --git a/esphome/components/feedback/feedback_cover.cpp b/esphome/components/feedback/feedback_cover.cpp index 1139e6fa18..4baffc74f8 100644 --- a/esphome/components/feedback/feedback_cover.cpp +++ b/esphome/components/feedback/feedback_cover.cpp @@ -93,7 +93,8 @@ void FeedbackCover::set_open_sensor(binary_sensor::BinarySensor *open_feedback) // setup callbacks to react to sensor changes open_feedback->add_on_state_callback([this](bool state) { - ESP_LOGD(TAG, "'%s' - Open feedback '%s'.", this->name_.c_str(), state ? "STARTED" : "ENDED"); + ESP_LOGD(TAG, "'%s' - Open feedback '%s'.", this->name_.c_str(), + state ? LOG_STR_LITERAL("STARTED") : LOG_STR_LITERAL("ENDED")); this->recompute_position_(); if (!state && this->infer_endstop_ && this->current_trigger_operation_ == COVER_OPERATION_OPENING) { this->endstop_reached_(true); @@ -106,7 +107,8 @@ void FeedbackCover::set_close_sensor(binary_sensor::BinarySensor *close_feedback this->close_feedback_ = close_feedback; close_feedback->add_on_state_callback([this](bool state) { - ESP_LOGD(TAG, "'%s' - Close feedback '%s'.", this->name_.c_str(), state ? "STARTED" : "ENDED"); + ESP_LOGD(TAG, "'%s' - Close feedback '%s'.", this->name_.c_str(), + state ? LOG_STR_LITERAL("STARTED") : LOG_STR_LITERAL("ENDED")); this->recompute_position_(); if (!state && this->infer_endstop_ && this->current_trigger_operation_ == COVER_OPERATION_CLOSING) { this->endstop_reached_(false); @@ -144,7 +146,8 @@ void FeedbackCover::endstop_reached_(bool open_endstop) { // from a position slightly past the endpoint if (this->current_trigger_operation_ == (open_endstop ? COVER_OPERATION_OPENING : COVER_OPERATION_CLOSING)) { float dur = (now - this->start_dir_time_) / 1e3f; - ESP_LOGD(TAG, "'%s' - %s endstop reached. Took %.1fs.", this->name_.c_str(), open_endstop ? "Open" : "Close", dur); + ESP_LOGD(TAG, "'%s' - %s endstop reached. Took %.1fs.", this->name_.c_str(), + open_endstop ? LOG_STR_LITERAL("Open") : LOG_STR_LITERAL("Close"), dur); // if there is no external mechanism, stop the cover if (!this->has_built_in_endstop_) { @@ -366,7 +369,7 @@ void FeedbackCover::start_direction_(CoverOperation dir) { // the case when an obstacle appears while moving is handled in the callback if (obstacle != nullptr && obstacle->state) { ESP_LOGD(TAG, "'%s' - %s obstacle detected. Action not started.", this->name_.c_str(), - dir == COVER_OPERATION_OPENING ? "Open" : "Close"); + dir == COVER_OPERATION_OPENING ? LOG_STR_LITERAL("Open") : LOG_STR_LITERAL("Close")); return; } #endif @@ -383,9 +386,9 @@ void FeedbackCover::start_direction_(CoverOperation dir) { this->set_current_operation_(dir, true); this->prev_command_trigger_ = trig; ESP_LOGD(TAG, "'%s' - Firing '%s' trigger.", this->name_.c_str(), - dir == COVER_OPERATION_OPENING ? "OPEN" - : dir == COVER_OPERATION_CLOSING ? "CLOSE" - : "STOP"); + dir == COVER_OPERATION_OPENING ? LOG_STR_LITERAL("OPEN") + : dir == COVER_OPERATION_CLOSING ? LOG_STR_LITERAL("CLOSE") + : LOG_STR_LITERAL("STOP")); trig->trigger(); } } diff --git a/esphome/components/fingerprint_grow/fingerprint_grow.cpp b/esphome/components/fingerprint_grow/fingerprint_grow.cpp index b38d42191b..07630f121a 100644 --- a/esphome/components/fingerprint_grow/fingerprint_grow.cpp +++ b/esphome/components/fingerprint_grow/fingerprint_grow.cpp @@ -547,8 +547,8 @@ void FingerprintGrowComponent::dump_config() { " System Identifier Code: 0x%.4X\n" " Touch Sensing Pin: %s\n" " Sensor Power Pin: %s", - this->system_identifier_code_, this->has_sensing_pin_ ? sensing_pin_buf : "None", - this->has_power_pin_ ? power_pin_buf : "None"); + this->system_identifier_code_, this->has_sensing_pin_ ? sensing_pin_buf : LOG_STR_LITERAL("None"), + this->has_power_pin_ ? power_pin_buf : LOG_STR_LITERAL("None")); if (this->idle_period_to_sleep_ms_ < UINT32_MAX) { ESP_LOGCONFIG(TAG, " Idle Period to Sleep: %" PRIu32 " ms", this->idle_period_to_sleep_ms_); } else { diff --git a/esphome/components/graphical_display_menu/graphical_display_menu.cpp b/esphome/components/graphical_display_menu/graphical_display_menu.cpp index b3c3b27e06..f0642d2e8c 100644 --- a/esphome/components/graphical_display_menu/graphical_display_menu.cpp +++ b/esphome/components/graphical_display_menu/graphical_display_menu.cpp @@ -35,18 +35,20 @@ void GraphicalDisplayMenu::setup() { } void GraphicalDisplayMenu::dump_config() { - ESP_LOGCONFIG(TAG, - "Graphical Display Menu\n" - " Has Display: %s\n" - " Popup Mode: %s\n" - " Advanced Drawing Mode: %s\n" - " Has Font: %s\n" - " Mode: %s\n" - " Active: %s\n" - " Menu items:", - YESNO(this->display_ != nullptr), YESNO(this->display_ != nullptr), YESNO(this->display_ == nullptr), - YESNO(this->font_ != nullptr), - this->mode_ == display_menu_base::MENU_MODE_ROTARY ? "Rotary" : "Joystick", YESNO(this->active_)); + ESP_LOGCONFIG( + TAG, + "Graphical Display Menu\n" + " Has Display: %s\n" + " Popup Mode: %s\n" + " Advanced Drawing Mode: %s\n" + " Has Font: %s\n" + " Mode: %s\n" + " Active: %s\n" + " Menu items:", + YESNO(this->display_ != nullptr), YESNO(this->display_ != nullptr), YESNO(this->display_ == nullptr), + YESNO(this->font_ != nullptr), + this->mode_ == display_menu_base::MENU_MODE_ROTARY ? LOG_STR_LITERAL("Rotary") : LOG_STR_LITERAL("Joystick"), + YESNO(this->active_)); for (size_t i = 0; i < this->displayed_item_->items_size(); i++) { auto *item = this->displayed_item_->get_item(i); ESP_LOGCONFIG(TAG, " %i: %s (Type: %s, Immediate Edit: %s)", i, item->get_text().c_str(), diff --git a/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp b/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp index 2152ae7b84..8ced267947 100644 --- a/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +++ b/esphome/components/gt911/touchscreen/gt911_touchscreen.cpp @@ -69,10 +69,12 @@ void GT911Touchscreen::setup_internal_() { // Direct MCU pin: attach a hardware interrupt, no polling needed. this->attach_interrupt_(static_cast(this->interrupt_pin_), active_high ? gpio::INTERRUPT_RISING_EDGE : gpio::INTERRUPT_FALLING_EDGE); - ESP_LOGD(TAG, "Interrupt pin: hardware interrupt, active %s", active_high ? "HIGH" : "LOW"); + ESP_LOGD(TAG, "Interrupt pin: hardware interrupt, active %s", + active_high ? LOG_STR_LITERAL("HIGH") : LOG_STR_LITERAL("LOW")); } else { // IO expander pin: leave as output for configuration only. - ESP_LOGD(TAG, "Interrupt pin: IO expander polling mode, active %s", active_high ? "HIGH" : "LOW"); + ESP_LOGD(TAG, "Interrupt pin: IO expander polling mode, active %s", + active_high ? LOG_STR_LITERAL("HIGH") : LOG_STR_LITERAL("LOW")); } } } diff --git a/esphome/components/haier/haier_base.cpp b/esphome/components/haier/haier_base.cpp index 294aa53b03..48f72dc16b 100644 --- a/esphome/components/haier/haier_base.cpp +++ b/esphome/components/haier/haier_base.cpp @@ -248,7 +248,8 @@ void HaierClimateBase::setup() { void HaierClimateBase::dump_config() { LOG_CLIMATE("", "Haier Climate", this); - ESP_LOGCONFIG(TAG, " Device communication status: %s", this->valid_connection() ? "established" : "none"); + ESP_LOGCONFIG(TAG, " Device communication status: %s", + this->valid_connection() ? LOG_STR_LITERAL("established") : LOG_STR_LITERAL("none")); } void HaierClimateBase::loop() { diff --git a/esphome/components/haier/hon_climate.cpp b/esphome/components/haier/hon_climate.cpp index 881a2328cb..0ce4142fd4 100644 --- a/esphome/components/haier/hon_climate.cpp +++ b/esphome/components/haier/hon_climate.cpp @@ -343,11 +343,11 @@ void HonClimate::dump_config() { this->hvac_hardware_info_.value().software_version_, this->hvac_hardware_info_.value().hardware_version_, this->hvac_hardware_info_.value().device_name_); ESP_LOGCONFIG(TAG, " Device features:%s%s%s%s%s", - (this->hvac_hardware_info_.value().functions_[0] ? " interactive" : ""), - (this->hvac_hardware_info_.value().functions_[1] ? " controller-device" : ""), - (this->hvac_hardware_info_.value().functions_[2] ? " crc" : ""), - (this->hvac_hardware_info_.value().functions_[3] ? " multinode" : ""), - (this->hvac_hardware_info_.value().functions_[4] ? " role" : "")); + (this->hvac_hardware_info_.value().functions_[0] ? LOG_STR_LITERAL(" interactive") : ""), + (this->hvac_hardware_info_.value().functions_[1] ? LOG_STR_LITERAL(" controller-device") : ""), + (this->hvac_hardware_info_.value().functions_[2] ? LOG_STR_LITERAL(" crc") : ""), + (this->hvac_hardware_info_.value().functions_[3] ? LOG_STR_LITERAL(" multinode") : ""), + (this->hvac_hardware_info_.value().functions_[4] ? LOG_STR_LITERAL(" role") : "")); ESP_LOGCONFIG(TAG, " Active alarms: %s", buf_to_hex(this->active_alarms_, sizeof(this->active_alarms_)).c_str()); } } diff --git a/esphome/components/hdc302x/hdc302x.cpp b/esphome/components/hdc302x/hdc302x.cpp index b50d34169a..53d4c7f016 100644 --- a/esphome/components/hdc302x/hdc302x.cpp +++ b/esphome/components/hdc302x/hdc302x.cpp @@ -38,7 +38,7 @@ void HDC302XComponent::dump_config() { ESP_LOGCONFIG(TAG, "HDC302x:\n" " Heater: %s", - this->heater_active_ ? "active" : "inactive"); + this->heater_active_ ? LOG_STR_LITERAL("active") : LOG_STR_LITERAL("inactive")); LOG_I2C_DEVICE(this); LOG_UPDATE_INTERVAL(this); LOG_SENSOR(" ", "Temperature", this->temp_sensor_); diff --git a/esphome/components/he60r/he60r.cpp b/esphome/components/he60r/he60r.cpp index 84edbb2866..ea662e3ba9 100644 --- a/esphome/components/he60r/he60r.cpp +++ b/esphome/components/he60r/he60r.cpp @@ -59,7 +59,7 @@ void HE60rCover::endstop_reached_(CoverOperation operation) { if (this->last_command_ == operation) { float dur = (float) (now - this->start_dir_time_) / 1e3f; ESP_LOGD(TAG, "'%s' - %s endstop reached. Took %.1fs.", this->name_.c_str(), - operation == COVER_OPERATION_OPENING ? "Open" : "Close", dur); + operation == COVER_OPERATION_OPENING ? LOG_STR_LITERAL("Open") : LOG_STR_LITERAL("Close"), dur); } this->publish_state(); } @@ -213,9 +213,9 @@ void HE60rCover::start_direction_(CoverOperation dir) { if (this->current_operation == dir) return; ESP_LOGD(TAG, "'%s' - Direction '%s' requested.", this->name_.c_str(), - dir == COVER_OPERATION_OPENING ? "OPEN" - : dir == COVER_OPERATION_CLOSING ? "CLOSE" - : "STOP"); + dir == COVER_OPERATION_OPENING ? LOG_STR_LITERAL("OPEN") + : dir == COVER_OPERATION_CLOSING ? LOG_STR_LITERAL("CLOSE") + : LOG_STR_LITERAL("STOP")); if (dir == this->next_direction_) { // either moving and needs to stop, or stopped and will move correctly on one trigger diff --git a/esphome/components/hlk_fm22x/hlk_fm22x.cpp b/esphome/components/hlk_fm22x/hlk_fm22x.cpp index 964d26dfbc..a924259802 100644 --- a/esphome/components/hlk_fm22x/hlk_fm22x.cpp +++ b/esphome/components/hlk_fm22x/hlk_fm22x.cpp @@ -336,7 +336,8 @@ void HlkFm22xComponent::dump_config() { } if (this->enrolling_binary_sensor_) { LOG_BINARY_SENSOR(" ", "Enrolling", this->enrolling_binary_sensor_); - ESP_LOGCONFIG(TAG, " Current Value: %s", this->enrolling_binary_sensor_->state ? "ON" : "OFF"); + ESP_LOGCONFIG(TAG, " Current Value: %s", + this->enrolling_binary_sensor_->state ? LOG_STR_LITERAL("ON") : LOG_STR_LITERAL("OFF")); } if (this->face_count_sensor_) { LOG_SENSOR(" ", "Face Count", this->face_count_sensor_); diff --git a/esphome/components/hlw8012/hlw8012.cpp b/esphome/components/hlw8012/hlw8012.cpp index c92c76a20a..9ef81f075d 100644 --- a/esphome/components/hlw8012/hlw8012.cpp +++ b/esphome/components/hlw8012/hlw8012.cpp @@ -97,7 +97,8 @@ void HLW8012Component::update() { if (this->change_mode_every_ != 0 && this->change_mode_at_++ == this->change_mode_every_) { this->current_mode_ = !this->current_mode_; - ESP_LOGV(TAG, "Changing mode to %s mode", this->current_mode_ ? "CURRENT" : "VOLTAGE"); + ESP_LOGV(TAG, "Changing mode to %s mode", + this->current_mode_ ? LOG_STR_LITERAL("CURRENT") : LOG_STR_LITERAL("VOLTAGE")); this->change_mode_at_ = 0; this->sel_pin_->digital_write(this->current_mode_); } diff --git a/esphome/components/ili9xxx/ili9xxx_display.cpp b/esphome/components/ili9xxx/ili9xxx_display.cpp index e8840c0cf1..0ed18c45da 100644 --- a/esphome/components/ili9xxx/ili9xxx_display.cpp +++ b/esphome/components/ili9xxx/ili9xxx_display.cpp @@ -116,8 +116,8 @@ void ILI9XXXDisplay::dump_config() { " Mirror_x: %s\n" " Mirror_y: %s\n" " Invert colors: %s", - this->color_order_ == display::COLOR_ORDER_BGR ? "BGR" : "RGB", YESNO(this->swap_xy_), - YESNO(this->mirror_x_), YESNO(this->mirror_y_), YESNO(this->pre_invertcolors_)); + this->color_order_ == display::COLOR_ORDER_BGR ? LOG_STR_LITERAL("BGR") : LOG_STR_LITERAL("RGB"), + YESNO(this->swap_xy_), YESNO(this->mirror_x_), YESNO(this->mirror_y_), YESNO(this->pre_invertcolors_)); if (this->is_failed()) { ESP_LOGCONFIG(TAG, " => Failed to init Memory: YES!"); diff --git a/esphome/components/ina2xx_base/ina2xx_base.cpp b/esphome/components/ina2xx_base/ina2xx_base.cpp index d3acf00eef..fec5cd2f13 100644 --- a/esphome/components/ina2xx_base/ina2xx_base.cpp +++ b/esphome/components/ina2xx_base/ina2xx_base.cpp @@ -209,7 +209,8 @@ void INA2XX::dump_config() { " CURRENT_LSB = %f\n" " SHUNT_CAL = %d", this->shunt_resistance_ohm_, this->max_current_a_, this->shunt_tempco_ppm_c_, - (uint8_t) this->adc_range_, this->adc_range_ ? "±40.96 mV" : "±163.84 mV", this->current_lsb_, + (uint8_t) this->adc_range_, + this->adc_range_ ? LOG_STR_LITERAL("±40.96 mV") : LOG_STR_LITERAL("±163.84 mV"), this->current_lsb_, this->shunt_cal_); ESP_LOGCONFIG(TAG, " ADC Samples = %d; ADC times: Bus = %d μs, Shunt = %d μs, Temp = %d μs", diff --git a/esphome/components/it8951/it8951.cpp b/esphome/components/it8951/it8951.cpp index cc2bddeda7..179c2e5f63 100644 --- a/esphome/components/it8951/it8951.cpp +++ b/esphome/components/it8951/it8951.cpp @@ -740,7 +740,7 @@ bool IT8951Display::prepare_update_region_(UpdateMode &mode) { this->reset_dirty_region_(); ESP_LOGV(TAG, "Update: %ux%u@%u,%u mode=%u (%s)", width, height, x, y, static_cast(mode), - this->grayscale_ ? "grayscale" : "mono"); + this->grayscale_ ? LOG_STR_LITERAL("grayscale") : LOG_STR_LITERAL("mono")); return true; } @@ -1063,25 +1063,27 @@ void IT8951Display::dump_config() { strncpy(force_temperature, "(controller default)", sizeof(force_temperature)); force_temperature[sizeof(force_temperature) - 1] = '\0'; } - ESP_LOGCONFIG(TAG, - " Model preset: %s" - "\n Dimensions: %dx%d" - "\n Buffer: %u bytes" - "\n Image buffer addr: 0x%04X%04X" - "\n VCOM: %.02fV (set selector 0x%04X)" - "\n Force temperature: %s" - "\n Display command: %s" - "\n Sleep when done: %s" - "\n Full update every: %u" - "\n Inverted colors: %s" - "\n Pixel format: %s" - "\n Reset duration: %" PRIu32 "ms", - this->name_ != nullptr ? this->name_ : "(unknown)", this->get_width_internal(), - this->get_height_internal(), static_cast(this->buffer_length_), this->img_buf_addr_h_, - this->img_buf_addr_l_, static_cast(this->vcom_) / 1000.0f, this->vcom_register_, - force_temperature, this->use_legacy_dpy_area_ ? "DPY_AREA (0x0034, legacy)" : "DPY_BUF_AREA (0x0037)", - YESNO(this->sleep_when_done_), this->full_update_every_, YESNO(this->invert_colors_), - this->grayscale_ ? "4bpp grayscale" : "1bpp monochrome", this->reset_duration_); + ESP_LOGCONFIG( + TAG, + " Model preset: %s" + "\n Dimensions: %dx%d" + "\n Buffer: %u bytes" + "\n Image buffer addr: 0x%04X%04X" + "\n VCOM: %.02fV (set selector 0x%04X)" + "\n Force temperature: %s" + "\n Display command: %s" + "\n Sleep when done: %s" + "\n Full update every: %u" + "\n Inverted colors: %s" + "\n Pixel format: %s" + "\n Reset duration: %" PRIu32 "ms", + this->name_ != nullptr ? this->name_ : LOG_STR_LITERAL("(unknown)"), this->get_width_internal(), + this->get_height_internal(), static_cast(this->buffer_length_), this->img_buf_addr_h_, + this->img_buf_addr_l_, static_cast(this->vcom_) / 1000.0f, this->vcom_register_, force_temperature, + this->use_legacy_dpy_area_ ? LOG_STR_LITERAL("DPY_AREA (0x0034, legacy)") + : LOG_STR_LITERAL("DPY_BUF_AREA (0x0037)"), + YESNO(this->sleep_when_done_), this->full_update_every_, YESNO(this->invert_colors_), + this->grayscale_ ? LOG_STR_LITERAL("4bpp grayscale") : LOG_STR_LITERAL("1bpp monochrome"), this->reset_duration_); LOG_PIN(" Reset Pin: ", this->reset_pin_); LOG_PIN(" Busy Pin: ", this->busy_pin_); LOG_PIN(" CS Pin: ", this->cs_); diff --git a/esphome/components/lc709203f/lc709203f.cpp b/esphome/components/lc709203f/lc709203f.cpp index cbd733b611..a5dda6ca43 100644 --- a/esphome/components/lc709203f/lc709203f.cpp +++ b/esphome/components/lc709203f/lc709203f.cpp @@ -150,7 +150,8 @@ void Lc709203f::dump_config() { " Pack Size: %d mAH\n" " Pack APA: 0x%02X\n" " Pack Rated Voltage: 3.%sV", - this->pack_size_, this->apa_, this->pack_voltage_ == 0x0000 ? "8" : "7"); + this->pack_size_, this->apa_, + this->pack_voltage_ == 0x0000 ? LOG_STR_LITERAL("8") : LOG_STR_LITERAL("7")); LOG_I2C_DEVICE(this); LOG_UPDATE_INTERVAL(this); LOG_SENSOR(" ", "Voltage", this->voltage_sensor_); diff --git a/esphome/components/ld2420/ld2420.cpp b/esphome/components/ld2420/ld2420.cpp index 4aa00f8fd4..e342ead414 100644 --- a/esphome/components/ld2420/ld2420.cpp +++ b/esphome/components/ld2420/ld2420.cpp @@ -701,7 +701,8 @@ uint8_t LD2420Component::set_config_mode(bool enable) { cmd_frame.data_length += sizeof(CMD_PROTOCOL_VER); } cmd_frame.footer = CMD_FRAME_FOOTER; - ESP_LOGV(TAG, "Sending set config %s command: %2X", enable ? "enable" : "disable", cmd_frame.command); + ESP_LOGV(TAG, "Sending set config %s command: %2X", enable ? LOG_STR_LITERAL("enable") : LOG_STR_LITERAL("disable"), + cmd_frame.command); return this->send_cmd_from_array(cmd_frame); } diff --git a/esphome/components/ld6002b/ld6002b.cpp b/esphome/components/ld6002b/ld6002b.cpp index ca6b9b9552..73fc7df331 100644 --- a/esphome/components/ld6002b/ld6002b.cpp +++ b/esphome/components/ld6002b/ld6002b.cpp @@ -437,7 +437,8 @@ void LD6002BComponent::dump_config() { "HLK-LD6002B:\n" " Auto wake: %s\n" " Max data length: %u", - this->auto_wake_ ? "true" : "false", static_cast(this->max_data_len_)); + this->auto_wake_ ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false"), + static_cast(this->max_data_len_)); if (this->wakeup_pin_ != nullptr) { LOG_PIN(" Wake-up Pin: ", this->wakeup_pin_); ESP_LOGCONFIG(TAG, " Wake Pulse: %" PRIu32 "ms", this->wakeup_pulse_ms_); diff --git a/esphome/components/max31856/max31856.cpp b/esphome/components/max31856/max31856.cpp index 4062d21bee..b5bad8ef74 100644 --- a/esphome/components/max31856/max31856.cpp +++ b/esphome/components/max31856/max31856.cpp @@ -23,8 +23,10 @@ void MAX31856Sensor::setup() { void MAX31856Sensor::dump_config() { LOG_SENSOR("", "MAX31856", this); LOG_PIN(" CS Pin: ", this->cs_); - ESP_LOGCONFIG(TAG, " Mains Filter: %s", - (filter_ == FILTER_60HZ ? "60 Hz" : (filter_ == FILTER_50HZ ? "50 Hz" : "Unknown!"))); + ESP_LOGCONFIG( + TAG, " Mains Filter: %s", + (filter_ == FILTER_60HZ ? LOG_STR_LITERAL("60 Hz") + : (filter_ == FILTER_50HZ ? LOG_STR_LITERAL("50 Hz") : LOG_STR_LITERAL("Unknown!")))); if (this->thermocouple_type_ < 0 || this->thermocouple_type_ > 7) { ESP_LOGCONFIG(TAG, " Thermocouple Type: Unknown"); } else { diff --git a/esphome/components/max31865/max31865.cpp b/esphome/components/max31865/max31865.cpp index 220fb4e704..e5a6fca8fb 100644 --- a/esphome/components/max31865/max31865.cpp +++ b/esphome/components/max31865/max31865.cpp @@ -80,12 +80,14 @@ void MAX31865Sensor::dump_config() { LOG_SENSOR("", "MAX31865", this); LOG_PIN(" CS Pin: ", this->cs_); LOG_UPDATE_INTERVAL(this); - ESP_LOGCONFIG(TAG, - " Reference Resistance: %.2fΩ\n" - " RTD: %u-wire %.2fΩ\n" - " Mains Filter: %s", - reference_resistance_, rtd_wires_, rtd_nominal_resistance_, - (filter_ == FILTER_60HZ ? "60 Hz" : (filter_ == FILTER_50HZ ? "50 Hz" : "Unknown!"))); + ESP_LOGCONFIG( + TAG, + " Reference Resistance: %.2fΩ\n" + " RTD: %u-wire %.2fΩ\n" + " Mains Filter: %s", + reference_resistance_, rtd_wires_, rtd_nominal_resistance_, + (filter_ == FILTER_60HZ ? LOG_STR_LITERAL("60 Hz") + : (filter_ == FILTER_50HZ ? LOG_STR_LITERAL("50 Hz") : LOG_STR_LITERAL("Unknown!")))); } void MAX31865Sensor::read_data_() { diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp index abc74b9e6d..cc53f9de7f 100644 --- a/esphome/components/mcp4461/mcp4461.cpp +++ b/esphome/components/mcp4461/mcp4461.cpp @@ -319,7 +319,7 @@ uint16_t Mcp4461Component::read_wiper_level_(uint8_t wiper_idx, bool *ok) { if (!(this->read_16_(reg, &buf))) { this->error_code_ = MCP4461_STATUS_I2C_ERROR; this->status_set_warning(); - ESP_LOGW(TAG, "Error fetching %swiper %u value", (wiper_idx > 3) ? "nonvolatile " : "", wiper_idx); + ESP_LOGW(TAG, "Error fetching %swiper %u value", (wiper_idx > 3) ? LOG_STR_LITERAL("nonvolatile ") : "", wiper_idx); return 0; } if (ok != nullptr) { @@ -377,7 +377,8 @@ void Mcp4461Component::write_wiper_level_(uint8_t wiper, uint16_t value) { if (!(this->mcp4461_write_(this->get_wiper_address_(wiper), value, nonvolatile))) { this->error_code_ = MCP4461_STATUS_I2C_ERROR; this->status_set_warning(); - ESP_LOGW(TAG, "Error writing %swiper %u level %u", (wiper > 3) ? "nonvolatile " : "", wiper, value); + ESP_LOGW(TAG, "Error writing %swiper %u level %u", (wiper > 3) ? LOG_STR_LITERAL("nonvolatile ") : "", wiper, + value); } } diff --git a/esphome/components/media_player/media_player.cpp b/esphome/components/media_player/media_player.cpp index 7dce74117a..6c3eef912e 100644 --- a/esphome/components/media_player/media_player.cpp +++ b/esphome/components/media_player/media_player.cpp @@ -122,7 +122,7 @@ void MediaPlayerCall::perform() { ESP_LOGV(TAG, " Volume: %.2f", this->volume_.value()); } if (this->announcement_.has_value()) { - ESP_LOGV(TAG, " Announcement: %s", this->announcement_.value() ? "yes" : "no"); + ESP_LOGV(TAG, " Announcement: %s", this->announcement_.value() ? LOG_STR_LITERAL("yes") : LOG_STR_LITERAL("no")); } this->parent_->control(*this); } diff --git a/esphome/components/mipi_spi/mipi_spi.cpp b/esphome/components/mipi_spi/mipi_spi.cpp index 2eec3b12d1..80ae96720b 100644 --- a/esphome/components/mipi_spi/mipi_spi.cpp +++ b/esphome/components/mipi_spi/mipi_spi.cpp @@ -25,7 +25,8 @@ void internal_dump_config(const char *model, int width, int height, int offset_w " SPI Bus width: %d", model, width, height, YESNO(madctl & MADCTL_MV), YESNO(madctl & (MADCTL_MX | MADCTL_XFLIP)), YESNO(madctl & (MADCTL_MY | MADCTL_YFLIP)), YESNO(has_hardware_rotation), YESNO(invert_colors), - (madctl & MADCTL_BGR) ? "BGR" : "RGB", display_bits, is_big_endian ? "Big" : "Little", spi_mode, + (madctl & MADCTL_BGR) ? LOG_STR_LITERAL("BGR") : LOG_STR_LITERAL("RGB"), display_bits, + is_big_endian ? LOG_STR_LITERAL("Big") : LOG_STR_LITERAL("Little"), spi_mode, static_cast(data_rate / 1000000), bus_width); LOG_PIN(" CS Pin: ", cs); LOG_PIN(" Reset Pin: ", reset); diff --git a/esphome/components/modbus_server/modbus_server.cpp b/esphome/components/modbus_server/modbus_server.cpp index feb0e67725..65bf4ef2f4 100644 --- a/esphome/components/modbus_server/modbus_server.cpp +++ b/esphome/components/modbus_server/modbus_server.cpp @@ -269,7 +269,8 @@ void ModbusServer::dump_config() { " Enabled: %s\n" " Register Last Address: 0x%02X\n" " Register Value: %" PRIu16, - this->address_, this->server_courtesy_response_.enabled ? "true" : "false", + this->address_, + this->server_courtesy_response_.enabled ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false"), this->server_courtesy_response_.register_last_address, this->server_courtesy_response_.register_value); #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE @@ -280,8 +281,9 @@ void ModbusServer::dump_config() { } ESP_LOGCONFIG(TAG, "server bits"); for (auto &b : this->server_bits_) { - ESP_LOGCONFIG(TAG, " Address=0x%04X readable=%s writable=%s", b->address, b->read_lambda ? "true" : "false", - b->write_lambda ? "true" : "false"); + ESP_LOGCONFIG(TAG, " Address=0x%04X readable=%s writable=%s", b->address, + b->read_lambda ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false"), + b->write_lambda ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false")); } #endif } diff --git a/esphome/components/nextion/nextion.cpp b/esphome/components/nextion/nextion.cpp index bdc66adb70..97910ba3d5 100644 --- a/esphome/components/nextion/nextion.cpp +++ b/esphome/components/nextion/nextion.cpp @@ -595,7 +595,8 @@ void Nextion::process_nextion_commands_() { uint8_t page_id = to_process[0]; uint8_t component_id = to_process[1]; uint8_t touch_event = to_process[2]; // 0 -> release, 1 -> press - ESP_LOGV(TAG, "Touch %s: page %u comp %u", touch_event ? "PRESS" : "RELEASE", page_id, component_id); + ESP_LOGV(TAG, "Touch %s: page %u comp %u", touch_event ? LOG_STR_LITERAL("PRESS") : LOG_STR_LITERAL("RELEASE"), + page_id, component_id); for (auto *touch : this->touch_) { touch->process_touch(page_id, component_id, touch_event != 0); } @@ -628,7 +629,7 @@ void Nextion::process_nextion_commands_() { const uint16_t x = (uint16_t(to_process[0]) << 8) | to_process[1]; const uint16_t y = (uint16_t(to_process[2]) << 8) | to_process[3]; const uint8_t touch_event = to_process[4]; // 0 -> release, 1 -> press - ESP_LOGV(TAG, "Touch %s at %u,%u", touch_event ? "PRESS" : "RELEASE", x, y); + ESP_LOGV(TAG, "Touch %s at %u,%u", touch_event ? LOG_STR_LITERAL("PRESS") : LOG_STR_LITERAL("RELEASE"), x, y); break; } diff --git a/esphome/components/pcm5122/pcm5122.cpp b/esphome/components/pcm5122/pcm5122.cpp index d178cb83b8..4f6417f6c0 100644 --- a/esphome/components/pcm5122/pcm5122.cpp +++ b/esphome/components/pcm5122/pcm5122.cpp @@ -119,7 +119,8 @@ void PCM5122::dump_config() { " Channel mix: %s\n" " Volume range: %.1f dB to %.1f dB\n" " Muted: %s", - this->bits_per_sample_, this->analog_gain_ == PCM5122_ANALOG_GAIN_0DB ? "0 dB" : "-6 dB", + this->bits_per_sample_, + this->analog_gain_ == PCM5122_ANALOG_GAIN_0DB ? LOG_STR_LITERAL("0 dB") : LOG_STR_LITERAL("-6 dB"), channel_mix_str, this->volume_min_db_, this->volume_max_db_, YESNO(this->is_muted_)); LOG_PIN(" Enable Pin: ", this->enable_pin_); } diff --git a/esphome/components/pn7150/pn7150.cpp b/esphome/components/pn7150/pn7150.cpp index 2a2724f56b..4e679c664a 100644 --- a/esphome/components/pn7150/pn7150.cpp +++ b/esphome/components/pn7150/pn7150.cpp @@ -243,8 +243,8 @@ uint8_t PN7150::reset_core_(const bool reset_config, const bool power) { } ESP_LOGD(TAG, "Configuration %s, NCI version: %s", - rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 2] ? "reset" : "retained", - rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 1] == 0x20 ? "2.0" : "1.0"); + rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 2] ? LOG_STR_LITERAL("reset") : LOG_STR_LITERAL("retained"), + rx.get_message()[nfc::NCI_PKT_PAYLOAD_OFFSET + 1] == 0x20 ? LOG_STR_LITERAL("2.0") : LOG_STR_LITERAL("1.0")); return nfc::STATUS_OK; } diff --git a/esphome/components/pn7160/pn7160.cpp b/esphome/components/pn7160/pn7160.cpp index 7abd89b371..f2cbfa6bcf 100644 --- a/esphome/components/pn7160/pn7160.cpp +++ b/esphome/components/pn7160/pn7160.cpp @@ -265,8 +265,8 @@ uint8_t PN7160::reset_core_(const bool reset_config, const bool power) { } ESP_LOGD(TAG, "Configuration %s, NCI version: %s, Manufacturer ID: 0x%02X", - rx.get_message()[4] ? "reset" : "retained", rx.get_message()[5] == 0x20 ? "2.0" : "1.0", - rx.get_message()[6]); + rx.get_message()[4] ? LOG_STR_LITERAL("reset") : LOG_STR_LITERAL("retained"), + rx.get_message()[5] == 0x20 ? LOG_STR_LITERAL("2.0") : LOG_STR_LITERAL("1.0"), rx.get_message()[6]); rx.get_message().erase(rx.get_message().begin(), rx.get_message().begin() + 8); char mfr_buf[nfc::FORMAT_BYTES_BUFFER_SIZE]; ESP_LOGD(TAG, "Manufacturer info: %s", nfc::format_bytes_to(mfr_buf, rx.get_message())); diff --git a/esphome/components/pylontech/pylontech.cpp b/esphome/components/pylontech/pylontech.cpp index 0973699da8..54d9e5c654 100644 --- a/esphome/components/pylontech/pylontech.cpp +++ b/esphome/components/pylontech/pylontech.cpp @@ -137,7 +137,8 @@ void PylontechComponent::process_line_(std::string &buffer) { } else if (strcmp(token_buf, "Power") == 0) { // header line i.e. "Power Volt Curr" and so on this->has_tlow_id_ = buffer.find("Tlow.Id") != std::string::npos; - ESP_LOGD(TAG, "header line %s Tlow.Id: %s", this->has_tlow_id_ ? "with" : "without", + ESP_LOGD(TAG, "header line %s Tlow.Id: %s", + this->has_tlow_id_ ? LOG_STR_LITERAL("with") : LOG_STR_LITERAL("without"), buffer.substr(0, buffer.size() - 2).c_str()); return; } else { diff --git a/esphome/components/rd03d/rd03d.cpp b/esphome/components/rd03d/rd03d.cpp index 2eb76a1087..18328def9f 100644 --- a/esphome/components/rd03d/rd03d.cpp +++ b/esphome/components/rd03d/rd03d.cpp @@ -55,8 +55,9 @@ void RD03DComponent::setup() { void RD03DComponent::dump_config() { ESP_LOGCONFIG(TAG, "RD-03D:"); if (this->tracking_mode_.has_value()) { - ESP_LOGCONFIG(TAG, " Tracking Mode: %s", - *this->tracking_mode_ == TrackingMode::SINGLE_TARGET ? "single" : "multi"); + ESP_LOGCONFIG( + TAG, " Tracking Mode: %s", + *this->tracking_mode_ == TrackingMode::SINGLE_TARGET ? LOG_STR_LITERAL("single") : LOG_STR_LITERAL("multi")); } if (this->throttle_ > 0) { ESP_LOGCONFIG(TAG, " Throttle: %" PRIu32 "ms", this->throttle_); diff --git a/esphome/components/remote_receiver/remote_receiver.cpp b/esphome/components/remote_receiver/remote_receiver.cpp index 36152d8854..bbcb7ae765 100644 --- a/esphome/components/remote_receiver/remote_receiver.cpp +++ b/esphome/components/remote_receiver/remote_receiver.cpp @@ -76,15 +76,16 @@ void RemoteReceiverComponent::setup() { } void RemoteReceiverComponent::dump_config() { - ESP_LOGCONFIG(TAG, - "Remote Receiver:\n" - " Buffer Size: %" PRIu32 "\n" - " Tolerance: %" PRIu32 "%s\n" - " Filter out pulses shorter than: %" PRIu32 " us\n" - " Signal is done after %" PRIu32 " us of no changes", - this->buffer_size_, this->tolerance_, - (this->tolerance_mode_ == remote_base::TOLERANCE_MODE_TIME) ? " us" : "%", this->filter_us_, - this->idle_us_); + ESP_LOGCONFIG( + TAG, + "Remote Receiver:\n" + " Buffer Size: %" PRIu32 "\n" + " Tolerance: %" PRIu32 "%s\n" + " Filter out pulses shorter than: %" PRIu32 " us\n" + " Signal is done after %" PRIu32 " us of no changes", + this->buffer_size_, this->tolerance_, + (this->tolerance_mode_ == remote_base::TOLERANCE_MODE_TIME) ? LOG_STR_LITERAL(" us") : LOG_STR_LITERAL("%"), + this->filter_us_, this->idle_us_); LOG_PIN(" Pin: ", this->pin_); } diff --git a/esphome/components/resistance/resistance_sensor.cpp b/esphome/components/resistance/resistance_sensor.cpp index 6056509093..7522d026a4 100644 --- a/esphome/components/resistance/resistance_sensor.cpp +++ b/esphome/components/resistance/resistance_sensor.cpp @@ -11,8 +11,8 @@ void ResistanceSensor::dump_config() { " Configuration: %s\n" " Resistor: %.2fΩ\n" " Reference Voltage: %.1fV", - this->configuration_ == UPSTREAM ? "UPSTREAM" : "DOWNSTREAM", this->resistor_, - this->reference_voltage_); + this->configuration_ == UPSTREAM ? LOG_STR_LITERAL("UPSTREAM") : LOG_STR_LITERAL("DOWNSTREAM"), + this->resistor_, this->reference_voltage_); } void ResistanceSensor::process_(float value) { if (std::isnan(value)) { diff --git a/esphome/components/sen21231/sen21231.cpp b/esphome/components/sen21231/sen21231.cpp index b42ba2fa1d..3f6212e7f2 100644 --- a/esphome/components/sen21231/sen21231.cpp +++ b/esphome/components/sen21231/sen21231.cpp @@ -13,7 +13,7 @@ void Sen21231Sensor::dump_config() { if (this->is_failed()) { ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL); } - ESP_LOGI(TAG, "SEN21231: %s", this->is_failed() ? "FAILED" : "OK"); + ESP_LOGI(TAG, "SEN21231: %s", this->is_failed() ? LOG_STR_LITERAL("FAILED") : LOG_STR_LITERAL("OK")); LOG_UPDATE_INTERVAL(this); } diff --git a/esphome/components/senseair/senseair.cpp b/esphome/components/senseair/senseair.cpp index 0e8e4cef97..f5017cff75 100644 --- a/esphome/components/senseair/senseair.cpp +++ b/esphome/components/senseair/senseair.cpp @@ -89,8 +89,9 @@ void SenseAirComponent::background_calibration_result() { } // Check if 5th bit (register CI6) is set - ESP_LOGI(TAG, "SenseAir Result=%s (%02x%02x%02x %02x%02x %02x%02x)", (response[4] & 0b100000) != 0 ? "OK" : "NOT_OK", - response[0], response[1], response[2], response[3], response[4], response[5], response[6]); + ESP_LOGI(TAG, "SenseAir Result=%s (%02x%02x%02x %02x%02x %02x%02x)", + (response[4] & 0b100000) != 0 ? LOG_STR_LITERAL("OK") : LOG_STR_LITERAL("NOT_OK"), response[0], response[1], + response[2], response[3], response[4], response[5], response[6]); } void SenseAirComponent::abc_enable() { diff --git a/esphome/components/serial_proxy/serial_proxy.cpp b/esphome/components/serial_proxy/serial_proxy.cpp index 94cefc8700..2ab0d4ebb4 100644 --- a/esphome/components/serial_proxy/serial_proxy.cpp +++ b/esphome/components/serial_proxy/serial_proxy.cpp @@ -82,11 +82,11 @@ void SerialProxy::dump_config() { " RTS Pin: %s\n" " DTR Pin: %s", this->instance_index_, this->name_ != nullptr ? this->name_ : "", - this->port_type_ == api::enums::SERIAL_PROXY_PORT_TYPE_RS485 ? "RS485" - : this->port_type_ == api::enums::SERIAL_PROXY_PORT_TYPE_RS232 ? "RS232" - : "TTL", - this->rts_pin_ != nullptr ? "configured" : "not configured", - this->dtr_pin_ != nullptr ? "configured" : "not configured"); + this->port_type_ == api::enums::SERIAL_PROXY_PORT_TYPE_RS485 ? LOG_STR_LITERAL("RS485") + : this->port_type_ == api::enums::SERIAL_PROXY_PORT_TYPE_RS232 ? LOG_STR_LITERAL("RS232") + : LOG_STR_LITERAL("TTL"), + this->rts_pin_ != nullptr ? LOG_STR_LITERAL("configured") : LOG_STR_LITERAL("not configured"), + this->dtr_pin_ != nullptr ? LOG_STR_LITERAL("configured") : LOG_STR_LITERAL("not configured")); } SerialProxyResult SerialProxy::configure(api::APIConnection *api_connection, uint32_t baudrate, bool flow_control, diff --git a/esphome/components/sgp4x/sgp4x.cpp b/esphome/components/sgp4x/sgp4x.cpp index bc6fe794a0..0cf5c31483 100644 --- a/esphome/components/sgp4x/sgp4x.cpp +++ b/esphome/components/sgp4x/sgp4x.cpp @@ -284,7 +284,7 @@ void SGP4xComponent::dump_config() { " Type: %s\n" " Serial number: %" PRIu64 "\n" " Minimum Samples: %f", - this->sgp_type_ == SGP41 ? "SGP41" : "SGP40", this->serial_number_, + this->sgp_type_ == SGP41 ? LOG_STR_LITERAL("SGP41") : LOG_STR_LITERAL("SGP40"), this->serial_number_, GasIndexAlgorithm_INITIAL_BLACKOUT); } LOG_UPDATE_INTERVAL(this); diff --git a/esphome/components/sprinkler/sprinkler.cpp b/esphome/components/sprinkler/sprinkler.cpp index 2edceb76a5..9fd0d9208b 100644 --- a/esphome/components/sprinkler/sprinkler.cpp +++ b/esphome/components/sprinkler/sprinkler.cpp @@ -1335,7 +1335,7 @@ void Sprinkler::all_valves_off_(const bool include_pump) { this->set_pump_state(this->valve_pump_switch(valve_index), false); } } - ESP_LOGD(TAG, "All valves stopped%s", include_pump ? ", including pumps" : ""); + ESP_LOGD(TAG, "All valves stopped%s", include_pump ? LOG_STR_LITERAL(", including pumps") : ""); } void Sprinkler::prep_full_cycle_() { diff --git a/esphome/components/switch/switch.cpp b/esphome/components/switch/switch.cpp index 101a0b9ffa..8413c7b493 100644 --- a/esphome/components/switch/switch.cpp +++ b/esphome/components/switch/switch.cpp @@ -26,7 +26,8 @@ void Switch::turn_off() { this->write_state(this->inverted_); } void Switch::toggle() { - ESP_LOGV(TAG, "'%s' Toggling %s.", this->get_name().c_str(), this->state ? "OFF" : "ON"); + ESP_LOGV(TAG, "'%s' Toggling %s.", this->get_name().c_str(), + this->state ? LOG_STR_LITERAL("OFF") : LOG_STR_LITERAL("ON")); this->write_state(this->inverted_ == this->state); } optional Switch::get_initial_state() { diff --git a/esphome/components/sx127x/sx127x.cpp b/esphome/components/sx127x/sx127x.cpp index 040a3064bc..cd81f08914 100644 --- a/esphome/components/sx127x/sx127x.cpp +++ b/esphome/components/sx127x/sx127x.cpp @@ -479,8 +479,9 @@ void SX127x::dump_config() { " Rx Start: %s\n" " Rx Floor: %.1f dBm\n" " Packet Mode: %s", - shaping, this->modulation_ == MOD_FSK ? "FSK" : "OOK", this->bitrate_, TRUEFALSE(this->bitsync_), - TRUEFALSE(this->rx_start_), this->rx_floor_, TRUEFALSE(this->packet_mode_)); + shaping, this->modulation_ == MOD_FSK ? LOG_STR_LITERAL("FSK") : LOG_STR_LITERAL("OOK"), + this->bitrate_, TRUEFALSE(this->bitsync_), TRUEFALSE(this->rx_start_), this->rx_floor_, + TRUEFALSE(this->packet_mode_)); if (this->packet_mode_) { ESP_LOGCONFIG(TAG, " CRC Enable: %s", TRUEFALSE(this->crc_enable_)); } diff --git a/esphome/components/thermostat/thermostat_climate.cpp b/esphome/components/thermostat/thermostat_climate.cpp index c10eb5b9f5..e830d359c6 100644 --- a/esphome/components/thermostat/thermostat_climate.cpp +++ b/esphome/components/thermostat/thermostat_climate.cpp @@ -1432,7 +1432,8 @@ void ThermostatClimate::dump_config() { ESP_LOGCONFIG(TAG, " On boot, restore from: %s\n" " Use Start-up Delay: %s", - this->on_boot_restore_from_ == thermostat::DEFAULT_PRESET ? "DEFAULT_PRESET" : "MEMORY", + this->on_boot_restore_from_ == thermostat::DEFAULT_PRESET ? LOG_STR_LITERAL("DEFAULT_PRESET") + : LOG_STR_LITERAL("MEMORY"), YESNO(this->use_startup_delay_)); if (this->supports_two_points_) { ESP_LOGCONFIG(TAG, " Minimum Set Point Differential: %.1f°C", this->set_point_minimum_differential_); @@ -1550,7 +1551,8 @@ void ThermostatClimate::dump_config() { ESP_LOGCONFIG(TAG, " Supported PRESETS:"); for (const auto &entry : this->preset_config_) { const auto *preset_name = LOG_STR_ARG(climate::climate_preset_to_string(entry.preset)); - ESP_LOGCONFIG(TAG, " %s:%s", preset_name, entry.preset == this->default_preset_ ? " (default)" : ""); + ESP_LOGCONFIG(TAG, " %s:%s", preset_name, + entry.preset == this->default_preset_ ? LOG_STR_LITERAL(" (default)") : ""); this->dump_preset_config_(preset_name, entry.config); } } @@ -1561,7 +1563,7 @@ void ThermostatClimate::dump_config() { const auto *preset_name = entry.name; ESP_LOGCONFIG(TAG, " %s:%s", preset_name, (this->default_custom_preset_ != nullptr && strcmp(entry.name, this->default_custom_preset_) == 0) - ? " (default)" + ? LOG_STR_LITERAL(" (default)") : ""); this->dump_preset_config_(preset_name, entry.config); } diff --git a/esphome/components/tsl2591/tsl2591.cpp b/esphome/components/tsl2591/tsl2591.cpp index fb34dd833d..2a5d6a4ee4 100644 --- a/esphome/components/tsl2591/tsl2591.cpp +++ b/esphome/components/tsl2591/tsl2591.cpp @@ -269,7 +269,7 @@ uint32_t TSL2591Component::get_combined_illuminance() { break; } // we only log this if we need any delay, since normally we don't - ESP_LOGD(TAG, " after %3d ms: ADC valid? %s", d, avalid ? "true" : "false"); + ESP_LOGD(TAG, " after %3d ms: ADC valid? %s", d, avalid ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false")); delay(mini_delay); } if (!avalid) { diff --git a/esphome/components/tuya/select/tuya_select.cpp b/esphome/components/tuya/select/tuya_select.cpp index f0fc47f504..057f7f8ea6 100644 --- a/esphome/components/tuya/select/tuya_select.cpp +++ b/esphome/components/tuya/select/tuya_select.cpp @@ -39,7 +39,7 @@ void TuyaSelect::dump_config() { " Select has datapoint ID %u\n" " Data type: %s\n" " Options are:", - this->select_id_, this->is_int_ ? "int" : "enum"); + this->select_id_, this->is_int_ ? LOG_STR_LITERAL("int") : LOG_STR_LITERAL("enum")); const auto &options = this->traits.get_options(); for (size_t i = 0; i < this->mappings_.size(); i++) { ESP_LOGCONFIG(TAG, " %i: %s", this->mappings_.at(i), options.at(i)); diff --git a/esphome/components/tuya/tuya.cpp b/esphome/components/tuya/tuya.cpp index 15ab4b6dc3..82fb96d787 100644 --- a/esphome/components/tuya/tuya.cpp +++ b/esphome/components/tuya/tuya.cpp @@ -259,7 +259,7 @@ void Tuya::handle_command_(uint8_t command, uint8_t version, const uint8_t *buff st.payload[0] = 0x04; this->send_command_(st); ESP_LOGI(TAG, "%s received (%s), replied with WIFI_STATE confirming connection established", - is_select ? "WIFI_SELECT" : "WIFI_RESET", mode_str); + is_select ? LOG_STR_LITERAL("WIFI_SELECT") : LOG_STR_LITERAL("WIFI_RESET"), mode_str); break; } case TuyaCommandType::DATAPOINT_DELIVER: diff --git a/esphome/components/veml7700/veml7700.cpp b/esphome/components/veml7700/veml7700.cpp index 594c9da170..6c609f4fe7 100644 --- a/esphome/components/veml7700/veml7700.cpp +++ b/esphome/components/veml7700/veml7700.cpp @@ -259,7 +259,7 @@ ErrorCode VEML7700Component::configure_() { ErrorCode VEML7700Component::reconfigure_time_and_gain_(IntegrationTime time, Gain gain, bool shutdown) { ESP_LOGV(TAG, "Reconfigure time and gain (%d ms, %s) %s", get_itime_ms(time), get_gain_str(gain), - shutdown ? "Shutting down" : "Turning back on"); + shutdown ? LOG_STR_LITERAL("Shutting down") : LOG_STR_LITERAL("Turning back on")); ConfigurationRegister als_conf{0}; als_conf.raw = 0; @@ -272,7 +272,7 @@ ErrorCode VEML7700Component::reconfigure_time_and_gain_(IntegrationTime time, Ga als_conf.ALS_GAIN = gain; auto err = this->write_register((uint8_t) CommandRegisters::ALS_CONF_0, als_conf.raw_bytes, VEML_REG_SIZE); if (err != i2c::ERROR_OK) { - ESP_LOGW(TAG, "%s failed", shutdown ? "Shutdown" : "Turn on"); + ESP_LOGW(TAG, "%s failed", shutdown ? LOG_STR_LITERAL("Shutdown") : LOG_STR_LITERAL("Turn on")); } return err; @@ -363,8 +363,8 @@ void VEML7700Component::apply_lux_calculation_(Readings &data) { data.fake_infrared_lux = reduce_to_zero(data.white_lux, data.als_lux); ESP_LOGV(TAG, "%s mode - ALS = %.1f lx, WHITE = %.1f lx, FAKE_IR = %.1f lx", - this->automatic_mode_enabled_ ? "Automatic" : "Manual", data.als_lux, data.white_lux, - data.fake_infrared_lux); + this->automatic_mode_enabled_ ? LOG_STR_LITERAL("Automatic") : LOG_STR_LITERAL("Manual"), data.als_lux, + data.white_lux, data.fake_infrared_lux); } void VEML7700Component::apply_lux_compensation_(Readings &data) { diff --git a/esphome/components/vl53l0x/vl53l0x_sensor.cpp b/esphome/components/vl53l0x/vl53l0x_sensor.cpp index df7929f676..49eb3d00a1 100644 --- a/esphome/components/vl53l0x/vl53l0x_sensor.cpp +++ b/esphome/components/vl53l0x/vl53l0x_sensor.cpp @@ -31,7 +31,8 @@ void VL53L0XSensor::dump_config() { ESP_LOGCONFIG(TAG, " Timeout: %" PRIu32 "%s\n" " Timing Budget %" PRIu32 "us ", - this->timeout_us_, this->timeout_us_ > 0 ? "us" : " (no timeout)", this->measurement_timing_budget_us_); + this->timeout_us_, this->timeout_us_ > 0 ? LOG_STR_LITERAL("us") : LOG_STR_LITERAL(" (no timeout)"), + this->measurement_timing_budget_us_); } void VL53L0XSensor::setup() { diff --git a/esphome/components/water_heater/water_heater.cpp b/esphome/components/water_heater/water_heater.cpp index 9862253ad9..1dc2d008a1 100644 --- a/esphome/components/water_heater/water_heater.cpp +++ b/esphome/components/water_heater/water_heater.cpp @@ -100,10 +100,11 @@ void WaterHeaterCall::perform() { ESP_LOGV(TAG, " Target Temperature High: %.2f", this->target_temperature_high_); } if (this->state_mask_ & WATER_HEATER_STATE_AWAY) { - ESP_LOGV(TAG, " Away: %s", (this->state_ & WATER_HEATER_STATE_AWAY) ? "YES" : "NO"); + ESP_LOGV(TAG, " Away: %s", + (this->state_ & WATER_HEATER_STATE_AWAY) ? LOG_STR_LITERAL("YES") : LOG_STR_LITERAL("NO")); } if (this->state_mask_ & WATER_HEATER_STATE_ON) { - ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO"); + ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? LOG_STR_LITERAL("YES") : LOG_STR_LITERAL("NO")); } this->parent_->control(*this); } @@ -178,7 +179,7 @@ void WaterHeater::publish_state() { ESP_LOGV(TAG, " Away: YES"); } if (traits.has_feature_flags(WATER_HEATER_SUPPORTS_ON_OFF)) { - ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? "YES" : "NO"); + ESP_LOGV(TAG, " On: %s", (this->state_ & WATER_HEATER_STATE_ON) ? LOG_STR_LITERAL("YES") : LOG_STR_LITERAL("NO")); } #if defined(USE_WATER_HEATER) && defined(USE_CONTROLLER_REGISTRY) diff --git a/esphome/components/weikai/weikai.cpp b/esphome/components/weikai/weikai.cpp index a19dce4db3..043df86be9 100644 --- a/esphome/components/weikai/weikai.cpp +++ b/esphome/components/weikai/weikai.cpp @@ -134,7 +134,7 @@ void WeikaiComponent::loop() { } bool status = children_[i]->uart_receive_test_(message); ESP_LOGI(TAG, "Test %s => send/received %u bytes %s - execution time %" PRIu32 " ms", message, RING_BUFFER_SIZE, - status ? "correctly" : "with error", elapsed_ms(time)); + status ? LOG_STR_LITERAL("correctly") : LOG_STR_LITERAL("with error"), elapsed_ms(time)); } } @@ -238,9 +238,9 @@ void WeikaiComponent::set_pin_direction_(uint8_t pin, gpio::Flags flags) { void WeikaiGPIOPin::setup() { ESP_LOGCONFIG(TAG, "Setting GPIO pin %d mode to %s", this->pin_, - flags_ == gpio::FLAG_INPUT ? "Input" - : this->flags_ == gpio::FLAG_OUTPUT ? "Output" - : "NOT SPECIFIED"); + this->flags_ == gpio::FLAG_INPUT ? LOG_STR_LITERAL("Input") + : this->flags_ == gpio::FLAG_OUTPUT ? LOG_STR_LITERAL("Output") + : LOG_STR_LITERAL("NOT SPECIFIED")); this->pin_mode(this->flags_); } @@ -420,7 +420,7 @@ bool WeikaiChannel::read_array(uint8_t *buffer, size_t length) { this->receive_buffer_.pop(buffer[i]); } ESP_LOGVV(TAG, "read_array(ch=%d buffer[0]=%02X, length=%d): status %s", this->channel_, *buffer, length, - status ? "OK" : "ERROR"); + status ? LOG_STR_LITERAL("OK") : LOG_STR_LITERAL("ERROR")); return status; } @@ -558,8 +558,8 @@ bool WeikaiChannel::uart_receive_test_(char *message) { } } - ESP_LOGV(TAG, "%s => received %d bytes status %s - exec time %d µs", message, received, status ? "OK" : "ERROR", - micros() - start_exec); + ESP_LOGV(TAG, "%s => received %d bytes status %s - exec time %d µs", message, received, + status ? LOG_STR_LITERAL("OK") : LOG_STR_LITERAL("ERROR"), micros() - start_exec); return status; } diff --git a/esphome/components/whirlpool/whirlpool.cpp b/esphome/components/whirlpool/whirlpool.cpp index ace96d78fc..f560917f41 100644 --- a/esphome/components/whirlpool/whirlpool.cpp +++ b/esphome/components/whirlpool/whirlpool.cpp @@ -103,7 +103,7 @@ void WhirlpoolClimate::transmit_state() { } // Swing - ESP_LOGV(TAG, "send swing %s", this->send_swing_cmd_ ? "true" : "false"); + ESP_LOGV(TAG, "send swing %s", this->send_swing_cmd_ ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false")); if (this->send_swing_cmd_) { if (this->swing_mode == climate::CLIMATE_SWING_VERTICAL || this->swing_mode == climate::CLIMATE_SWING_OFF) { remote_state[2] |= 128; diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 82755f39f7..694e616476 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -933,7 +933,7 @@ void WiFiComponent::loop() { if (semaphore_count > 0 && !this->is_high_performance_mode_) { // Transition to high-performance mode (no power save) ESP_LOGV(TAG, "Switching to high-performance mode (%" PRIu32 " active %s)", (uint32_t) semaphore_count, - semaphore_count == 1 ? "request" : "requests"); + semaphore_count == 1 ? LOG_STR_LITERAL("request") : LOG_STR_LITERAL("requests")); this->power_save_ = WIFI_POWER_SAVE_NONE; if (this->wifi_apply_power_save_()) { this->is_high_performance_mode_ = true; @@ -1181,8 +1181,9 @@ void WiFiComponent::start_connecting(const WiFiAP &ap) { " CA Cert: %s\n" " Client Cert: %s\n" " Client Key: %s", - ca_cert_present ? "present" : "not present", client_cert_present ? "present" : "not present", - client_key_present ? "present" : "not present"); + ca_cert_present ? LOG_STR_LITERAL("present") : LOG_STR_LITERAL("not present"), + client_cert_present ? LOG_STR_LITERAL("present") : LOG_STR_LITERAL("not present"), + client_key_present ? LOG_STR_LITERAL("present") : LOG_STR_LITERAL("not present")); } else { #endif ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), ap.password_.c_str()); @@ -1316,7 +1317,8 @@ void WiFiComponent::print_connect_params_() { ESP_LOGCONFIG(TAG, " BTM: %s\n" " RRM: %s", - this->btm_ ? "enabled" : "disabled", this->rrm_ ? "enabled" : "disabled"); + this->btm_ ? LOG_STR_LITERAL("enabled") : LOG_STR_LITERAL("disabled"), + this->rrm_ ? LOG_STR_LITERAL("enabled") : LOG_STR_LITERAL("disabled")); #endif } diff --git a/esphome/components/wireguard/wireguard.cpp b/esphome/components/wireguard/wireguard.cpp index 2f07344d3b..fc06569fba 100644 --- a/esphome/components/wireguard/wireguard.cpp +++ b/esphome/components/wireguard/wireguard.cpp @@ -146,18 +146,19 @@ void Wireguard::dump_config() { " Peer Pre-shared Key: " LOG_SECRET("%s"), this->address_, this->netmask_, private_key_masked, this->peer_endpoint_, this->peer_port_, this->peer_public_key_, - (this->preshared_key_ != nullptr ? preshared_key_masked : "NOT IN USE")); + (this->preshared_key_ != nullptr ? preshared_key_masked : LOG_STR_LITERAL("NOT IN USE"))); // clang-format on ESP_LOGCONFIG(TAG, " Peer Allowed IPs:"); for (const AllowedIP &allowed_ip : this->allowed_ips_) { ESP_LOGCONFIG(TAG, " - %s/%s", allowed_ip.ip, allowed_ip.netmask); } ESP_LOGCONFIG(TAG, " Peer Persistent Keepalive: %d%s", this->keepalive_, - (this->keepalive_ > 0 ? "s" : " (DISABLED)")); + (this->keepalive_ > 0 ? LOG_STR_LITERAL("s") : LOG_STR_LITERAL(" (DISABLED)"))); ESP_LOGCONFIG(TAG, " Reboot Timeout: %" PRIu32 "%s", (this->reboot_timeout_ / 1000), - (this->reboot_timeout_ != 0 ? "s" : " (DISABLED)")); + (this->reboot_timeout_ != 0 ? LOG_STR_LITERAL("s") : LOG_STR_LITERAL(" (DISABLED)"))); // be careful: if proceed_allowed_ is true, require connection is false - ESP_LOGCONFIG(TAG, " Require Connection to Proceed: %s", (this->proceed_allowed_ ? "NO" : "YES")); + ESP_LOGCONFIG(TAG, " Require Connection to Proceed: %s", + (this->proceed_allowed_ ? LOG_STR_LITERAL("NO") : LOG_STR_LITERAL("YES"))); LOG_UPDATE_INTERVAL(this); } diff --git a/esphome/components/wl_134/wl_134.cpp b/esphome/components/wl_134/wl_134.cpp index f3eb17965d..5e86d5a441 100644 --- a/esphome/components/wl_134/wl_134.cpp +++ b/esphome/components/wl_134/wl_134.cpp @@ -76,8 +76,8 @@ Wl134Component::Rfid134Error Wl134Component::read_packet_() { " isAnimal: %s\n" " Reserved0: %d\n" " Reserved1: %" PRId32, - reading.id, reading.country, reading.isData ? "true" : "false", reading.isAnimal ? "true" : "false", - reading.reserved0, reading.reserved1); + reading.id, reading.country, reading.isData ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false"), + reading.isAnimal ? LOG_STR_LITERAL("true") : LOG_STR_LITERAL("false"), reading.reserved0, reading.reserved1); char buf[20]; // "%03d" (3) + "%012" PRId64 (12) + null = 16 max buf_append_printf(buf, sizeof(buf), 0, "%03d%012" PRId64, reading.country, reading.id); diff --git a/esphome/components/zwave_proxy/zwave_proxy.cpp b/esphome/components/zwave_proxy/zwave_proxy.cpp index 68750295e1..b0d18a3e6a 100644 --- a/esphome/components/zwave_proxy/zwave_proxy.cpp +++ b/esphome/components/zwave_proxy/zwave_proxy.cpp @@ -180,11 +180,11 @@ void ZWaveProxy::process_uart_slow_() { void ZWaveProxy::dump_config() { char hex_buf[format_hex_pretty_size(ZWAVE_HOME_ID_SIZE)]; - ESP_LOGCONFIG( - TAG, - "Z-Wave Proxy:\n" - " Home ID: %s", - this->home_id_ready_ ? format_hex_pretty_to(hex_buf, this->home_id_.data(), this->home_id_.size()) : "unknown"); + ESP_LOGCONFIG(TAG, + "Z-Wave Proxy:\n" + " Home ID: %s", + this->home_id_ready_ ? format_hex_pretty_to(hex_buf, this->home_id_.data(), this->home_id_.size()) + : LOG_STR_LITERAL("unknown")); } void ZWaveProxy::api_connection_authenticated(api::APIConnection *conn) { @@ -510,7 +510,8 @@ bool ZWaveProxy::response_handler_slow_() { return false; // No response handled } - ESP_LOGVV(TAG, "Sending %s (0x%02X)", this->last_response_ == ZWAVE_FRAME_TYPE_ACK ? "ACK" : "NAK/CAN", + ESP_LOGVV(TAG, "Sending %s (0x%02X)", + this->last_response_ == ZWAVE_FRAME_TYPE_ACK ? LOG_STR_LITERAL("ACK") : LOG_STR_LITERAL("NAK/CAN"), this->last_response_); this->write_byte(this->last_response_); this->parsing_state_ = ZWAVE_PARSING_STATE_WAIT_START;