Introduce "communication failed" log macro (#8939)

This commit is contained in:
Keith Burzinski 2025-05-29 01:59:38 -05:00 committed by GitHub
parent 64e4589f4e
commit 44f1ff10e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
109 changed files with 162 additions and 152 deletions

View File

@ -17,8 +17,6 @@ void ADS1115Component::setup() {
return; return;
} }
ESP_LOGCONFIG(TAG, "Configuring ADS1115...");
uint16_t config = 0; uint16_t config = 0;
// Clear single-shot bit // Clear single-shot bit
// 0b0xxxxxxxxxxxxxxx // 0b0xxxxxxxxxxxxxxx
@ -71,7 +69,7 @@ void ADS1115Component::dump_config() {
ESP_LOGCONFIG(TAG, "ADS1115:"); ESP_LOGCONFIG(TAG, "ADS1115:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with ADS1115 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
float ADS1115Component::request_measurement(ADS1115Multiplexer multiplexer, ADS1115Gain gain, float ADS1115Component::request_measurement(ADS1115Multiplexer multiplexer, ADS1115Gain gain,

View File

@ -65,7 +65,7 @@ void AGS10Component::dump_config() {
case NONE: case NONE:
break; break;
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with AGS10 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case CRC_CHECK_FAILED: case CRC_CHECK_FAILED:
ESP_LOGE(TAG, "The crc check failed"); ESP_LOGE(TAG, "The crc check failed");

View File

@ -55,7 +55,7 @@ void AHT10Component::setup() {
break; break;
} }
if (error_code != i2c::ERROR_OK) { if (error_code != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -64,7 +64,7 @@ void AHT10Component::setup() {
while (data & AHT10_STATUS_BUSY) { while (data & AHT10_STATUS_BUSY) {
delay(AHT10_DEFAULT_DELAY); delay(AHT10_DEFAULT_DELAY);
if (this->read(&data, 1) != i2c::ERROR_OK) { if (this->read(&data, 1) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -117,7 +117,7 @@ void AHT10Component::read_data_() {
} else { } else {
ESP_LOGD(TAG, "Invalid humidity, retrying..."); ESP_LOGD(TAG, "Invalid humidity, retrying...");
if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) { if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
this->status_set_warning("Communication failed"); this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
} }
this->restart_read_(); this->restart_read_();
return; return;
@ -148,7 +148,7 @@ void AHT10Component::update() {
return; return;
this->start_time_ = millis(); this->start_time_ = millis();
if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) { if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
this->status_set_warning("Communication failed"); this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
this->restart_read_(); this->restart_read_();
@ -160,7 +160,7 @@ void AHT10Component::dump_config() {
ESP_LOGCONFIG(TAG, "AHT10:"); ESP_LOGCONFIG(TAG, "AHT10:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);

View File

@ -113,7 +113,7 @@ void AIC3204::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AIC3204 failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -188,7 +188,7 @@ void AM2315C::dump_config() {
ESP_LOGCONFIG(TAG, "AM2315C:"); ESP_LOGCONFIG(TAG, "AM2315C:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AM2315C failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);

View File

@ -47,7 +47,7 @@ void AM2320Component::dump_config() {
ESP_LOGD(TAG, "AM2320:"); ESP_LOGD(TAG, "AM2320:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AM2320 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);

View File

@ -97,7 +97,7 @@ void APDS9306::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with APDS9306 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_ID: case WRONG_ID:
ESP_LOGE(TAG, "APDS9306 has invalid id!"); ESP_LOGE(TAG, "APDS9306 has invalid id!");

View File

@ -141,7 +141,7 @@ void APDS9960::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with APDS9960 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_ID: case WRONG_ID:
ESP_LOGE(TAG, "APDS9960 has invalid id!"); ESP_LOGE(TAG, "APDS9960 has invalid id!");

View File

@ -91,7 +91,7 @@ void AS5600Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AS5600 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }

View File

@ -38,7 +38,7 @@ void AS7341Component::dump_config() {
ESP_LOGCONFIG(TAG, "AS7341:"); ESP_LOGCONFIG(TAG, "AS7341:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AS7341 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
ESP_LOGCONFIG(TAG, " Gain: %u", get_gain()); ESP_LOGCONFIG(TAG, " Gain: %u", get_gain());

View File

@ -135,7 +135,7 @@ void ATM90E26Component::dump_config() {
ESP_LOGCONFIG("", "ATM90E26:"); ESP_LOGCONFIG("", "ATM90E26:");
LOG_PIN(" CS Pin: ", this->cs_); LOG_PIN(" CS Pin: ", this->cs_);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with ATM90E26 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Voltage A", this->voltage_sensor_); LOG_SENSOR(" ", "Voltage A", this->voltage_sensor_);

View File

@ -217,7 +217,7 @@ void ATM90E32Component::dump_config() {
ESP_LOGCONFIG("", "ATM90E32:"); ESP_LOGCONFIG("", "ATM90E32:");
LOG_PIN(" CS Pin: ", this->cs_); LOG_PIN(" CS Pin: ", this->cs_);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with ATM90E32 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Voltage A", this->phase_[PHASEA].voltage_sensor_); LOG_SENSOR(" ", "Voltage A", this->phase_[PHASEA].voltage_sensor_);

View File

@ -118,7 +118,7 @@ void BH1750Sensor::dump_config() {
LOG_SENSOR("", "BH1750", this); LOG_SENSOR("", "BH1750", this);
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with BH1750 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->get_name().c_str());
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -182,7 +182,7 @@ void BME280Component::dump_config() {
ESP_LOGCONFIG(TAG, "BME280:"); ESP_LOGCONFIG(TAG, "BME280:");
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with BME280 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_CHIP_ID: case WRONG_CHIP_ID:
ESP_LOGE(TAG, "BME280 has wrong chip ID! Is it a BME280?"); ESP_LOGE(TAG, "BME280 has wrong chip ID! Is it a BME280?");

View File

@ -215,7 +215,7 @@ void BME680Component::dump_config() {
ESP_LOGCONFIG(TAG, "BME680:"); ESP_LOGCONFIG(TAG, "BME680:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with BME680 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_)); ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_));
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
@ -307,7 +307,7 @@ void BME680Component::read_data_() {
this->humidity_sensor_->publish_state(NAN); this->humidity_sensor_->publish_state(NAN);
if (this->gas_resistance_sensor_ != nullptr) if (this->gas_resistance_sensor_ != nullptr)
this->gas_resistance_sensor_->publish_state(NAN); this->gas_resistance_sensor_->publish_state(NAN);
ESP_LOGW(TAG, "Communication with BME680 failed!"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }

View File

@ -189,7 +189,7 @@ void BMI160Component::dump_config() {
ESP_LOGCONFIG(TAG, "BMI160:"); ESP_LOGCONFIG(TAG, "BMI160:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with BMI160 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_); LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);

View File

@ -132,7 +132,7 @@ void BMP280Component::dump_config() {
ESP_LOGCONFIG(TAG, "BMP280:"); ESP_LOGCONFIG(TAG, "BMP280:");
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with BMP280 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_CHIP_ID: case WRONG_CHIP_ID:
ESP_LOGE(TAG, "BMP280 has wrong chip ID! Is it a BME280?"); ESP_LOGE(TAG, "BMP280 has wrong chip ID! Is it a BME280?");

View File

@ -154,7 +154,7 @@ void BMP3XXComponent::dump_config() {
case NONE: case NONE:
break; break;
case ERROR_COMMUNICATION_FAILED: case ERROR_COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with BMP3XX failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case ERROR_WRONG_CHIP_ID: case ERROR_WRONG_CHIP_ID:
ESP_LOGE( ESP_LOGE(

View File

@ -163,7 +163,7 @@ void CCS811Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case INVALID_ID: case INVALID_ID:
ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this a CCS811?"); ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this a CCS811?");

View File

@ -37,7 +37,7 @@ void CH422GComponent::dump_config() {
ESP_LOGCONFIG(TAG, "CH422G:"); ESP_LOGCONFIG(TAG, "CH422G:");
LOG_I2C_DEVICE(this) LOG_I2C_DEVICE(this)
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with CH422G failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -23,7 +23,7 @@ void CM1106Component::setup() {
ESP_LOGCONFIG(TAG, "Running setup"); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t response[8] = {0}; uint8_t response[8] = {0};
if (!this->cm1106_write_command_(C_M1106_CMD_GET_CO2, sizeof(C_M1106_CMD_GET_CO2), response, sizeof(response))) { if (!this->cm1106_write_command_(C_M1106_CMD_GET_CO2, sizeof(C_M1106_CMD_GET_CO2), response, sizeof(response))) {
ESP_LOGE(TAG, "Communication with CM1106 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -104,7 +104,7 @@ void CM1106Component::dump_config() {
LOG_SENSOR(" ", "CO2", this->co2_sensor_); LOG_SENSOR(" ", "CO2", this->co2_sensor_);
this->check_uart_settings(9600); this->check_uart_settings(9600);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with CM1106 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -57,7 +57,7 @@ void CSE7761Component::setup() {
void CSE7761Component::dump_config() { void CSE7761Component::dump_config() {
ESP_LOGCONFIG(TAG, "CSE7761:"); ESP_LOGCONFIG(TAG, "CSE7761:");
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with CSE7761 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
this->check_uart_settings(38400, 1, uart::UART_CONFIG_PARITY_EVEN, 8); this->check_uart_settings(38400, 1, uart::UART_CONFIG_PARITY_EVEN, 8);

View File

@ -45,7 +45,7 @@ void DHT12Component::dump_config() {
ESP_LOGD(TAG, "DHT12:"); ESP_LOGD(TAG, "DHT12:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with DHT12 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);

View File

@ -91,7 +91,7 @@ void DPS310Component::dump_config() {
ESP_LOGCONFIG(TAG, " Revision ID: %u", (this->prod_rev_id_ >> 4) & 0x0F); ESP_LOGCONFIG(TAG, " Revision ID: %u", (this->prod_rev_id_ >> 4) & 0x0F);
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with DPS310 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);

View File

@ -22,7 +22,7 @@ void DS1307Component::dump_config() {
ESP_LOGCONFIG(TAG, "DS1307:"); ESP_LOGCONFIG(TAG, "DS1307:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with DS1307 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str()); ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
} }

View File

@ -35,7 +35,7 @@ void EE895Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with EE895 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case CRC_CHECK_FAILED: case CRC_CHECK_FAILED:
ESP_LOGE(TAG, "The crc check failed"); ESP_LOGE(TAG, "The crc check failed");

View File

@ -94,7 +94,7 @@ void Emc2101Component::dump_config() {
ESP_LOGCONFIG(TAG, "Emc2101 component:"); ESP_LOGCONFIG(TAG, "Emc2101 component:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with EMC2101 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_ ? "DAC" : "PWM");
if (this->dac_mode_) { if (this->dac_mode_) {
@ -110,7 +110,7 @@ void Emc2101Component::set_duty_cycle(float value) {
uint8_t duty_cycle = remap(value, 0.0f, 1.0f, (uint8_t) 0, this->max_output_value_); uint8_t duty_cycle = remap(value, 0.0f, 1.0f, (uint8_t) 0, this->max_output_value_);
ESP_LOGD(TAG, "Setting duty fan setting to %02X", duty_cycle); ESP_LOGD(TAG, "Setting duty fan setting to %02X", duty_cycle);
if (!this->write_byte(EMC2101_REGISTER_FAN_SETTING, duty_cycle)) { if (!this->write_byte(EMC2101_REGISTER_FAN_SETTING, duty_cycle)) {
ESP_LOGE(TAG, "Communication with EMC2101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }
@ -119,7 +119,7 @@ void Emc2101Component::set_duty_cycle(float value) {
float Emc2101Component::get_duty_cycle() { float Emc2101Component::get_duty_cycle() {
uint8_t duty_cycle; uint8_t duty_cycle;
if (!this->read_byte(EMC2101_REGISTER_FAN_SETTING, &duty_cycle)) { if (!this->read_byte(EMC2101_REGISTER_FAN_SETTING, &duty_cycle)) {
ESP_LOGE(TAG, "Communication with EMC2101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return NAN; return NAN;
} }
@ -129,7 +129,7 @@ float Emc2101Component::get_duty_cycle() {
float Emc2101Component::get_internal_temperature() { float Emc2101Component::get_internal_temperature() {
uint8_t temperature; uint8_t temperature;
if (!this->read_byte(EMC2101_REGISTER_INTERNAL_TEMP, &temperature)) { if (!this->read_byte(EMC2101_REGISTER_INTERNAL_TEMP, &temperature)) {
ESP_LOGE(TAG, "Communication with EMC2101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return NAN; return NAN;
} }
@ -141,7 +141,7 @@ float Emc2101Component::get_external_temperature() {
uint8_t lsb, msb; uint8_t lsb, msb;
if (!this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_MSB, &msb) || if (!this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_MSB, &msb) ||
!this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_LSB, &lsb)) { !this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_LSB, &lsb)) {
ESP_LOGE(TAG, "Communication with EMC2101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return NAN; return NAN;
} }
@ -155,7 +155,7 @@ float Emc2101Component::get_speed() {
// Read **LSB** first to match 'Data Read Interlock' behavior from 6.1 of datasheet // Read **LSB** first to match 'Data Read Interlock' behavior from 6.1 of datasheet
uint8_t lsb, msb; uint8_t lsb, msb;
if (!this->read_byte(EMC2101_REGISTER_TACH_LSB, &lsb) || !this->read_byte(EMC2101_REGISTER_TACH_MSB, &msb)) { if (!this->read_byte(EMC2101_REGISTER_TACH_LSB, &lsb) || !this->read_byte(EMC2101_REGISTER_TACH_MSB, &msb)) {
ESP_LOGE(TAG, "Communication with EMC2101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return NAN; return NAN;
} }

View File

@ -279,7 +279,7 @@ void ENS160Component::dump_config() {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case READ_FAILED: case READ_FAILED:
ESP_LOGE(TAG, "Error reading from register"); ESP_LOGE(TAG, "Error reading from register");

View File

@ -163,7 +163,7 @@ void ENS210Component::update() {
// Read T_VAL and H_VAL // Read T_VAL and H_VAL
if (!this->read_bytes(ENS210_REGISTER_T_VAL, data, 6)) { if (!this->read_bytes(ENS210_REGISTER_T_VAL, data, 6)) {
ESP_LOGE(TAG, "Communication with ENS210 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }

View File

@ -15,7 +15,7 @@ void EZOSensor::dump_config() {
LOG_SENSOR("", "EZO", this); LOG_SENSOR("", "EZO", this);
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with EZO circuit failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
} }

View File

@ -41,7 +41,7 @@ static const std::string DOSING_MODE_CONTINUOUS = "Continuous";
void EzoPMP::dump_config() { void EzoPMP::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with EZO-PMP circuit failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
} }

View File

@ -60,7 +60,7 @@ void GDK101Component::dump_config() {
ESP_LOGCONFIG(TAG, "GDK101:"); ESP_LOGCONFIG(TAG, "GDK101:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with GDK101 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
#ifdef USE_SENSOR #ifdef USE_SENSOR
LOG_SENSOR(" ", "Firmware Version", this->fw_version_sensor_); LOG_SENSOR(" ", "Firmware Version", this->fw_version_sensor_);

View File

@ -67,17 +67,17 @@ void GroveGasMultichannelV2Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case APP_INVALID: case APP_INVALID:
ESP_LOGW(TAG, "Sensor reported invalid APP installed."); ESP_LOGW(TAG, "Sensor reported invalid APP installed");
break; break;
case APP_START_FAILED: case APP_START_FAILED:
ESP_LOGW(TAG, "Sensor reported APP start failed."); ESP_LOGW(TAG, "Sensor reported APP start failed");
break; break;
case UNKNOWN: case UNKNOWN:
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} }

View File

@ -31,7 +31,7 @@ void HDC1080Component::dump_config() {
ESP_LOGCONFIG(TAG, "HDC1080:"); ESP_LOGCONFIG(TAG, "HDC1080:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with HDC1080 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_); LOG_SENSOR(" ", "Temperature", this->temperature_);

View File

@ -23,7 +23,7 @@ void HM3301Component::dump_config() {
ESP_LOGCONFIG(TAG, "HM3301:"); ESP_LOGCONFIG(TAG, "HM3301:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (error_code_ == ERROR_COMM) { if (error_code_ == ERROR_COMM) {
ESP_LOGE(TAG, "Communication with HM3301 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_); LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_);

View File

@ -73,7 +73,7 @@ void HMC5883LComponent::dump_config() {
ESP_LOGCONFIG(TAG, "HMC5883L:"); ESP_LOGCONFIG(TAG, "HMC5883L:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with HMC5883L failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} else if (this->error_code_ == ID_REGISTERS) { } else if (this->error_code_ == ID_REGISTERS) {
ESP_LOGE(TAG, "The ID registers don't match - Is this really an HMC5883L?"); ESP_LOGE(TAG, "The ID registers don't match - Is this really an HMC5883L?");
} }

View File

@ -17,7 +17,7 @@ void HoneywellHIComponent::read_sensor_data_() {
uint8_t data[4]; uint8_t data[4];
if (this->read(data, sizeof(data)) != i2c::ERROR_OK) { if (this->read(data, sizeof(data)) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -37,7 +37,7 @@ void HoneywellHIComponent::read_sensor_data_() {
void HoneywellHIComponent::start_measurement_() { void HoneywellHIComponent::start_measurement_() {
if (this->write(REQUEST_CMD, sizeof(REQUEST_CMD)) != i2c::ERROR_OK) { if (this->write(REQUEST_CMD, sizeof(REQUEST_CMD)) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -49,7 +49,7 @@ bool HoneywellHIComponent::is_measurement_ready_() {
uint8_t data[1]; uint8_t data[1];
if (this->read(data, sizeof(data)) != i2c::ERROR_OK) { if (this->read(data, sizeof(data)) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return false; return false;
} }
@ -84,7 +84,7 @@ void HoneywellHIComponent::dump_config() {
ESP_LOGD(TAG, "Honeywell HIH:"); ESP_LOGD(TAG, "Honeywell HIH:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);

View File

@ -14,7 +14,7 @@ static const char *const TAG = "honeywellabp2";
void HONEYWELLABP2Sensor::read_sensor_data() { void HONEYWELLABP2Sensor::read_sensor_data() {
if (this->read(raw_data_, 7) != i2c::ERROR_OK) { if (this->read(raw_data_, 7) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with ABP2 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning("couldn't read sensor data"); this->status_set_warning("couldn't read sensor data");
return; return;
} }
@ -30,7 +30,7 @@ void HONEYWELLABP2Sensor::read_sensor_data() {
void HONEYWELLABP2Sensor::start_measurement() { void HONEYWELLABP2Sensor::start_measurement() {
if (this->write(i2c_cmd_, 3) != i2c::ERROR_OK) { if (this->write(i2c_cmd_, 3) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with ABP2 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning("couldn't start measurement"); this->status_set_warning("couldn't start measurement");
return; return;
} }
@ -39,7 +39,7 @@ void HONEYWELLABP2Sensor::start_measurement() {
bool HONEYWELLABP2Sensor::is_measurement_ready() { bool HONEYWELLABP2Sensor::is_measurement_ready() {
if (this->read(raw_data_, 1) != i2c::ERROR_OK) { if (this->read(raw_data_, 1) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with ABP2 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning("couldn't check measurement"); this->status_set_warning("couldn't check measurement");
return false; return false;
} }

View File

@ -25,7 +25,7 @@ void HTE501Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with HTE501 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case CRC_CHECK_FAILED: case CRC_CHECK_FAILED:
ESP_LOGE(TAG, "The crc check failed"); ESP_LOGE(TAG, "The crc check failed");

View File

@ -32,7 +32,7 @@ void HTU21DComponent::dump_config() {
ESP_LOGCONFIG(TAG, "HTU21D:"); ESP_LOGCONFIG(TAG, "HTU21D:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with HTU21D failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_); LOG_SENSOR(" ", "Temperature", this->temperature_);

View File

@ -161,7 +161,7 @@ void HTU31DComponent::dump_config() {
ESP_LOGCONFIG(TAG, "HTU31D:"); ESP_LOGCONFIG(TAG, "HTU31D:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with HTU31D failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_); LOG_SENSOR(" ", "Temperature", this->temperature_);

View File

@ -21,14 +21,14 @@ void HYT271Component::update() {
if (this->write(&raw_data[0], 0) != i2c::ERROR_OK) { if (this->write(&raw_data[0], 0) != i2c::ERROR_OK) {
this->status_set_warning(); this->status_set_warning();
ESP_LOGE(TAG, "Communication with HYT271 failed! => Ask new values"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
this->set_timeout("wait_convert", 50, [this]() { this->set_timeout("wait_convert", 50, [this]() {
uint8_t raw_data[4]; uint8_t raw_data[4];
if (this->read(raw_data, 4) != i2c::ERROR_OK) { if (this->read(raw_data, 4) != i2c::ERROR_OK) {
this->status_set_warning(); this->status_set_warning();
ESP_LOGE(TAG, "Communication with HYT271 failed! => Read values"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
uint16_t raw_temperature = ((raw_data[2] << 8) | raw_data[3]) >> 2; uint16_t raw_temperature = ((raw_data[2] << 8) | raw_data[3]) >> 2;

View File

@ -26,7 +26,7 @@ struct SensorData {
void IAQCore::setup() { void IAQCore::setup() {
if (this->write(nullptr, 0) != i2c::ERROR_OK) { if (this->write(nullptr, 0) != i2c::ERROR_OK) {
ESP_LOGD(TAG, "Communication failed!"); ESP_LOGD(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -89,7 +89,7 @@ void IAQCore::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with AMS iAQ Core failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "CO2", this->co2_); LOG_SENSOR(" ", "CO2", this->co2_);
LOG_SENSOR(" ", "TVOC", this->tvoc_); LOG_SENSOR(" ", "TVOC", this->tvoc_);

View File

@ -134,7 +134,7 @@ void INA219Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with INA219 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -88,7 +88,7 @@ void INA226Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with INA226 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -203,7 +203,7 @@ void INA2XX::dump_config() {
this->dev_id_); this->dev_id_);
} }
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with INA2xx failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
ESP_LOGCONFIG(TAG, " Shunt resistance = %f Ohm", this->shunt_resistance_ohm_); ESP_LOGCONFIG(TAG, " Shunt resistance = %f Ohm", this->shunt_resistance_ohm_);

View File

@ -60,7 +60,7 @@ void INA3221Component::dump_config() {
ESP_LOGCONFIG(TAG, "INA3221:"); ESP_LOGCONFIG(TAG, "INA3221:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with INA3221 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -10,7 +10,7 @@ static const char *const TAG = "kamstrup_kmp";
void KamstrupKMPComponent::dump_config() { void KamstrupKMPComponent::dump_config() {
ESP_LOGCONFIG(TAG, "kamstrup_kmp:"); ESP_LOGCONFIG(TAG, "kamstrup_kmp:");
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with Kamstrup meter failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -26,7 +26,7 @@ void PCF8574LCDDisplay::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with LCD Display failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
void PCF8574LCDDisplay::write_n_bits(uint8_t value, uint8_t n) { void PCF8574LCDDisplay::write_n_bits(uint8_t value, uint8_t n) {

View File

@ -113,7 +113,7 @@ void LTRAlsPs501Component::dump_config() {
LOG_SENSOR(" ", "Actual gain", this->actual_gain_sensor_); LOG_SENSOR(" ", "Actual gain", this->actual_gain_sensor_);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with I2C LTR-501/301/558 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -105,7 +105,7 @@ void LTRAlsPsComponent::dump_config() {
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with I2C LTR-303/329/55x/659 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -76,7 +76,7 @@ void MAX17043Component::dump_config() {
ESP_LOGCONFIG(TAG, "MAX17043:"); ESP_LOGCONFIG(TAG, "MAX17043:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MAX17043 failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Battery Voltage", this->voltage_sensor_); LOG_SENSOR(" ", "Battery Voltage", this->voltage_sensor_);

View File

@ -48,7 +48,7 @@ void MAX44009Sensor::dump_config() {
ESP_LOGCONFIG(TAG, "MAX44009:"); ESP_LOGCONFIG(TAG, "MAX44009:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MAX44009 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -20,7 +20,7 @@ void MCP4725::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with MCP4725 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -21,7 +21,7 @@ void MCP4728Component::dump_config() {
ESP_LOGCONFIG(TAG, "MCP4728:"); ESP_LOGCONFIG(TAG, "MCP4728:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MCP4728 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -23,13 +23,13 @@ void MCP9808Sensor::setup() {
uint16_t manu = 0; uint16_t manu = 0;
if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) { if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) {
this->mark_failed(); this->mark_failed();
ESP_LOGE(TAG, "%s manufacuturer id failed, device returned %X", this->name_.c_str(), manu); ESP_LOGE(TAG, "Incorrect manufacturer ID (%X) for '%s'", manu, this->name_.c_str());
return; return;
} }
uint16_t dev_id = 0; uint16_t dev_id = 0;
if (!this->read_byte_16(MCP9808_REG_DEVICE_ID, &dev_id) || dev_id != MCP9808_DEV_ID) { if (!this->read_byte_16(MCP9808_REG_DEVICE_ID, &dev_id) || dev_id != MCP9808_DEV_ID) {
this->mark_failed(); this->mark_failed();
ESP_LOGE(TAG, "%s device id failed, device returned %X", this->name_.c_str(), dev_id); ESP_LOGE(TAG, "Incorrect device ID (%X) for '%s'", dev_id, this->name_.c_str());
return; return;
} }
} }
@ -37,7 +37,7 @@ void MCP9808Sensor::dump_config() {
ESP_LOGCONFIG(TAG, "%s:", this->name_.c_str()); ESP_LOGCONFIG(TAG, "%s:", this->name_.c_str());
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with %s failed!", this->name_.c_str()); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->name_.c_str());
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this); LOG_SENSOR(" ", "Temperature", this);

View File

@ -122,7 +122,7 @@ void MLX90393Cls::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MLX90393 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -29,7 +29,7 @@ static const char *const TAG = "mlx90614";
void MLX90614Component::setup() { void MLX90614Component::setup() {
ESP_LOGCONFIG(TAG, "Running setup"); ESP_LOGCONFIG(TAG, "Running setup");
if (!this->write_emissivity_()) { if (!this->write_emissivity_()) {
ESP_LOGE(TAG, "Communication with MLX90614 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -79,7 +79,7 @@ void MLX90614Component::dump_config() {
ESP_LOGCONFIG(TAG, "MLX90614:"); ESP_LOGCONFIG(TAG, "MLX90614:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MLX90614 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Ambient", this->ambient_sensor_); LOG_SENSOR(" ", "Ambient", this->ambient_sensor_);

View File

@ -79,7 +79,7 @@ void MMC5603Component::dump_config() {
ESP_LOGCONFIG(TAG, "MMC5603:"); ESP_LOGCONFIG(TAG, "MMC5603:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with MMC5603 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} else if (this->error_code_ == ID_REGISTERS) { } else if (this->error_code_ == ID_REGISTERS) {
ESP_LOGE(TAG, "The ID registers don't match - Is this really an MMC5603?"); ESP_LOGE(TAG, "The ID registers don't match - Is this really an MMC5603?");
} }

View File

@ -37,7 +37,7 @@ void MPL3115A2Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with MPL3115A2 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_ID: case WRONG_ID:
ESP_LOGE(TAG, "MPL3115A2 has invalid id"); ESP_LOGE(TAG, "MPL3115A2 has invalid id");

View File

@ -72,7 +72,7 @@ void MPR121Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with MPR121 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case WRONG_CHIP_STATE: case WRONG_CHIP_STATE:
ESP_LOGE(TAG, "MPR121 has wrong default value for CONFIG2?"); ESP_LOGE(TAG, "MPR121 has wrong default value for CONFIG2?");

View File

@ -86,7 +86,7 @@ void MPU6050Component::dump_config() {
ESP_LOGCONFIG(TAG, "MPU6050:"); ESP_LOGCONFIG(TAG, "MPU6050:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MPU6050 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_); LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);

View File

@ -91,7 +91,7 @@ void MPU6886Component::dump_config() {
ESP_LOGCONFIG(TAG, "MPU6886:"); ESP_LOGCONFIG(TAG, "MPU6886:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MPU6886 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_); LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);

View File

@ -32,7 +32,7 @@ void MS5611Component::dump_config() {
ESP_LOGCONFIG(TAG, "MS5611:"); ESP_LOGCONFIG(TAG, "MS5611:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MS5611 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);

View File

@ -140,7 +140,7 @@ void MS8607Component::dump_config() {
// LOG_I2C_DEVICE doesn't work for humidity, the `address_` is protected. Log using get_address() // LOG_I2C_DEVICE doesn't work for humidity, the `address_` is protected. Log using get_address()
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->humidity_device_->get_address()); ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->humidity_device_->get_address());
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MS8607 failed."); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
switch (this->error_code_) { switch (this->error_code_) {
case ErrorCode::PT_RESET_FAILED: case ErrorCode::PT_RESET_FAILED:
ESP_LOGE(TAG, "Temperature/Pressure RESET failed"); ESP_LOGE(TAG, "Temperature/Pressure RESET failed");

View File

@ -159,7 +159,7 @@ void MSA3xxComponent::dump_config() {
ESP_LOGCONFIG(TAG, "MSA3xx:"); ESP_LOGCONFIG(TAG, "MSA3xx:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with MSA3xx failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
ESP_LOGCONFIG(TAG, " Model: %s", model_to_string(this->model_)); ESP_LOGCONFIG(TAG, " Model: %s", model_to_string(this->model_));
ESP_LOGCONFIG(TAG, " Power Mode: %s", power_mode_to_string(this->power_mode_)); ESP_LOGCONFIG(TAG, " Power Mode: %s", power_mode_to_string(this->power_mode_));

View File

@ -127,7 +127,7 @@ void NAU7802Sensor::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with NAU7802 failed earlier, during setup"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->get_name().c_str());
return; return;
} }
// Note these may differ from the values on the device if calbration has been run // Note these may differ from the values on the device if calbration has been run

View File

@ -17,12 +17,10 @@ void NPI19Component::setup() {
uint16_t raw_pressure(0); uint16_t raw_pressure(0);
i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure); i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure);
if (err != i2c::ERROR_OK) { if (err != i2c::ERROR_OK) {
ESP_LOGCONFIG(TAG, " I2C Communication Failed..."); ESP_LOGCONFIG(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
ESP_LOGCONFIG(TAG, " Success...");
} }
void NPI19Component::dump_config() { void NPI19Component::dump_config() {
@ -90,7 +88,7 @@ void NPI19Component::update() {
i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure); i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure);
if (err != i2c::ERROR_OK) { if (err != i2c::ERROR_OK) {
ESP_LOGW(TAG, "I2C Communication Failed"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }

View File

@ -60,7 +60,7 @@ void PCA6416AComponent::dump_config() {
} }
LOG_I2C_DEVICE(this) LOG_I2C_DEVICE(this)
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCA6416A failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -49,7 +49,7 @@ void PCA9554Component::dump_config() {
ESP_LOGCONFIG(TAG, " I/O Pins: %d", this->pin_count_); ESP_LOGCONFIG(TAG, " I/O Pins: %d", this->pin_count_);
LOG_I2C_DEVICE(this) LOG_I2C_DEVICE(this)
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCA9554 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -22,7 +22,7 @@ void PCF85063Component::dump_config() {
ESP_LOGCONFIG(TAG, "PCF85063:"); ESP_LOGCONFIG(TAG, "PCF85063:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCF85063 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str()); ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
} }

View File

@ -22,7 +22,7 @@ void PCF8563Component::dump_config() {
ESP_LOGCONFIG(TAG, "PCF8563:"); ESP_LOGCONFIG(TAG, "PCF8563:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCF8563 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str()); ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
} }

View File

@ -22,7 +22,7 @@ void PCF8574Component::dump_config() {
LOG_I2C_DEVICE(this) LOG_I2C_DEVICE(this)
ESP_LOGCONFIG(TAG, " Is PCF8575: %s", YESNO(this->pcf8575_)); ESP_LOGCONFIG(TAG, " Is PCF8575: %s", YESNO(this->pcf8575_));
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCF8574 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
bool PCF8574Component::digital_read(uint8_t pin) { bool PCF8574Component::digital_read(uint8_t pin) {

View File

@ -55,7 +55,7 @@ void PM2005Component::setup() {
} }
if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) { if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -108,7 +108,7 @@ void PM2005Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PM2%u05 failed", this->sensor_type_ == PM2105); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_); LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_);

View File

@ -59,7 +59,7 @@ void PMWCS3Component::dump_config() {
ESP_LOGCONFIG(TAG, "PMWCS3"); ESP_LOGCONFIG(TAG, "PMWCS3");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "e25", this->e25_sensor_); LOG_SENSOR(" ", "e25", this->e25_sensor_);

View File

@ -69,7 +69,7 @@ void QMC5883LComponent::dump_config() {
ESP_LOGCONFIG(TAG, "QMC5883L:"); ESP_LOGCONFIG(TAG, "QMC5883L:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with QMC5883L failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -368,7 +368,7 @@ void QMP6988Component::dump_config() {
ESP_LOGCONFIG(TAG, "QMP6988:"); ESP_LOGCONFIG(TAG, "QMP6988:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with QMP6988 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -58,7 +58,7 @@ void QwiicPIRComponent::setup() {
void QwiicPIRComponent::loop() { void QwiicPIRComponent::loop() {
// Read Event Register // Read Event Register
if (!this->read_byte(QWIIC_PIR_EVENT_STATUS, &this->event_register_.reg)) { if (!this->read_byte(QWIIC_PIR_EVENT_STATUS, &this->event_register_.reg)) {
ESP_LOGW(TAG, "Failed to communicate with sensor"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }

View File

@ -122,16 +122,16 @@ void SCD30Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case MEASUREMENT_INIT_FAILED: case MEASUREMENT_INIT_FAILED:
ESP_LOGW(TAG, "Measurement Initialization failed!"); ESP_LOGW(TAG, "Measurement Initialization failed");
break; break;
case FIRMWARE_IDENTIFICATION_FAILED: case FIRMWARE_IDENTIFICATION_FAILED:
ESP_LOGW(TAG, "Unable to read sensor firmware version"); ESP_LOGW(TAG, "Unable to read sensor firmware version");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} }

View File

@ -96,16 +96,16 @@ void SCD4XComponent::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case MEASUREMENT_INIT_FAILED: case MEASUREMENT_INIT_FAILED:
ESP_LOGW(TAG, "Measurement Initialization failed!"); ESP_LOGW(TAG, "Measurement Initialization failed");
break; break;
case SERIAL_NUMBER_IDENTIFICATION_FAILED: case SERIAL_NUMBER_IDENTIFICATION_FAILED:
ESP_LOGW(TAG, "Unable to read sensor firmware version"); ESP_LOGW(TAG, "Unable to read sensor firmware version");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} }

View File

@ -21,7 +21,7 @@ void Sen0321Sensor::dump_config() {
ESP_LOGCONFIG(TAG, "DF Robot Ozone Sensor sen0321:"); ESP_LOGCONFIG(TAG, "DF Robot Ozone Sensor sen0321:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with sen0321 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
} }

View File

@ -12,7 +12,7 @@ void Sen21231Sensor::dump_config() {
ESP_LOGCONFIG(TAG, "SEN21231:"); ESP_LOGCONFIG(TAG, "SEN21231:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with SEN21231 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() ? "FAILED" : "OK");
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -245,10 +245,10 @@ void SEN5XComponent::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case MEASUREMENT_INIT_FAILED: case MEASUREMENT_INIT_FAILED:
ESP_LOGW(TAG, "Measurement Initialization failed!"); ESP_LOGW(TAG, "Measurement Initialization failed");
break; break;
case SERIAL_NUMBER_IDENTIFICATION_FAILED: case SERIAL_NUMBER_IDENTIFICATION_FAILED:
ESP_LOGW(TAG, "Unable to read sensor serial id"); ESP_LOGW(TAG, "Unable to read sensor serial id");
@ -260,7 +260,7 @@ void SEN5XComponent::dump_config() {
ESP_LOGW(TAG, "Unable to read sensor firmware version"); ESP_LOGW(TAG, "Unable to read sensor firmware version");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} }

View File

@ -232,19 +232,19 @@ void SGP30Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case MEASUREMENT_INIT_FAILED: case MEASUREMENT_INIT_FAILED:
ESP_LOGW(TAG, "Measurement Initialization failed!"); ESP_LOGW(TAG, "Measurement Initialization failed");
break; break;
case INVALID_ID: case INVALID_ID:
ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this an SGP30?"); ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this an SGP30?");
break; break;
case UNSUPPORTED_ID: case UNSUPPORTED_ID:
ESP_LOGW(TAG, "Sensor reported an unsupported ID (SGPC3)."); ESP_LOGW(TAG, "Sensor reported an unsupported ID (SGPC3)");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} else { } else {

View File

@ -275,17 +275,17 @@ void SGP4xComponent::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case SERIAL_NUMBER_IDENTIFICATION_FAILED: case SERIAL_NUMBER_IDENTIFICATION_FAILED:
ESP_LOGW(TAG, "Get Serial number failed."); ESP_LOGW(TAG, "Get Serial number failed");
break; break;
case SELF_TEST_FAILED: case SELF_TEST_FAILED:
ESP_LOGW(TAG, "Self test failed."); ESP_LOGW(TAG, "Self test failed");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} else { } else {

View File

@ -59,7 +59,7 @@ void SHT4XComponent::dump_config() {
ESP_LOGCONFIG(TAG, "SHT4x:"); ESP_LOGCONFIG(TAG, "SHT4x:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with SHT4x failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -60,7 +60,7 @@ void SHTCXComponent::dump_config() {
ESP_LOGCONFIG(TAG, " Model: %s (%04x)", to_string(this->type_), this->sensor_id_); ESP_LOGCONFIG(TAG, " Model: %s (%04x)", to_string(this->type_), this->sensor_id_);
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with SHTCx failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -73,10 +73,10 @@ void SPS30Component::dump_config() {
if (this->is_failed()) { if (this->is_failed()) {
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case MEASUREMENT_INIT_FAILED: case MEASUREMENT_INIT_FAILED:
ESP_LOGW(TAG, "Measurement Initialization failed!"); ESP_LOGW(TAG, "Measurement Initialization failed");
break; break;
case SERIAL_NUMBER_REQUEST_FAILED: case SERIAL_NUMBER_REQUEST_FAILED:
ESP_LOGW(TAG, "Unable to request sensor serial number"); ESP_LOGW(TAG, "Unable to request sensor serial number");
@ -91,7 +91,7 @@ void SPS30Component::dump_config() {
ESP_LOGW(TAG, "Unable to read sensor firmware version"); ESP_LOGW(TAG, "Unable to read sensor firmware version");
break; break;
default: default:
ESP_LOGW(TAG, "Unknown setup error!"); ESP_LOGW(TAG, "Unknown setup error");
break; break;
} }
} }

View File

@ -33,7 +33,7 @@ void I2CSSD1306::dump_config() {
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with SSD1306 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
void I2CSSD1306::command(uint8_t value) { this->write_byte(0x00, value); } void I2CSSD1306::command(uint8_t value) { this->write_byte(0x00, value); }

View File

@ -27,7 +27,7 @@ void I2CSSD1327::dump_config() {
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with SSD1327 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
void I2CSSD1327::command(uint8_t value) { this->write_byte(0x00, value); } void I2CSSD1327::command(uint8_t value) { this->write_byte(0x00, value); }

View File

@ -30,7 +30,7 @@ void I2CST7567::dump_config() {
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
if (this->error_code_ == COMMUNICATION_FAILED) { if (this->error_code_ == COMMUNICATION_FAILED) {
ESP_LOGE(TAG, "Communication with I2C ST7567 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }

View File

@ -36,7 +36,7 @@ void STS3XComponent::dump_config() {
ESP_LOGCONFIG(TAG, "STS3x:"); ESP_LOGCONFIG(TAG, "STS3x:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with ST3x failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -30,7 +30,7 @@ void TCA9555Component::dump_config() {
ESP_LOGCONFIG(TAG, "TCA9555:"); ESP_LOGCONFIG(TAG, "TCA9555:");
LOG_I2C_DEVICE(this) LOG_I2C_DEVICE(this)
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with TCA9555 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
} }
void TCA9555Component::pin_mode(uint8_t pin, gpio::Flags flags) { void TCA9555Component::pin_mode(uint8_t pin, gpio::Flags flags) {

View File

@ -46,7 +46,7 @@ void TCS34725Component::dump_config() {
ESP_LOGCONFIG(TAG, "TCS34725:"); ESP_LOGCONFIG(TAG, "TCS34725:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with TCS34725 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);

View File

@ -25,7 +25,7 @@ void TEE501Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
switch (this->error_code_) { switch (this->error_code_) {
case COMMUNICATION_FAILED: case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with TEE501 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
break; break;
case CRC_CHECK_FAILED: case CRC_CHECK_FAILED:
ESP_LOGE(TAG, "The crc check failed"); ESP_LOGE(TAG, "The crc check failed");

View File

@ -24,7 +24,7 @@ void TEM3200Component::setup() {
i2c::ErrorCode err = this->read_(status, raw_temperature, raw_pressure); i2c::ErrorCode err = this->read_(status, raw_temperature, raw_pressure);
if (err != i2c::ERROR_OK) { if (err != i2c::ERROR_OK) {
ESP_LOGCONFIG(TAG, " I2C Communication Failed..."); ESP_LOGCONFIG(TAG, ESP_LOG_MSG_COMM_FAIL);
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -115,7 +115,7 @@ void TEM3200Component::update() {
i2c::ErrorCode err = this->read_(status, raw_temperature, raw_pressure); i2c::ErrorCode err = this->read_(status, raw_temperature, raw_pressure);
if (err != i2c::ERROR_OK) { if (err != i2c::ERROR_OK) {
ESP_LOGW(TAG, "I2C Communication Failed"); ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }

View File

@ -19,7 +19,7 @@ void TMP102Component::dump_config() {
ESP_LOGCONFIG(TAG, "TMP102:"); ESP_LOGCONFIG(TAG, "TMP102:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication failed"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this); LOG_SENSOR(" ", "Temperature", this);

View File

@ -44,7 +44,7 @@ void TMP1075Sensor::update() {
void TMP1075Sensor::dump_config() { void TMP1075Sensor::dump_config() {
LOG_SENSOR("", "TMP1075 Sensor", this); LOG_SENSOR("", "TMP1075 Sensor", this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, " Communication with TMP1075 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return; return;
} }
ESP_LOGCONFIG(TAG, " limit low : %.4f °C", alert_limit_low_); ESP_LOGCONFIG(TAG, " limit low : %.4f °C", alert_limit_low_);

View File

@ -43,7 +43,7 @@ void TMP117Component::dump_config() {
ESP_LOGD(TAG, "TMP117:"); ESP_LOGD(TAG, "TMP117:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with TMP117 failed!"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
} }
LOG_SENSOR(" ", "Temperature", this); LOG_SENSOR(" ", "Temperature", this);
} }

View File

@ -27,7 +27,7 @@ void TOF10120Sensor::setup() {}
void TOF10120Sensor::update() { void TOF10120Sensor::update() {
if (!this->write_bytes(TOF10120_DISTANCE_REGISTER, TOF10120_READ_DISTANCE_CMD, sizeof(TOF10120_READ_DISTANCE_CMD))) { if (!this->write_bytes(TOF10120_DISTANCE_REGISTER, TOF10120_READ_DISTANCE_CMD, sizeof(TOF10120_READ_DISTANCE_CMD))) {
ESP_LOGE(TAG, "Communication with TOF10120 failed on write"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }
@ -39,7 +39,7 @@ void TOF10120Sensor::update() {
} }
delay(TOF10120_DEFAULT_DELAY); delay(TOF10120_DEFAULT_DELAY);
if (this->read(data, 2) != i2c::ERROR_OK) { if (this->read(data, 2) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication with TOF10120 failed on read"); ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
this->status_set_warning(); this->status_set_warning();
return; return;
} }

Some files were not shown because too many files have changed in this diff Show More