Compare commits
14 Commits
bluetooth_
...
less_than_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8219f15333 | ||
|
|
3aac6c0c05 | ||
|
|
7cb7aa7932 | ||
|
|
0dc49d5016 | ||
|
|
cc33881b45 | ||
|
|
2a0e5d49d5 | ||
|
|
4038bbd817 | ||
|
|
9ce8fd8860 | ||
|
|
5450b51300 | ||
|
|
342a662a68 | ||
|
|
8ff20141ed | ||
|
|
52805122e7 | ||
|
|
3107e2f85e | ||
|
|
8f152c5a0a |
@@ -593,20 +593,15 @@ def command_update_all(args):
|
||||
middle_text = f" {middle_text} "
|
||||
width = len(click.unstyle(middle_text))
|
||||
half_line = "=" * ((twidth - width) // 2)
|
||||
safe_print(f"{half_line}{middle_text}{half_line}")
|
||||
click.echo(f"{half_line}{middle_text}{half_line}")
|
||||
|
||||
for f in files:
|
||||
safe_print(f"Updating {color(AnsiFore.CYAN, f)}")
|
||||
safe_print("-" * twidth)
|
||||
safe_print()
|
||||
if CORE.dashboard:
|
||||
rc = run_external_process(
|
||||
"esphome", "--dashboard", "run", f, "--no-logs", "--device", "OTA"
|
||||
)
|
||||
else:
|
||||
rc = run_external_process(
|
||||
"esphome", "run", f, "--no-logs", "--device", "OTA"
|
||||
)
|
||||
print(f"Updating {color(AnsiFore.CYAN, f)}")
|
||||
print("-" * twidth)
|
||||
print()
|
||||
rc = run_external_process(
|
||||
"esphome", "--dashboard", "run", f, "--no-logs", "--device", "OTA"
|
||||
)
|
||||
if rc == 0:
|
||||
print_bar(f"[{color(AnsiFore.BOLD_GREEN, 'SUCCESS')}] {f}")
|
||||
success[f] = True
|
||||
@@ -614,17 +609,17 @@ def command_update_all(args):
|
||||
print_bar(f"[{color(AnsiFore.BOLD_RED, 'ERROR')}] {f}")
|
||||
success[f] = False
|
||||
|
||||
safe_print()
|
||||
safe_print()
|
||||
safe_print()
|
||||
print()
|
||||
print()
|
||||
print()
|
||||
|
||||
print_bar(f"[{color(AnsiFore.BOLD_WHITE, 'SUMMARY')}]")
|
||||
failed = 0
|
||||
for f in files:
|
||||
if success[f]:
|
||||
safe_print(f" - {f}: {color(AnsiFore.GREEN, 'SUCCESS')}")
|
||||
print(f" - {f}: {color(AnsiFore.GREEN, 'SUCCESS')}")
|
||||
else:
|
||||
safe_print(f" - {f}: {color(AnsiFore.BOLD_RED, 'FAILED')}")
|
||||
print(f" - {f}: {color(AnsiFore.BOLD_RED, 'FAILED')}")
|
||||
failed += 1
|
||||
return failed
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ void ADS1115Component::setup() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGCONFIG(TAG, "Configuring ADS1115...");
|
||||
|
||||
uint16_t config = 0;
|
||||
// Clear single-shot bit
|
||||
// 0b0xxxxxxxxxxxxxxx
|
||||
@@ -69,7 +71,7 @@ void ADS1115Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ADS1115:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ADS1115 failed!");
|
||||
}
|
||||
}
|
||||
float ADS1115Component::request_measurement(ADS1115Multiplexer multiplexer, ADS1115Gain gain,
|
||||
|
||||
@@ -65,7 +65,7 @@ void AGS10Component::dump_config() {
|
||||
case NONE:
|
||||
break;
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AGS10 failed!");
|
||||
break;
|
||||
case CRC_CHECK_FAILED:
|
||||
ESP_LOGE(TAG, "The crc check failed");
|
||||
|
||||
@@ -55,7 +55,7 @@ void AHT10Component::setup() {
|
||||
break;
|
||||
}
|
||||
if (error_code != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication failed");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void AHT10Component::setup() {
|
||||
while (data & AHT10_STATUS_BUSY) {
|
||||
delay(AHT10_DEFAULT_DELAY);
|
||||
if (this->read(&data, 1) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication failed");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void AHT10Component::read_data_() {
|
||||
} else {
|
||||
ESP_LOGD(TAG, "Invalid humidity, retrying...");
|
||||
if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
|
||||
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
|
||||
this->status_set_warning("Communication failed");
|
||||
}
|
||||
this->restart_read_();
|
||||
return;
|
||||
@@ -148,7 +148,7 @@ void AHT10Component::update() {
|
||||
return;
|
||||
this->start_time_ = millis();
|
||||
if (this->write(AHT10_MEASURE_CMD, sizeof(AHT10_MEASURE_CMD)) != i2c::ERROR_OK) {
|
||||
this->status_set_warning(ESP_LOG_MSG_COMM_FAIL);
|
||||
this->status_set_warning("Communication failed");
|
||||
return;
|
||||
}
|
||||
this->restart_read_();
|
||||
@@ -160,7 +160,7 @@ void AHT10Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "AHT10:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication failed");
|
||||
}
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -113,7 +113,7 @@ void AIC3204::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AIC3204 failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ void AM2315C::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "AM2315C:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AM2315C failed!");
|
||||
}
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -47,7 +47,7 @@ void AM2320Component::dump_config() {
|
||||
ESP_LOGD(TAG, "AM2320:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AM2320 failed!");
|
||||
}
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -97,7 +97,7 @@ void APDS9306::dump_config() {
|
||||
if (this->is_failed()) {
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with APDS9306 failed!");
|
||||
break;
|
||||
case WRONG_ID:
|
||||
ESP_LOGE(TAG, "APDS9306 has invalid id!");
|
||||
|
||||
@@ -141,7 +141,7 @@ void APDS9960::dump_config() {
|
||||
if (this->is_failed()) {
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with APDS9960 failed!");
|
||||
break;
|
||||
case WRONG_ID:
|
||||
ESP_LOGE(TAG, "APDS9960 has invalid id!");
|
||||
|
||||
@@ -831,15 +831,12 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
||||
|
||||
// read header
|
||||
while (!rx_header_parsed_) {
|
||||
// Now that we know when the socket is ready, we can read up to 3 bytes
|
||||
// into the rx_header_buf_ before we have to switch back to reading
|
||||
// one byte at a time to ensure we don't read past the message and
|
||||
// into the next one.
|
||||
|
||||
// Read directly into rx_header_buf_ at the current position
|
||||
// Try to get to at least 3 bytes total (indicator + 2 varint bytes), then read one byte at a time
|
||||
ssize_t received =
|
||||
this->socket_->read(&rx_header_buf_[rx_header_buf_pos_], rx_header_buf_pos_ < 3 ? 3 - rx_header_buf_pos_ : 1);
|
||||
uint8_t data;
|
||||
// Reading one byte at a time is fastest in practice for ESP32 when
|
||||
// there is no data on the wire (which is the common case).
|
||||
// This results in faster failure detection compared to
|
||||
// attempting to read multiple bytes at once.
|
||||
ssize_t received = this->socket_->read(&data, 1);
|
||||
if (received == -1) {
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||
return APIError::WOULD_BLOCK;
|
||||
@@ -853,46 +850,51 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
||||
return APIError::CONNECTION_CLOSED;
|
||||
}
|
||||
|
||||
// If this was the first read, validate the indicator byte
|
||||
if (rx_header_buf_pos_ == 0 && received > 0) {
|
||||
if (rx_header_buf_[0] != 0x00) {
|
||||
// Successfully read a byte
|
||||
|
||||
// Process byte according to current buffer position
|
||||
if (rx_header_buf_pos_ == 0) { // Case 1: First byte (indicator byte)
|
||||
if (data != 0x00) {
|
||||
state_ = State::FAILED;
|
||||
HELPER_LOG("Bad indicator byte %u", rx_header_buf_[0]);
|
||||
HELPER_LOG("Bad indicator byte %u", data);
|
||||
return APIError::BAD_INDICATOR;
|
||||
}
|
||||
// We don't store the indicator byte, just increment position
|
||||
rx_header_buf_pos_ = 1; // Set to 1 directly
|
||||
continue; // Need more bytes before we can parse
|
||||
}
|
||||
|
||||
rx_header_buf_pos_ += received;
|
||||
|
||||
// Check for buffer overflow
|
||||
if (rx_header_buf_pos_ >= sizeof(rx_header_buf_)) {
|
||||
// Check buffer overflow before storing
|
||||
if (rx_header_buf_pos_ == 5) { // Case 2: Buffer would overflow (5 bytes is max allowed)
|
||||
state_ = State::FAILED;
|
||||
HELPER_LOG("Header buffer overflow");
|
||||
return APIError::BAD_DATA_PACKET;
|
||||
}
|
||||
|
||||
// Need at least 3 bytes total (indicator + 2 varint bytes) before trying to parse
|
||||
if (rx_header_buf_pos_ < 3) {
|
||||
continue;
|
||||
// Store byte in buffer (adjust index to account for skipped indicator byte)
|
||||
rx_header_buf_[rx_header_buf_pos_ - 1] = data;
|
||||
|
||||
// Increment position after storing
|
||||
rx_header_buf_pos_++;
|
||||
|
||||
// Case 3: If we only have one varint byte, we need more
|
||||
if (rx_header_buf_pos_ == 2) { // Have read indicator + 1 byte
|
||||
continue; // Need more bytes before we can parse
|
||||
}
|
||||
|
||||
// At this point, we have at least 3 bytes total:
|
||||
// - Validated indicator byte (0x00) stored at position 0
|
||||
// - Validated indicator byte (0x00) but not stored
|
||||
// - At least 2 bytes in the buffer for the varints
|
||||
// Buffer layout:
|
||||
// [0]: indicator byte (0x00)
|
||||
// [1-3]: Message size varint (variable length)
|
||||
// First 1-3 bytes: Message size varint (variable length)
|
||||
// - 2 bytes would only allow up to 16383, which is less than noise's UINT16_MAX (65535)
|
||||
// - 3 bytes allows up to 2097151, ensuring we support at least as much as noise
|
||||
// [2-5]: Message type varint (variable length)
|
||||
// Remaining 1-2 bytes: Message type varint (variable length)
|
||||
// We now attempt to parse both varints. If either is incomplete,
|
||||
// we'll continue reading more bytes.
|
||||
|
||||
// Skip indicator byte at position 0
|
||||
uint8_t varint_pos = 1;
|
||||
uint32_t consumed = 0;
|
||||
|
||||
auto msg_size_varint = ProtoVarInt::parse(&rx_header_buf_[varint_pos], rx_header_buf_pos_ - varint_pos, &consumed);
|
||||
auto msg_size_varint = ProtoVarInt::parse(&rx_header_buf_[0], rx_header_buf_pos_ - 1, &consumed);
|
||||
if (!msg_size_varint.has_value()) {
|
||||
// not enough data there yet
|
||||
continue;
|
||||
@@ -906,10 +908,7 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
||||
}
|
||||
rx_header_parsed_len_ = msg_size_varint->as_uint16();
|
||||
|
||||
// Move to next varint position
|
||||
varint_pos += consumed;
|
||||
|
||||
auto msg_type_varint = ProtoVarInt::parse(&rx_header_buf_[varint_pos], rx_header_buf_pos_ - varint_pos, &consumed);
|
||||
auto msg_type_varint = ProtoVarInt::parse(&rx_header_buf_[consumed], rx_header_buf_pos_ - 1 - consumed, &consumed);
|
||||
if (!msg_type_varint.has_value()) {
|
||||
// not enough data there yet
|
||||
continue;
|
||||
|
||||
@@ -233,14 +233,14 @@ class APIPlaintextFrameHelper : public APIFrameHelper {
|
||||
protected:
|
||||
APIError try_read_frame_(ParsedFrame *frame);
|
||||
// Fixed-size header buffer for plaintext protocol:
|
||||
// We now store the indicator byte + the two varints.
|
||||
// We only need space for the two varints since we validate the indicator byte separately.
|
||||
// To match noise protocol's maximum message size (UINT16_MAX = 65535), we need:
|
||||
// 1 byte for indicator + 3 bytes for message size varint (supports up to 2097151) + 2 bytes for message type varint
|
||||
// 3 bytes for message size varint (supports up to 2097151) + 2 bytes for message type varint
|
||||
//
|
||||
// While varints could theoretically be up to 10 bytes each for 64-bit values,
|
||||
// attempting to process messages with headers that large would likely crash the
|
||||
// ESP32 due to memory constraints.
|
||||
uint8_t rx_header_buf_[6]; // 1 byte indicator + 5 bytes for varints (3 for size + 2 for type)
|
||||
uint8_t rx_header_buf_[5]; // 5 bytes for varints (3 for size + 2 for type)
|
||||
uint8_t rx_header_buf_pos_ = 0;
|
||||
bool rx_header_parsed_ = false;
|
||||
uint16_t rx_header_parsed_type_ = 0;
|
||||
|
||||
@@ -782,7 +782,7 @@ bool ConnectResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
}
|
||||
void ConnectResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->invalid_password); }
|
||||
void ConnectResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->invalid_password, false);
|
||||
total_size += 2; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void ConnectResponse::dump_to(std::string &out) const {
|
||||
@@ -1200,9 +1200,7 @@ void BinarySensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(3, this->missing_state);
|
||||
}
|
||||
void BinarySensorStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->state, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
total_size += 9; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BinarySensorStateResponse::dump_to(std::string &out) const {
|
||||
@@ -1412,11 +1410,7 @@ void CoverStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::CoverOperation>(5, this->current_operation);
|
||||
}
|
||||
void CoverStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_state), false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->position != 0.0f, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->tilt != 0.0f, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation), false);
|
||||
total_size += 27; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void CoverStateResponse::dump_to(std::string &out) const {
|
||||
@@ -1502,14 +1496,7 @@ void CoverCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(8, this->stop);
|
||||
}
|
||||
void CoverCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->has_legacy_command, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_command), false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->has_position, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->position != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->has_tilt, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->tilt != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->stop, false);
|
||||
total_size += 29; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void CoverCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -2835,9 +2822,7 @@ void SensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(3, this->missing_state);
|
||||
}
|
||||
void SensorStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->state != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
total_size += 12; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SensorStateResponse::dump_to(std::string &out) const {
|
||||
@@ -3003,8 +2988,7 @@ void SwitchStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->state);
|
||||
}
|
||||
void SwitchStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->state, false);
|
||||
total_size += 7; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SwitchStateResponse::dump_to(std::string &out) const {
|
||||
@@ -3046,8 +3030,7 @@ void SwitchCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->state);
|
||||
}
|
||||
void SwitchCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->state, false);
|
||||
total_size += 7; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SwitchCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -3251,8 +3234,7 @@ void SubscribeLogsRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->dump_config);
|
||||
}
|
||||
void SubscribeLogsRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->level), false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->dump_config, false);
|
||||
total_size += 8; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SubscribeLogsRequest::dump_to(std::string &out) const {
|
||||
@@ -3356,7 +3338,7 @@ bool NoiseEncryptionSetKeyResponse::decode_varint(uint32_t field_id, ProtoVarInt
|
||||
}
|
||||
void NoiseEncryptionSetKeyResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->success); }
|
||||
void NoiseEncryptionSetKeyResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->success, false);
|
||||
total_size += 2; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void NoiseEncryptionSetKeyResponse::dump_to(std::string &out) const {
|
||||
@@ -3617,7 +3599,7 @@ bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
|
||||
}
|
||||
void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->epoch_seconds); }
|
||||
void GetTimeResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->epoch_seconds != 0, false);
|
||||
total_size += 5; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void GetTimeResponse::dump_to(std::string &out) const {
|
||||
@@ -4108,8 +4090,7 @@ void CameraImageRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->stream);
|
||||
}
|
||||
void CameraImageRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->single, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->stream, false);
|
||||
total_size += 4; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void CameraImageRequest::dump_to(std::string &out) const {
|
||||
@@ -5098,9 +5079,7 @@ void NumberStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(3, this->missing_state);
|
||||
}
|
||||
void NumberStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->state != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
total_size += 12; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void NumberStateResponse::dump_to(std::string &out) const {
|
||||
@@ -5141,8 +5120,7 @@ void NumberCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(2, this->state);
|
||||
}
|
||||
void NumberCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->state != 0.0f, false);
|
||||
total_size += 10; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void NumberCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -5541,8 +5519,7 @@ void SirenStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->state);
|
||||
}
|
||||
void SirenStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->state, false);
|
||||
total_size += 7; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SirenStateResponse::dump_to(std::string &out) const {
|
||||
@@ -5844,8 +5821,7 @@ void LockStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::LockState>(2, this->state);
|
||||
}
|
||||
void LockStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state), false);
|
||||
total_size += 11; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void LockStateResponse::dump_to(std::string &out) const {
|
||||
@@ -6052,7 +6028,7 @@ bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
|
||||
}
|
||||
void ButtonCommandRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->key); }
|
||||
void ButtonCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
total_size += 5; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void ButtonCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -6298,10 +6274,7 @@ void MediaPlayerStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(4, this->muted);
|
||||
}
|
||||
void MediaPlayerStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state), false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->volume != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->muted, false);
|
||||
total_size += 18; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void MediaPlayerStateResponse::dump_to(std::string &out) const {
|
||||
@@ -6461,7 +6434,7 @@ void SubscribeBluetoothLEAdvertisementsRequest::encode(ProtoWriteBuffer buffer)
|
||||
buffer.encode_uint32(1, this->flags);
|
||||
}
|
||||
void SubscribeBluetoothLEAdvertisementsRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->flags, false);
|
||||
total_size += 6; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SubscribeBluetoothLEAdvertisementsRequest::dump_to(std::string &out) const {
|
||||
@@ -6770,10 +6743,7 @@ void BluetoothDeviceRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(4, this->address_type);
|
||||
}
|
||||
void BluetoothDeviceRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->request_type), false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->has_address_type, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->address_type, false);
|
||||
total_size += 25; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothDeviceRequest::dump_to(std::string &out) const {
|
||||
@@ -6828,10 +6798,7 @@ void BluetoothDeviceConnectionResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_int32(4, this->error);
|
||||
}
|
||||
void BluetoothDeviceConnectionResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->connected, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->mtu, false);
|
||||
ProtoSize::add_int32_field(total_size, 1, this->error, false);
|
||||
total_size += 25; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothDeviceConnectionResponse::dump_to(std::string &out) const {
|
||||
@@ -6870,7 +6837,7 @@ bool BluetoothGATTGetServicesRequest::decode_varint(uint32_t field_id, ProtoVarI
|
||||
}
|
||||
void BluetoothGATTGetServicesRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_uint64(1, this->address); }
|
||||
void BluetoothGATTGetServicesRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
total_size += 11; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTGetServicesRequest::dump_to(std::string &out) const {
|
||||
@@ -7133,7 +7100,7 @@ void BluetoothGATTGetServicesDoneResponse::encode(ProtoWriteBuffer buffer) const
|
||||
buffer.encode_uint64(1, this->address);
|
||||
}
|
||||
void BluetoothGATTGetServicesDoneResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
total_size += 11; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTGetServicesDoneResponse::dump_to(std::string &out) const {
|
||||
@@ -7165,8 +7132,7 @@ void BluetoothGATTReadRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(2, this->handle);
|
||||
}
|
||||
void BluetoothGATTReadRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
total_size += 17; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTReadRequest::dump_to(std::string &out) const {
|
||||
@@ -7321,8 +7287,7 @@ void BluetoothGATTReadDescriptorRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(2, this->handle);
|
||||
}
|
||||
void BluetoothGATTReadDescriptorRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
total_size += 17; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTReadDescriptorRequest::dump_to(std::string &out) const {
|
||||
@@ -7418,9 +7383,7 @@ void BluetoothGATTNotifyRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(3, this->enable);
|
||||
}
|
||||
void BluetoothGATTNotifyRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->enable, false);
|
||||
total_size += 19; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTNotifyRequest::dump_to(std::string &out) const {
|
||||
@@ -7584,9 +7547,7 @@ void BluetoothGATTErrorResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_int32(3, this->error);
|
||||
}
|
||||
void BluetoothGATTErrorResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
ProtoSize::add_int32_field(total_size, 1, this->error, false);
|
||||
total_size += 23; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTErrorResponse::dump_to(std::string &out) const {
|
||||
@@ -7628,8 +7589,7 @@ void BluetoothGATTWriteResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(2, this->handle);
|
||||
}
|
||||
void BluetoothGATTWriteResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
total_size += 17; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTWriteResponse::dump_to(std::string &out) const {
|
||||
@@ -7666,8 +7626,7 @@ void BluetoothGATTNotifyResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(2, this->handle);
|
||||
}
|
||||
void BluetoothGATTNotifyResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->handle, false);
|
||||
total_size += 17; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothGATTNotifyResponse::dump_to(std::string &out) const {
|
||||
@@ -7709,9 +7668,7 @@ void BluetoothDevicePairingResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_int32(3, this->error);
|
||||
}
|
||||
void BluetoothDevicePairingResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->paired, false);
|
||||
ProtoSize::add_int32_field(total_size, 1, this->error, false);
|
||||
total_size += 19; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothDevicePairingResponse::dump_to(std::string &out) const {
|
||||
@@ -7757,9 +7714,7 @@ void BluetoothDeviceUnpairingResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_int32(3, this->error);
|
||||
}
|
||||
void BluetoothDeviceUnpairingResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->success, false);
|
||||
ProtoSize::add_int32_field(total_size, 1, this->error, false);
|
||||
total_size += 19; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothDeviceUnpairingResponse::dump_to(std::string &out) const {
|
||||
@@ -7812,9 +7767,7 @@ void BluetoothDeviceClearCacheResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_int32(3, this->error);
|
||||
}
|
||||
void BluetoothDeviceClearCacheResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint64_field(total_size, 1, this->address, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->success, false);
|
||||
ProtoSize::add_int32_field(total_size, 1, this->error, false);
|
||||
total_size += 19; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothDeviceClearCacheResponse::dump_to(std::string &out) const {
|
||||
@@ -7855,8 +7808,7 @@ void BluetoothScannerStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::BluetoothScannerMode>(2, this->mode);
|
||||
}
|
||||
void BluetoothScannerStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state), false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->mode), false);
|
||||
total_size += 12; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothScannerStateResponse::dump_to(std::string &out) const {
|
||||
@@ -7886,7 +7838,7 @@ void BluetoothScannerSetModeRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::BluetoothScannerMode>(1, this->mode);
|
||||
}
|
||||
void BluetoothScannerSetModeRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->mode), false);
|
||||
total_size += 6; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void BluetoothScannerSetModeRequest::dump_to(std::string &out) const {
|
||||
@@ -7917,8 +7869,7 @@ void SubscribeVoiceAssistantRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(2, this->flags);
|
||||
}
|
||||
void SubscribeVoiceAssistantRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->subscribe, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->flags, false);
|
||||
total_size += 8; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void SubscribeVoiceAssistantRequest::dump_to(std::string &out) const {
|
||||
@@ -7965,9 +7916,7 @@ void VoiceAssistantAudioSettings::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(3, this->volume_multiplier);
|
||||
}
|
||||
void VoiceAssistantAudioSettings::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->noise_suppression_level, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->auto_gain, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->volume_multiplier != 0.0f, false);
|
||||
total_size += 17; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void VoiceAssistantAudioSettings::dump_to(std::string &out) const {
|
||||
@@ -8082,8 +8031,7 @@ void VoiceAssistantResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(2, this->error);
|
||||
}
|
||||
void VoiceAssistantResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->port, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->error, false);
|
||||
total_size += 8; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void VoiceAssistantResponse::dump_to(std::string &out) const {
|
||||
@@ -8382,7 +8330,7 @@ bool VoiceAssistantAnnounceFinished::decode_varint(uint32_t field_id, ProtoVarIn
|
||||
}
|
||||
void VoiceAssistantAnnounceFinished::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->success); }
|
||||
void VoiceAssistantAnnounceFinished::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_bool_field(total_size, 1, this->success, false);
|
||||
total_size += 2; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void VoiceAssistantAnnounceFinished::dump_to(std::string &out) const {
|
||||
@@ -8709,8 +8657,7 @@ void AlarmControlPanelStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::AlarmControlPanelState>(2, this->state);
|
||||
}
|
||||
void AlarmControlPanelStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state), false);
|
||||
total_size += 11; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void AlarmControlPanelStateResponse::dump_to(std::string &out) const {
|
||||
@@ -9168,11 +9115,7 @@ void DateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(5, this->day);
|
||||
}
|
||||
void DateStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->year, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->month, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->day, false);
|
||||
total_size += 25; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void DateStateResponse::dump_to(std::string &out) const {
|
||||
@@ -9239,10 +9182,7 @@ void DateCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(4, this->day);
|
||||
}
|
||||
void DateCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->year, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->month, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->day, false);
|
||||
total_size += 23; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void DateCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -9409,11 +9349,7 @@ void TimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(5, this->second);
|
||||
}
|
||||
void TimeStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->hour, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->minute, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->second, false);
|
||||
total_size += 25; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void TimeStateResponse::dump_to(std::string &out) const {
|
||||
@@ -9480,10 +9416,7 @@ void TimeCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(4, this->second);
|
||||
}
|
||||
void TimeCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->hour, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->minute, false);
|
||||
ProtoSize::add_uint32_field(total_size, 1, this->second, false);
|
||||
total_size += 23; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void TimeCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -9850,9 +9783,7 @@ void ValveStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::ValveOperation>(3, this->current_operation);
|
||||
}
|
||||
void ValveStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->position != 0.0f, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation), false);
|
||||
total_size += 16; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void ValveStateResponse::dump_to(std::string &out) const {
|
||||
@@ -9909,10 +9840,7 @@ void ValveCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_bool(4, this->stop);
|
||||
}
|
||||
void ValveCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->has_position, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->position != 0.0f, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->stop, false);
|
||||
total_size += 14; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void ValveCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -10067,9 +9995,7 @@ void DateTimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_fixed32(3, this->epoch_seconds);
|
||||
}
|
||||
void DateTimeStateResponse::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_bool_field(total_size, 1, this->missing_state, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->epoch_seconds != 0, false);
|
||||
total_size += 12; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void DateTimeStateResponse::dump_to(std::string &out) const {
|
||||
@@ -10110,8 +10036,7 @@ void DateTimeCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_fixed32(2, this->epoch_seconds);
|
||||
}
|
||||
void DateTimeCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->epoch_seconds != 0, false);
|
||||
total_size += 10; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void DateTimeCommandRequest::dump_to(std::string &out) const {
|
||||
@@ -10393,8 +10318,7 @@ void UpdateCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_enum<enums::UpdateCommand>(2, this->command);
|
||||
}
|
||||
void UpdateCommandRequest::calculate_size(uint32_t &total_size) const {
|
||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0, false);
|
||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->command), false);
|
||||
total_size += 11; // Pre-calculated maximum size
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void UpdateCommandRequest::dump_to(std::string &out) const {
|
||||
|
||||
@@ -157,7 +157,7 @@ void APIServer::loop() {
|
||||
const uint32_t now = millis();
|
||||
if (!this->is_connected()) {
|
||||
if (now - this->last_connected_ > this->reboot_timeout_) {
|
||||
ESP_LOGE(TAG, "No client connected; rebooting");
|
||||
ESP_LOGE(TAG, "No client connected to API. Rebooting...");
|
||||
App.reboot();
|
||||
}
|
||||
this->status_set_warning();
|
||||
|
||||
@@ -91,7 +91,7 @@ void AS5600Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AS5600 failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void AS7341Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "AS7341:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AS7341 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
ESP_LOGCONFIG(TAG, " Gain: %u", get_gain());
|
||||
|
||||
@@ -135,7 +135,7 @@ void ATM90E26Component::dump_config() {
|
||||
ESP_LOGCONFIG("", "ATM90E26:");
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ATM90E26 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Voltage A", this->voltage_sensor_);
|
||||
|
||||
@@ -217,7 +217,7 @@ void ATM90E32Component::dump_config() {
|
||||
ESP_LOGCONFIG("", "ATM90E32:");
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ATM90E32 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Voltage A", this->phase_[PHASEA].voltage_sensor_);
|
||||
|
||||
@@ -118,7 +118,7 @@ void BH1750Sensor::dump_config() {
|
||||
LOG_SENSOR("", "BH1750", this);
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->get_name().c_str());
|
||||
ESP_LOGE(TAG, "Communication with BH1750 failed!");
|
||||
}
|
||||
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
#include "esphome/core/macros.h"
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
namespace esphome {
|
||||
@@ -49,16 +46,9 @@ bool BluetoothProxy::parse_device(const esp32_ble_tracker::ESPBTDevice &device)
|
||||
if (!api::global_api_server->is_connected() || this->api_connection_ == nullptr || this->raw_advertisements_)
|
||||
return false;
|
||||
|
||||
// Measure time for processing single device
|
||||
const uint32_t start_time = millis();
|
||||
|
||||
ESP_LOGV(TAG, "Proxying packet from %s - %s. RSSI: %d dB", device.get_name().c_str(), device.address_str().c_str(),
|
||||
device.get_rssi());
|
||||
this->send_api_packet_(device);
|
||||
|
||||
const uint32_t duration = millis() - start_time;
|
||||
this->section_stats_["parse_device"].record_time(duration);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,9 +62,6 @@ bool BluetoothProxy::parse_devices(esp_ble_gap_cb_param_t::ble_scan_result_evt_p
|
||||
if (!api::global_api_server->is_connected() || this->api_connection_ == nullptr || !this->raw_advertisements_)
|
||||
return false;
|
||||
|
||||
// Measure time for processing batch of devices
|
||||
const uint32_t start_time = millis();
|
||||
|
||||
// Get the batch buffer reference
|
||||
auto &batch_buffer = get_batch_buffer();
|
||||
|
||||
@@ -106,9 +93,6 @@ bool BluetoothProxy::parse_devices(esp_ble_gap_cb_param_t::ble_scan_result_evt_p
|
||||
this->flush_pending_advertisements();
|
||||
}
|
||||
|
||||
const uint32_t duration = millis() - start_time;
|
||||
this->section_stats_["parse_devices"].record_time(duration);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,52 +101,12 @@ void BluetoothProxy::flush_pending_advertisements() {
|
||||
if (batch_buffer.empty() || !api::global_api_server->is_connected() || this->api_connection_ == nullptr)
|
||||
return;
|
||||
|
||||
// Measure time for flushing advertisements
|
||||
const uint32_t start_time = millis();
|
||||
|
||||
// Track the batch size for analysis
|
||||
size_t batch_size = batch_buffer.size();
|
||||
|
||||
// Measure swap operation
|
||||
uint32_t swap_start = millis();
|
||||
api::BluetoothLERawAdvertisementsResponse resp;
|
||||
resp.advertisements.swap(batch_buffer);
|
||||
uint32_t swap_duration = millis() - swap_start;
|
||||
if (swap_duration > 0) {
|
||||
this->section_stats_["flush_swap"].record_time(swap_duration);
|
||||
}
|
||||
|
||||
// Measure API send operation
|
||||
uint32_t send_start = millis();
|
||||
this->api_connection_->send_bluetooth_le_raw_advertisements_response(resp);
|
||||
uint32_t send_duration = millis() - send_start;
|
||||
this->section_stats_["flush_api_send"].record_time(send_duration);
|
||||
|
||||
const uint32_t duration = millis() - start_time;
|
||||
this->section_stats_["flush_advertisements"].record_time(duration);
|
||||
|
||||
// Log if this was a particularly slow flush
|
||||
if (duration > 10) {
|
||||
ESP_LOGW(TAG, "Slow flush: %dms for %d advertisements", duration, batch_size);
|
||||
}
|
||||
|
||||
// Track average advertisements per flush
|
||||
static uint32_t total_ads_flushed = 0;
|
||||
static uint32_t total_flushes = 0;
|
||||
total_ads_flushed += batch_size;
|
||||
total_flushes++;
|
||||
|
||||
if (total_flushes % 100 == 0) {
|
||||
float avg_ads_per_flush = static_cast<float>(total_ads_flushed) / total_flushes;
|
||||
ESP_LOGD(TAG, "Avg advertisements per flush: %.2f (total: %d ads in %d flushes)", avg_ads_per_flush,
|
||||
total_ads_flushed, total_flushes);
|
||||
}
|
||||
}
|
||||
|
||||
void BluetoothProxy::send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device) {
|
||||
// Measure time for sending API packet
|
||||
const uint32_t start_time = millis();
|
||||
|
||||
api::BluetoothLEAdvertisementResponse resp;
|
||||
resp.address = device.address_uint64();
|
||||
resp.address_type = device.get_address_type();
|
||||
@@ -198,9 +142,6 @@ void BluetoothProxy::send_api_packet_(const esp32_ble_tracker::ESPBTDevice &devi
|
||||
}
|
||||
|
||||
this->api_connection_->send_bluetooth_le_advertisement(resp);
|
||||
|
||||
const uint32_t duration = millis() - start_time;
|
||||
this->section_stats_["send_api_packet"].record_time(duration);
|
||||
}
|
||||
|
||||
void BluetoothProxy::dump_config() {
|
||||
@@ -208,8 +149,6 @@ void BluetoothProxy::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, " Active: %s", YESNO(this->active_));
|
||||
ESP_LOGCONFIG(TAG, " Connections: %d", this->connections_.size());
|
||||
ESP_LOGCONFIG(TAG, " Raw advertisements: %s", YESNO(this->raw_advertisements_));
|
||||
ESP_LOGCONFIG(TAG, " Stats enabled: %s", YESNO(this->stats_enabled_));
|
||||
ESP_LOGCONFIG(TAG, " Stats interval: %" PRIu32 "ms", this->stats_log_interval_);
|
||||
}
|
||||
|
||||
int BluetoothProxy::get_bluetooth_connections_free() {
|
||||
@@ -227,9 +166,6 @@ int BluetoothProxy::get_bluetooth_connections_free() {
|
||||
}
|
||||
|
||||
void BluetoothProxy::loop() {
|
||||
// Measure total time for entire loop function
|
||||
const uint32_t loop_start_time = millis();
|
||||
|
||||
if (!api::global_api_server->is_connected() || this->api_connection_ == nullptr) {
|
||||
for (auto *connection : this->connections_) {
|
||||
if (connection->get_address() != 0) {
|
||||
@@ -239,28 +175,17 @@ void BluetoothProxy::loop() {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t now = millis();
|
||||
uint32_t start_time;
|
||||
uint32_t duration;
|
||||
|
||||
// Section: Flush advertisements
|
||||
// Flush any pending BLE advertisements that have been accumulated but not yet sent
|
||||
if (this->raw_advertisements_) {
|
||||
static uint32_t last_flush_time = 0;
|
||||
uint32_t app_time = App.get_loop_component_start_time();
|
||||
uint32_t now = App.get_loop_component_start_time();
|
||||
|
||||
// Flush accumulated advertisements every 100ms
|
||||
if (app_time - last_flush_time >= 100) {
|
||||
start_time = millis();
|
||||
if (now - last_flush_time >= 100) {
|
||||
this->flush_pending_advertisements();
|
||||
duration = millis() - start_time;
|
||||
this->section_stats_["loop_flush_ads"].record_time(duration);
|
||||
last_flush_time = app_time;
|
||||
last_flush_time = now;
|
||||
}
|
||||
}
|
||||
|
||||
// Section: Service discovery
|
||||
start_time = millis();
|
||||
bool did_service_discovery = false;
|
||||
for (auto *connection : this->connections_) {
|
||||
if (connection->send_service_ == connection->service_count_) {
|
||||
connection->send_service_ = DONE_SENDING_SERVICES;
|
||||
@@ -269,9 +194,7 @@ void BluetoothProxy::loop() {
|
||||
connection->connection_type_ == espbt::ConnectionType::V3_WITHOUT_CACHE) {
|
||||
connection->release_services();
|
||||
}
|
||||
did_service_discovery = true;
|
||||
} else if (connection->send_service_ >= 0) {
|
||||
did_service_discovery = true;
|
||||
esp_gattc_service_elem_t service_result;
|
||||
uint16_t service_count = 1;
|
||||
esp_gatt_status_t service_status =
|
||||
@@ -380,27 +303,6 @@ void BluetoothProxy::loop() {
|
||||
this->api_connection_->send_bluetooth_gatt_get_services_response(resp);
|
||||
}
|
||||
}
|
||||
|
||||
if (did_service_discovery) {
|
||||
duration = millis() - start_time;
|
||||
this->section_stats_["service_discovery"].record_time(duration);
|
||||
}
|
||||
|
||||
// Log stats periodically
|
||||
if (this->stats_enabled_) {
|
||||
// If next_stats_log_ is 0, initialize it
|
||||
if (this->next_stats_log_ == 0) {
|
||||
this->next_stats_log_ = now + this->stats_log_interval_;
|
||||
} else if (now >= this->next_stats_log_) {
|
||||
this->log_section_stats_();
|
||||
this->reset_section_stats_();
|
||||
this->next_stats_log_ = now + this->stats_log_interval_;
|
||||
}
|
||||
}
|
||||
|
||||
// Record total loop execution time
|
||||
const uint32_t total_loop_duration = millis() - loop_start_time;
|
||||
this->section_stats_["total_loop"].record_time(total_loop_duration);
|
||||
}
|
||||
|
||||
esp32_ble_tracker::AdvertisementParserType BluetoothProxy::get_advertisement_parser_type() {
|
||||
@@ -435,9 +337,6 @@ BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool rese
|
||||
}
|
||||
|
||||
void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest &msg) {
|
||||
// Measure time for processing device requests
|
||||
const uint32_t start_time = millis();
|
||||
|
||||
switch (msg.request_type) {
|
||||
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITH_CACHE:
|
||||
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE:
|
||||
@@ -559,9 +458,6 @@ void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t duration = millis() - start_time;
|
||||
this->section_stats_["device_request"].record_time(duration);
|
||||
}
|
||||
|
||||
void BluetoothProxy::bluetooth_gatt_read(const api::BluetoothGATTReadRequest &msg) {
|
||||
@@ -744,74 +640,6 @@ void BluetoothProxy::bluetooth_scanner_set_mode(bool active) {
|
||||
true); // Set this to true to automatically start scanning again when it has cleaned up.
|
||||
}
|
||||
|
||||
void BluetoothProxy::log_section_stats_() {
|
||||
const char *STATS_TAG = "bluetooth_proxy.stats";
|
||||
ESP_LOGI(STATS_TAG,
|
||||
"Logging Bluetooth Proxy section stats now (current time: %" PRIu32 ", scheduled time: %" PRIu32 ")",
|
||||
millis(), this->next_stats_log_);
|
||||
ESP_LOGI(STATS_TAG, "Stats collection status: enabled=%d, sections=%zu", this->stats_enabled_,
|
||||
this->section_stats_.size());
|
||||
|
||||
// Check if we have minimal data
|
||||
bool has_data = false;
|
||||
for (const auto &it : this->section_stats_) {
|
||||
if (it.second.get_period_count() > 0) {
|
||||
has_data = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_data) {
|
||||
ESP_LOGI(STATS_TAG, "No stats data collected in this period");
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(STATS_TAG, "Bluetooth Proxy Section Runtime Statistics");
|
||||
ESP_LOGI(STATS_TAG, "Period stats (last %" PRIu32 "ms):", this->stats_log_interval_);
|
||||
|
||||
// First collect stats we want to display
|
||||
std::vector<std::pair<std::string, const BluetoothProxySectionStats *>> stats_to_display;
|
||||
|
||||
for (const auto &it : this->section_stats_) {
|
||||
const BluetoothProxySectionStats &stats = it.second;
|
||||
if (stats.get_period_count() > 0) {
|
||||
stats_to_display.push_back({it.first, &stats});
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by period runtime (descending)
|
||||
std::sort(stats_to_display.begin(), stats_to_display.end(), [](const auto &a, const auto &b) {
|
||||
return a.second->get_period_time_ms() > b.second->get_period_time_ms();
|
||||
});
|
||||
|
||||
// Log top sections by period runtime
|
||||
for (const auto &it : stats_to_display) {
|
||||
const std::string §ion_name = it.first;
|
||||
const BluetoothProxySectionStats &stats = *it.second;
|
||||
|
||||
ESP_LOGI(STATS_TAG, " %-25s: count=%-6" PRIu32 " runtime=%-8" PRIu32 "ms avg=%-6.2fms max=%-6" PRIu32 "ms",
|
||||
section_name.c_str(), stats.get_period_count(), stats.get_period_time_ms(), stats.get_period_avg_time_ms(),
|
||||
stats.get_period_max_time_ms());
|
||||
}
|
||||
|
||||
// Log total accumulated stats
|
||||
ESP_LOGI(STATS_TAG, "Total accumulated stats:");
|
||||
for (const auto &it : stats_to_display) {
|
||||
const std::string §ion_name = it.first;
|
||||
const BluetoothProxySectionStats &stats = *it.second;
|
||||
|
||||
ESP_LOGI(STATS_TAG, " %-25s: count=%-8" PRIu32 " runtime=%-10" PRIu32 "ms avg=%-6.2fms max=%-6" PRIu32 "ms",
|
||||
section_name.c_str(), stats.get_total_count(), stats.get_total_time_ms(), stats.get_total_avg_time_ms(),
|
||||
stats.get_total_max_time_ms());
|
||||
}
|
||||
}
|
||||
|
||||
void BluetoothProxy::reset_section_stats_() {
|
||||
for (auto &it : this->section_stats_) {
|
||||
it.second.reset_period_stats();
|
||||
}
|
||||
}
|
||||
|
||||
BluetoothProxy *global_bluetooth_proxy = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
} // namespace bluetooth_proxy
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "esphome/components/api/api_connection.h"
|
||||
#include "esphome/components/api/api_pb2.h"
|
||||
@@ -13,8 +12,6 @@
|
||||
#include "esphome/core/automation.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include "bluetooth_connection.h"
|
||||
|
||||
@@ -28,62 +25,6 @@ static const esp_err_t ESP_GATT_NOT_CONNECTED = -1;
|
||||
|
||||
using namespace esp32_ble_client;
|
||||
|
||||
// Stats class for tracking section performance
|
||||
class BluetoothProxySectionStats {
|
||||
public:
|
||||
BluetoothProxySectionStats()
|
||||
: period_count_(0),
|
||||
total_count_(0),
|
||||
period_time_ms_(0),
|
||||
total_time_ms_(0),
|
||||
period_max_time_ms_(0),
|
||||
total_max_time_ms_(0) {}
|
||||
|
||||
void record_time(uint32_t duration_ms) {
|
||||
// Update period counters
|
||||
this->period_count_++;
|
||||
this->period_time_ms_ += duration_ms;
|
||||
if (duration_ms > this->period_max_time_ms_)
|
||||
this->period_max_time_ms_ = duration_ms;
|
||||
|
||||
// Update total counters
|
||||
this->total_count_++;
|
||||
this->total_time_ms_ += duration_ms;
|
||||
if (duration_ms > this->total_max_time_ms_)
|
||||
this->total_max_time_ms_ = duration_ms;
|
||||
}
|
||||
|
||||
void reset_period_stats() {
|
||||
this->period_count_ = 0;
|
||||
this->period_time_ms_ = 0;
|
||||
this->period_max_time_ms_ = 0;
|
||||
}
|
||||
|
||||
// Getters for period stats
|
||||
uint32_t get_period_count() const { return this->period_count_; }
|
||||
uint32_t get_period_time_ms() const { return this->period_time_ms_; }
|
||||
uint32_t get_period_max_time_ms() const { return this->period_max_time_ms_; }
|
||||
float get_period_avg_time_ms() const {
|
||||
return this->period_count_ > 0 ? static_cast<float>(this->period_time_ms_) / this->period_count_ : 0.0f;
|
||||
}
|
||||
|
||||
// Getters for total stats
|
||||
uint32_t get_total_count() const { return this->total_count_; }
|
||||
uint32_t get_total_time_ms() const { return this->total_time_ms_; }
|
||||
uint32_t get_total_max_time_ms() const { return this->total_max_time_ms_; }
|
||||
float get_total_avg_time_ms() const {
|
||||
return this->total_count_ > 0 ? static_cast<float>(this->total_time_ms_) / this->total_count_ : 0.0f;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t period_count_;
|
||||
uint32_t total_count_;
|
||||
uint32_t period_time_ms_;
|
||||
uint32_t total_time_ms_;
|
||||
uint32_t period_max_time_ms_;
|
||||
uint32_t total_max_time_ms_;
|
||||
};
|
||||
|
||||
// Legacy versions:
|
||||
// Version 1: Initial version without active connections
|
||||
// Version 2: Support for active connections
|
||||
@@ -198,14 +139,6 @@ class BluetoothProxy : public esp32_ble_tracker::ESPBTDeviceListener, public Com
|
||||
std::vector<BluetoothConnection *> connections_{};
|
||||
api::APIConnection *api_connection_{nullptr};
|
||||
bool raw_advertisements_{false};
|
||||
|
||||
// Performance statistics tracking
|
||||
std::map<std::string, BluetoothProxySectionStats> section_stats_;
|
||||
uint32_t stats_log_interval_{60000}; // 60 seconds default
|
||||
uint32_t next_stats_log_{0};
|
||||
bool stats_enabled_{true};
|
||||
void log_section_stats_();
|
||||
void reset_section_stats_();
|
||||
};
|
||||
|
||||
extern BluetoothProxy *global_bluetooth_proxy; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
@@ -182,7 +182,7 @@ void BME280Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "BME280:");
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with BME280 failed!");
|
||||
break;
|
||||
case WRONG_CHIP_ID:
|
||||
ESP_LOGE(TAG, "BME280 has wrong chip ID! Is it a BME280?");
|
||||
|
||||
@@ -215,7 +215,7 @@ void BME680Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "BME680:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with BME680 failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_));
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
@@ -307,7 +307,7 @@ void BME680Component::read_data_() {
|
||||
this->humidity_sensor_->publish_state(NAN);
|
||||
if (this->gas_resistance_sensor_ != nullptr)
|
||||
this->gas_resistance_sensor_->publish_state(NAN);
|
||||
ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGW(TAG, "Communication with BME680 failed!");
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void BMI160Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "BMI160:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with BMI160 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);
|
||||
|
||||
@@ -132,7 +132,7 @@ void BMP280Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "BMP280:");
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with BMP280 failed!");
|
||||
break;
|
||||
case WRONG_CHIP_ID:
|
||||
ESP_LOGE(TAG, "BMP280 has wrong chip ID! Is it a BME280?");
|
||||
|
||||
@@ -154,7 +154,7 @@ void BMP3XXComponent::dump_config() {
|
||||
case NONE:
|
||||
break;
|
||||
case ERROR_COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with BMP3XX failed!");
|
||||
break;
|
||||
case ERROR_WRONG_CHIP_ID:
|
||||
ESP_LOGE(
|
||||
|
||||
@@ -29,7 +29,7 @@ void CaptivePortal::handle_config(AsyncWebServerRequest *request) {
|
||||
void CaptivePortal::handle_wifisave(AsyncWebServerRequest *request) {
|
||||
std::string ssid = request->arg("ssid").c_str();
|
||||
std::string psk = request->arg("psk").c_str();
|
||||
ESP_LOGI(TAG, "Requested WiFi Settings Change:");
|
||||
ESP_LOGI(TAG, "Captive Portal Requested WiFi Settings Change:");
|
||||
ESP_LOGI(TAG, " SSID='%s'", ssid.c_str());
|
||||
ESP_LOGI(TAG, " Password=" LOG_SECRET("'%s'"), psk.c_str());
|
||||
wifi::global_wifi_component->save_wifi_sta(ssid, psk);
|
||||
|
||||
@@ -163,7 +163,7 @@ void CCS811Component::dump_config() {
|
||||
if (this->is_failed()) {
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?");
|
||||
break;
|
||||
case INVALID_ID:
|
||||
ESP_LOGW(TAG, "Sensor reported an invalid ID. Is this a CCS811?");
|
||||
|
||||
@@ -37,7 +37,7 @@ void CH422GComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CH422G:");
|
||||
LOG_I2C_DEVICE(this)
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with CH422G failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void CM1106Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
uint8_t response[8] = {0};
|
||||
if (!this->cm1106_write_command_(C_M1106_CMD_GET_CO2, sizeof(C_M1106_CMD_GET_CO2), response, sizeof(response))) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with CM1106 failed!");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ void CM1106Component::dump_config() {
|
||||
LOG_SENSOR(" ", "CO2", this->co2_sensor_);
|
||||
this->check_uart_settings(9600);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with CM1106 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void CSE7761Component::setup() {
|
||||
void CSE7761Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "CSE7761:");
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with CSE7761 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
this->check_uart_settings(38400, 1, uart::UART_CONFIG_PARITY_EVEN, 8);
|
||||
|
||||
@@ -15,10 +15,10 @@ void DeepSleepComponent::setup() {
|
||||
|
||||
const optional<uint32_t> run_duration = get_run_duration_();
|
||||
if (run_duration.has_value()) {
|
||||
ESP_LOGI(TAG, "Scheduling in %" PRIu32 " ms", *run_duration);
|
||||
ESP_LOGI(TAG, "Scheduling Deep Sleep to start in %" PRIu32 " ms", *run_duration);
|
||||
this->set_timeout(*run_duration, [this]() { this->begin_sleep(); });
|
||||
} else {
|
||||
ESP_LOGD(TAG, "Not scheduling; no run duration configured");
|
||||
ESP_LOGD(TAG, "Not scheduling Deep Sleep, as no run duration is configured.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void DeepSleepComponent::begin_sleep(bool manual) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Beginning sleep");
|
||||
ESP_LOGI(TAG, "Beginning Deep Sleep");
|
||||
if (this->sleep_duration_.has_value()) {
|
||||
ESP_LOGI(TAG, "Sleeping for %" PRId64 "us", *this->sleep_duration_);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ bool DeepSleepComponent::prepare_to_sleep_() {
|
||||
// Defer deep sleep until inactive
|
||||
if (!this->next_enter_deep_sleep_) {
|
||||
this->status_set_warning();
|
||||
ESP_LOGW(TAG, "Waiting for wakeup pin state change");
|
||||
ESP_LOGW(TAG, "Waiting wakeup pin state change to enter deep sleep...");
|
||||
}
|
||||
this->next_enter_deep_sleep_ = true;
|
||||
return false;
|
||||
|
||||
@@ -154,6 +154,10 @@ NUMBER_TYPES = {
|
||||
2: DemoNumberType.TYPE_2,
|
||||
3: DemoNumberType.TYPE_3,
|
||||
}
|
||||
SELECT_TYPES = {
|
||||
1: DemoSelectType.TYPE_1,
|
||||
2: DemoSelectType.TYPE_2,
|
||||
}
|
||||
TEXT_TYPES = {
|
||||
1: DemoTextType.TYPE_1,
|
||||
2: DemoTextType.TYPE_2,
|
||||
@@ -435,15 +439,18 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
CONF_NAME: "Demo Select 1",
|
||||
CONF_OPTIONS: ["Option 1", "Option 2", "Option 3"],
|
||||
CONF_TYPE: 1,
|
||||
},
|
||||
{
|
||||
CONF_NAME: "Demo Select 2",
|
||||
CONF_OPTIONS: ["Option A", "Option B", "Option C"],
|
||||
CONF_TYPE: 2,
|
||||
},
|
||||
],
|
||||
): [
|
||||
select.select_schema(DemoSelect).extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(SELECT_TYPES, int=True),
|
||||
cv.Required(CONF_OPTIONS): cv.ensure_list(cv.string_strict),
|
||||
}
|
||||
)
|
||||
@@ -553,7 +560,6 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
async def to_code(config):
|
||||
for conf in config[CONF_ALARM_CONTROL_PANELS]:
|
||||
var = await alarm_control_panel.new_alarm_control_panel(conf)
|
||||
cg.add(var.set_type(conf[CONF_TYPE]))
|
||||
await cg.register_component(var, conf)
|
||||
|
||||
for conf in config[CONF_BINARY_SENSORS]:
|
||||
|
||||
@@ -27,23 +27,19 @@ class DemoValve : public valve::Valve {
|
||||
protected:
|
||||
void control(const valve::ValveCall &call) override {
|
||||
if (call.get_position().has_value()) {
|
||||
this->position = *call.get_position();
|
||||
this->publish_state();
|
||||
this->publish_state(*call.get_position());
|
||||
return;
|
||||
} else if (call.get_toggle().has_value()) {
|
||||
if (call.get_toggle().value()) {
|
||||
if (this->position == valve::VALVE_OPEN) {
|
||||
this->position = valve::VALVE_CLOSED;
|
||||
this->publish_state();
|
||||
this->publish_state(valve::VALVE_CLOSED);
|
||||
} else {
|
||||
this->position = valve::VALVE_OPEN;
|
||||
this->publish_state();
|
||||
this->publish_state(valve::VALVE_OPEN);
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (call.get_stop()) {
|
||||
this->current_operation = valve::VALVE_OPERATION_IDLE;
|
||||
this->publish_state(); // Keep the current position
|
||||
this->publish_state(this->position); // Keep the current position
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,20 @@ void DHT::setup() {
|
||||
this->pin_->setup();
|
||||
this->pin_->digital_write(true);
|
||||
}
|
||||
|
||||
void DHT::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "DHT:");
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
ESP_LOGCONFIG(TAG, " %sModel: %s", this->is_auto_detect_ ? "Auto-detected " : "",
|
||||
this->model_ == DHT_MODEL_DHT11 ? "DHT11" : "DHT22 or equivalent");
|
||||
ESP_LOGCONFIG(TAG, " Internal pull-up: %s", ONOFF(this->pin_->get_flags() & gpio::FLAG_PULLUP));
|
||||
if (this->is_auto_detect_) {
|
||||
ESP_LOGCONFIG(TAG, " Auto-detected model: %s", this->model_ == DHT_MODEL_DHT11 ? "DHT11" : "DHT22");
|
||||
} else if (this->model_ == DHT_MODEL_DHT11) {
|
||||
ESP_LOGCONFIG(TAG, " Model: DHT11");
|
||||
} else {
|
||||
ESP_LOGCONFIG(TAG, " Model: DHT22 (or equivalent)");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Internal Pull-up: %s", ONOFF(this->pin_->get_flags() & gpio::FLAG_PULLUP));
|
||||
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
}
|
||||
@@ -40,7 +46,7 @@ void DHT::update() {
|
||||
}
|
||||
|
||||
if (success) {
|
||||
ESP_LOGD(TAG, "Temperature %.1f°C Humidity %.1f%%", temperature, humidity);
|
||||
ESP_LOGD(TAG, "Got Temperature=%.1f°C Humidity=%.1f%%", temperature, humidity);
|
||||
|
||||
if (this->temperature_sensor_ != nullptr)
|
||||
this->temperature_sensor_->publish_state(temperature);
|
||||
@@ -48,8 +54,11 @@ void DHT::update() {
|
||||
this->humidity_sensor_->publish_state(humidity);
|
||||
this->status_clear_warning();
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid readings! Check pin number and pull-up resistor%s.",
|
||||
this->is_auto_detect_ ? " and try manually specifying the model" : "");
|
||||
const char *str = "";
|
||||
if (this->is_auto_detect_) {
|
||||
str = " and consider manually specifying the DHT model using the model option";
|
||||
}
|
||||
ESP_LOGW(TAG, "Invalid readings! Please check your wiring (pull-up resistor, pin number)%s.", str);
|
||||
if (this->temperature_sensor_ != nullptr)
|
||||
this->temperature_sensor_->publish_state(NAN);
|
||||
if (this->humidity_sensor_ != nullptr)
|
||||
@@ -59,12 +68,10 @@ void DHT::update() {
|
||||
}
|
||||
|
||||
float DHT::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
void DHT::set_dht_model(DHTModel model) {
|
||||
this->model_ = model;
|
||||
this->is_auto_detect_ = model == DHT_MODEL_AUTO_DETECT;
|
||||
}
|
||||
|
||||
bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool report_errors) {
|
||||
*humidity = NAN;
|
||||
*temperature = NAN;
|
||||
@@ -114,9 +121,9 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
while (!this->pin_->digital_read()) {
|
||||
if (micros() - start_time > 90) {
|
||||
if (i < 0) {
|
||||
error_code = 1; // line didn't clear
|
||||
error_code = 1;
|
||||
} else {
|
||||
error_code = 2; // rising edge for bit i timeout
|
||||
error_code = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -132,9 +139,9 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
end_time = micros();
|
||||
if (end_time - start_time > 90) {
|
||||
if (i < 0) {
|
||||
error_code = 3; // requesting data failed
|
||||
error_code = 3;
|
||||
} else {
|
||||
error_code = 4; // falling edge for bit i timeout
|
||||
error_code = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -159,9 +166,22 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
if (!report_errors && error_code != 0)
|
||||
return false;
|
||||
|
||||
if (error_code) {
|
||||
ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
return false;
|
||||
switch (error_code) {
|
||||
case 1:
|
||||
ESP_LOGW(TAG, "Waiting for DHT communication to clear failed!");
|
||||
return false;
|
||||
case 2:
|
||||
ESP_LOGW(TAG, "Rising edge for bit %d failed!", i);
|
||||
return false;
|
||||
case 3:
|
||||
ESP_LOGW(TAG, "Requesting data from DHT failed!");
|
||||
return false;
|
||||
case 4:
|
||||
ESP_LOGW(TAG, "Falling edge for bit %d failed!", i);
|
||||
return false;
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ESP_LOGVV(TAG,
|
||||
@@ -186,15 +206,15 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
if (checksum_a == data[4]) {
|
||||
// Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data + 8bit
|
||||
// check sum - some models always have 0 in the decimal part
|
||||
const uint16_t raw_temperature = static_cast<uint16_t>(data[2]) * 10 + (data[3] & 0x7F);
|
||||
*temperature = static_cast<float>(raw_temperature) / 10.0f;
|
||||
const uint16_t raw_temperature = uint16_t(data[2]) * 10 + (data[3] & 0x7F);
|
||||
*temperature = raw_temperature / 10.0f;
|
||||
if ((data[3] & 0x80) != 0) {
|
||||
// negative
|
||||
*temperature *= -1;
|
||||
}
|
||||
|
||||
const uint16_t raw_humidity = static_cast<uint16_t>(data[0]) * 10 + data[1];
|
||||
*humidity = static_cast<float>(raw_humidity) / 10.0f;
|
||||
const uint16_t raw_humidity = uint16_t(data[0]) * 10 + data[1];
|
||||
*humidity = raw_humidity / 10.0f;
|
||||
} else {
|
||||
// For compatibility with DHT11 models which might only use 2 bytes checksums, only use the data from these two
|
||||
// bytes
|
||||
@@ -202,8 +222,8 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
*humidity = data[0];
|
||||
}
|
||||
} else {
|
||||
uint16_t raw_humidity = encode_uint16(data[0], data[1]);
|
||||
uint16_t raw_temperature = encode_uint16(data[2], data[3]);
|
||||
uint16_t raw_humidity = (uint16_t(data[0] & 0xFF) << 8) | (data[1] & 0xFF);
|
||||
uint16_t raw_temperature = (uint16_t(data[2] & 0xFF) << 8) | (data[3] & 0xFF);
|
||||
|
||||
if (raw_temperature & 0x8000) {
|
||||
if (!(raw_temperature & 0x4000))
|
||||
@@ -214,23 +234,24 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
||||
|
||||
if (raw_temperature == 1 && raw_humidity == 10) {
|
||||
if (report_errors) {
|
||||
ESP_LOGW(TAG, "Invalid data");
|
||||
ESP_LOGW(TAG, "Invalid temperature+humidity! Sensor reported 1°C and 1%% Hum");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
*humidity = static_cast<float>(raw_humidity) * 0.1f;
|
||||
if (*humidity > 100.0f)
|
||||
*humidity = raw_humidity * 0.1f;
|
||||
if (*humidity > 100)
|
||||
*humidity = NAN;
|
||||
*temperature = static_cast<int16_t>(raw_temperature) * 0.1f;
|
||||
*temperature = int16_t(raw_temperature) * 0.1f;
|
||||
}
|
||||
|
||||
if (*temperature == 0.0f && (*humidity == 1.0f || *humidity == 2.0f)) {
|
||||
if (report_errors) {
|
||||
ESP_LOGW(TAG, "Invalid data");
|
||||
ESP_LOGW(TAG, "DHT reports invalid data. Is the update interval too high or the sensor damaged?");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ void DHT12Component::dump_config() {
|
||||
ESP_LOGD(TAG, "DHT12:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with DHT12 failed!");
|
||||
}
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -91,7 +91,7 @@ void DPS310Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, " Revision ID: %u", (this->prod_rev_id_ >> 4) & 0x0F);
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with DPS310 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
|
||||
@@ -22,7 +22,7 @@ void DS1307Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "DS1307:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with DS1307 failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void EE895Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EE895 failed!");
|
||||
break;
|
||||
case CRC_CHECK_FAILED:
|
||||
ESP_LOGE(TAG, "The crc check failed");
|
||||
|
||||
@@ -94,7 +94,7 @@ void Emc2101Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Emc2101 component:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Mode: %s", this->dac_mode_ ? "DAC" : "PWM");
|
||||
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_);
|
||||
ESP_LOGD(TAG, "Setting duty fan setting to %02X", duty_cycle);
|
||||
if (!this->write_byte(EMC2101_REGISTER_FAN_SETTING, duty_cycle)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void Emc2101Component::set_duty_cycle(float value) {
|
||||
float Emc2101Component::get_duty_cycle() {
|
||||
uint8_t duty_cycle;
|
||||
if (!this->read_byte(EMC2101_REGISTER_FAN_SETTING, &duty_cycle)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
this->status_set_warning();
|
||||
return NAN;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ float Emc2101Component::get_duty_cycle() {
|
||||
float Emc2101Component::get_internal_temperature() {
|
||||
uint8_t temperature;
|
||||
if (!this->read_byte(EMC2101_REGISTER_INTERNAL_TEMP, &temperature)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
this->status_set_warning();
|
||||
return NAN;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ float Emc2101Component::get_external_temperature() {
|
||||
uint8_t lsb, msb;
|
||||
if (!this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_MSB, &msb) ||
|
||||
!this->read_byte(EMC2101_REGISTER_EXTERNAL_TEMP_LSB, &lsb)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
this->status_set_warning();
|
||||
return NAN;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ float Emc2101Component::get_speed() {
|
||||
// Read **LSB** first to match 'Data Read Interlock' behavior from 6.1 of datasheet
|
||||
uint8_t lsb, msb;
|
||||
if (!this->read_byte(EMC2101_REGISTER_TACH_LSB, &lsb) || !this->read_byte(EMC2101_REGISTER_TACH_MSB, &msb)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EMC2101 failed!");
|
||||
this->status_set_warning();
|
||||
return NAN;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ void ENS160Component::dump_config() {
|
||||
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication failed! Is the sensor connected?");
|
||||
break;
|
||||
case READ_FAILED:
|
||||
ESP_LOGE(TAG, "Error reading from register");
|
||||
|
||||
@@ -163,7 +163,7 @@ void ENS210Component::update() {
|
||||
|
||||
// Read T_VAL and H_VAL
|
||||
if (!this->read_bytes(ENS210_REGISTER_T_VAL, data, 6)) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ENS210 failed!");
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ from .const import (
|
||||
VARIANT_ESP32,
|
||||
VARIANT_ESP32C2,
|
||||
VARIANT_ESP32C3,
|
||||
VARIANT_ESP32C5,
|
||||
VARIANT_ESP32C6,
|
||||
VARIANT_ESP32H2,
|
||||
VARIANT_ESP32P4,
|
||||
@@ -1339,7 +1340,17 @@ ESP32_BOARD_PINS = {
|
||||
}
|
||||
|
||||
"""
|
||||
BOARDS generated with script/generate-esp32-boards.py
|
||||
BOARDS generated with:
|
||||
|
||||
git clone https://github.com/platformio/platform-espressif32
|
||||
for x in platform-espressif32/boards/*.json; do
|
||||
mcu=$(jq -r .build.mcu <"$x");
|
||||
name=$(jq -r .name <"$x");
|
||||
fname=$(basename "$x")
|
||||
board="${fname%.*}"
|
||||
variant=$(echo "$mcu" | tr '[:lower:]' '[:upper:]')
|
||||
echo " \"$board\": {\"name\": \"$name\", \"variant\": VARIANT_${variant},},"
|
||||
done | sort
|
||||
"""
|
||||
|
||||
BOARDS = {
|
||||
@@ -1351,10 +1362,6 @@ BOARDS = {
|
||||
"name": "Adafruit pyCamera S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"adafruit_feather_esp32_v2": {
|
||||
"name": "Adafruit Feather ESP32 V2",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"adafruit_feather_esp32c6": {
|
||||
"name": "Adafruit Feather ESP32-C6",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
@@ -1387,6 +1394,10 @@ BOARDS = {
|
||||
"name": "Adafruit Feather ESP32-S3 TFT",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"adafruit_feather_esp32_v2": {
|
||||
"name": "Adafruit Feather ESP32 V2",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"adafruit_funhouse_esp32s2": {
|
||||
"name": "Adafruit FunHouse",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
@@ -1411,14 +1422,14 @@ BOARDS = {
|
||||
"name": "Adafruit Metro ESP32-S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"adafruit_qtpy_esp32": {
|
||||
"name": "Adafruit QT Py ESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"adafruit_qtpy_esp32c3": {
|
||||
"name": "Adafruit QT Py ESP32-C3",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"adafruit_qtpy_esp32": {
|
||||
"name": "Adafruit QT Py ESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"adafruit_qtpy_esp32s2": {
|
||||
"name": "Adafruit QT Py ESP32-S2",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
@@ -1467,14 +1478,14 @@ BOARDS = {
|
||||
"name": "Smart Bee Data Logger",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"bee_motion": {
|
||||
"name": "Smart Bee Motion",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"bee_motion_mini": {
|
||||
"name": "Smart Bee Motion Mini",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"bee_motion": {
|
||||
"name": "Smart Bee Motion",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"bee_motion_s3": {
|
||||
"name": "Smart Bee Motion S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -1507,10 +1518,6 @@ BOARDS = {
|
||||
"name": "D-duino-32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"deneyapkart": {
|
||||
"name": "Deneyap Kart",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"deneyapkart1A": {
|
||||
"name": "Deneyap Kart 1A",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1523,6 +1530,10 @@ BOARDS = {
|
||||
"name": "Deneyap Kart G",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"deneyapkart": {
|
||||
"name": "Deneyap Kart",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"deneyapmini": {
|
||||
"name": "Deneyap Mini",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
@@ -1563,8 +1574,8 @@ BOARDS = {
|
||||
"name": "Seeed Studio Edgebox-ESP-100",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp-wrover-kit": {
|
||||
"name": "Espressif ESP-WROVER-KIT",
|
||||
"esp320": {
|
||||
"name": "Electronic SweetPeas ESP320",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-c2-devkitm-1": {
|
||||
@@ -1583,6 +1594,10 @@ BOARDS = {
|
||||
"name": "Ai-Thinker ESP-C3-M1-I-Kit",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"esp32-c5-devkitc-1": {
|
||||
"name": "Espressif ESP32-C5-DevKitC-1",
|
||||
"variant": VARIANT_ESP32C5,
|
||||
},
|
||||
"esp32-c6-devkitc-1": {
|
||||
"name": "Espressif ESP32-C6-DevKitC-1",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
@@ -1591,10 +1606,26 @@ BOARDS = {
|
||||
"name": "Espressif ESP32-C6-DevKitM-1",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
},
|
||||
"esp32cam": {
|
||||
"name": "AI Thinker ESP32-CAM",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-devkitlipo": {
|
||||
"name": "OLIMEX ESP32-DevKit-LiPo",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32dev": {
|
||||
"name": "Espressif ESP32 Dev Module",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32doit-devkit-v1": {
|
||||
"name": "DOIT ESP32 DEVKIT V1",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32doit-espduino": {
|
||||
"name": "DOIT ESPduino32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-evb": {
|
||||
"name": "OLIMEX ESP32-EVB",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1619,14 +1650,14 @@ BOARDS = {
|
||||
"name": "Espressif ESP32-PICO-DevKitM-2",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-poe": {
|
||||
"name": "OLIMEX ESP32-PoE",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-poe-iso": {
|
||||
"name": "OLIMEX ESP32-PoE-ISO",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-poe": {
|
||||
"name": "OLIMEX ESP32-PoE",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32-pro": {
|
||||
"name": "OLIMEX ESP32-PRO",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1643,46 +1674,6 @@ BOARDS = {
|
||||
"name": "Espressif ESP32-S2-Saola-1",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"esp32-s3-devkitc-1": {
|
||||
"name": "Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32-s3-devkitm-1": {
|
||||
"name": "Espressif ESP32-S3-DevKitM-1",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32-solo1": {
|
||||
"name": "Espressif Generic ESP32-solo1 4M Flash",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp320": {
|
||||
"name": "Electronic SweetPeas ESP320",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32cam": {
|
||||
"name": "AI Thinker ESP32-CAM",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32dev": {
|
||||
"name": "Espressif ESP32 Dev Module",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32doit-devkit-v1": {
|
||||
"name": "DOIT ESP32 DEVKIT V1",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32doit-espduino": {
|
||||
"name": "DOIT ESPduino32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32s3_120_16_8-qio_opi": {
|
||||
"name": "ESP32-S3 16MB QIO, 8MB OPI PSRAM",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32s3_powerfeather": {
|
||||
"name": "ESP32-S3 PowerFeather",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32s3box": {
|
||||
"name": "Espressif ESP32-S3-Box",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -1691,10 +1682,26 @@ BOARDS = {
|
||||
"name": "ESP32S3 CAM LCD",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32-s3-devkitc-1": {
|
||||
"name": "Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32-s3-devkitm-1": {
|
||||
"name": "Espressif ESP32-S3-DevKitM-1",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32s3_powerfeather": {
|
||||
"name": "ESP32-S3 PowerFeather",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32s3usbotg": {
|
||||
"name": "Espressif ESP32-S3-USB-OTG",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"esp32-solo1": {
|
||||
"name": "Espressif Generic ESP32-solo1 4M Flash",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp32thing": {
|
||||
"name": "SparkFun ESP32 Thing",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1719,6 +1726,10 @@ BOARDS = {
|
||||
"name": "ESPino32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"esp-wrover-kit": {
|
||||
"name": "Espressif ESP-WROVER-KIT",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"etboard": {
|
||||
"name": "ETBoard",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1747,14 +1758,6 @@ BOARDS = {
|
||||
"name": "Franzininho WiFi MSC",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"freenove_esp32_s3_wroom": {
|
||||
"name": "Freenove ESP32-S3 WROOM N8R8 (8MB Flash / 8MB PSRAM)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"freenove_esp32_wrover": {
|
||||
"name": "Freenove ESP32-Wrover",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"frogboard": {
|
||||
"name": "Frog Board ESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1771,10 +1774,6 @@ BOARDS = {
|
||||
"name": "Heltec WiFi Kit 32 (V3)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"heltec_wifi_kit_32_v2": {
|
||||
"name": "Heltec WiFi Kit 32 (V2)",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"heltec_wifi_lora_32": {
|
||||
"name": "Heltec WiFi LoRa 32",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1787,14 +1786,14 @@ BOARDS = {
|
||||
"name": "Heltec WiFi LoRa 32 (V3)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"heltec_wireless_stick": {
|
||||
"name": "Heltec Wireless Stick",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"heltec_wireless_stick_lite": {
|
||||
"name": "Heltec Wireless Stick Lite",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"heltec_wireless_stick": {
|
||||
"name": "Heltec Wireless Stick",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"honeylemon": {
|
||||
"name": "HONEYLemon",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1807,14 +1806,6 @@ BOARDS = {
|
||||
"name": "Hornbill ESP32 Minima",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"huidu_hd_wf2": {
|
||||
"name": "Huidu HD-WF2",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"huidu_hd_wf4": {
|
||||
"name": "Huidu HD-WF4",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"imbrios-logsens-v1p1": {
|
||||
"name": "Imbrios LogSens V1P1",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1847,10 +1838,6 @@ BOARDS = {
|
||||
"name": "ArtronShop IOXESP32PS",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"jczn_2432s028r": {
|
||||
"name": "ESP32-2432S028R CYD",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"kb32-ft": {
|
||||
"name": "MakerAsia KB32-FT",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1875,10 +1862,6 @@ BOARDS = {
|
||||
"name": "LilyGo T-Display-S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lilygo-t3-s3": {
|
||||
"name": "LilyGo T3-S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lionbit": {
|
||||
"name": "Lion:Bit Dev Board",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1887,14 +1870,14 @@ BOARDS = {
|
||||
"name": "Lion:Bit S3 STEM Dev Board",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lolin32": {
|
||||
"name": "WEMOS LOLIN32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"lolin32_lite": {
|
||||
"name": "WEMOS LOLIN32 Lite",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"lolin32": {
|
||||
"name": "WEMOS LOLIN32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"lolin_c3_mini": {
|
||||
"name": "WEMOS LOLIN C3 Mini",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
@@ -1915,30 +1898,26 @@ BOARDS = {
|
||||
"name": "WEMOS LOLIN S2 PICO",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"lolin_s3": {
|
||||
"name": "WEMOS LOLIN S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lolin_s3_mini": {
|
||||
"name": "WEMOS LOLIN S3 Mini",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lolin_s3_mini_pro": {
|
||||
"name": "WEMOS LOLIN S3 Mini Pro",
|
||||
"lolin_s3": {
|
||||
"name": "WEMOS LOLIN S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lolin_s3_pro": {
|
||||
"name": "WEMOS LOLIN S3 PRO",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"lopy": {
|
||||
"name": "Pycom LoPy",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"lopy4": {
|
||||
"name": "Pycom LoPy4",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"lopy": {
|
||||
"name": "Pycom LoPy",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack-atom": {
|
||||
"name": "M5Stack-ATOM",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -1947,16 +1926,16 @@ BOARDS = {
|
||||
"name": "M5Stack AtomS3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"m5stack-core-esp32": {
|
||||
"name": "M5Stack Core ESP32",
|
||||
"m5stack-core2": {
|
||||
"name": "M5Stack Core2",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack-core-esp32-16M": {
|
||||
"name": "M5Stack Core ESP32 16M",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack-core2": {
|
||||
"name": "M5Stack Core2",
|
||||
"m5stack-core-esp32": {
|
||||
"name": "M5Stack Core ESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack-coreink": {
|
||||
@@ -1975,6 +1954,10 @@ BOARDS = {
|
||||
"name": "M5Stack GREY ESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack_paper": {
|
||||
"name": "M5Stack Paper",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack-stamps3": {
|
||||
"name": "M5Stack StampS3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -1987,10 +1970,6 @@ BOARDS = {
|
||||
"name": "M5Stack Timer CAM",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stack_paper": {
|
||||
"name": "M5Stack Paper",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"m5stamp-pico": {
|
||||
"name": "M5Stamp-Pico",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -2059,14 +2038,14 @@ BOARDS = {
|
||||
"name": "Node32s",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"nodemcu-32s": {
|
||||
"name": "NodeMCU-32S",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"nodemcu-32s2": {
|
||||
"name": "Ai-Thinker NodeMCU-32S2 (ESP-12K)",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"nodemcu-32s": {
|
||||
"name": "NodeMCU-32S",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"nscreen-32": {
|
||||
"name": "YeaCreate NSCREEN-32",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -2115,22 +2094,10 @@ BOARDS = {
|
||||
"name": "RoboHeart Hercules",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"rymcu-esp32-s3-devkitc-1": {
|
||||
"name": "RYMCU ESP32-S3-DevKitC-1-N8R2 (8 MB QD, 2 MB PSRAM)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"s_odi_ultra": {
|
||||
"name": "S.ODI Ultra v1",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"seeed_xiao_esp32c3": {
|
||||
"name": "Seeed Studio XIAO ESP32C3",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"seeed_xiao_esp32c6": {
|
||||
"name": "Seeed Studio XIAO ESP32C6",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
},
|
||||
"seeed_xiao_esp32s3": {
|
||||
"name": "Seeed Studio XIAO ESP32S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -2147,38 +2114,34 @@ BOARDS = {
|
||||
"name": "SG-O AirMon",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32_iot_redboard": {
|
||||
"name": "SparkFun ESP32 IoT RedBoard",
|
||||
"s_odi_ultra": {
|
||||
"name": "S.ODI Ultra v1",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32c6_thing_plus": {
|
||||
"name": "Sparkfun ESP32-C6 Thing Plus",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
},
|
||||
"sparkfun_esp32_iot_redboard": {
|
||||
"name": "SparkFun ESP32 IoT RedBoard",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32micromod": {
|
||||
"name": "SparkFun ESP32 MicroMod",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32s2_thing_plus_c": {
|
||||
"name": "SparkFun ESP32 Thing Plus C",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32s2_thing_plus": {
|
||||
"name": "SparkFun ESP32-S2 Thing Plus",
|
||||
"variant": VARIANT_ESP32S2,
|
||||
},
|
||||
"sparkfun_esp32s2_thing_plus_c": {
|
||||
"name": "SparkFun ESP32 Thing Plus C",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_esp32s3_thing_plus": {
|
||||
"name": "SPARKFUN_ESP32S3_THING_PLUS",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"sparkfun_lora_gateway_1-channel": {
|
||||
"name": "SparkFun LoRa Gateway 1-Channel",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"sparkfun_qwiic_pocket_esp32c6": {
|
||||
"name": "SparkFun ESP32-C6 Qwiic Pocket",
|
||||
"variant": VARIANT_ESP32C6,
|
||||
},
|
||||
"tamc_termod_s3": {
|
||||
"name": "TAMC Termod S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -2187,10 +2150,6 @@ BOARDS = {
|
||||
"name": "Unexpected Maker TinyPICO",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"trueverit-iot-driver": {
|
||||
"name": "Trueverit ESP32 Universal IoT Driver",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"trueverit-iot-driver-mk2": {
|
||||
"name": "Trueverit ESP32 Universal IoT Driver MK II",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -2199,28 +2158,20 @@ BOARDS = {
|
||||
"name": "Trueverit ESP32 Universal IoT Driver MK III",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-lora32-v1": {
|
||||
"name": "TTGO LoRa32-OLED V1",
|
||||
"trueverit-iot-driver": {
|
||||
"name": "Trueverit ESP32 Universal IoT Driver",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-lora32-v2": {
|
||||
"name": "TTGO LoRa32-OLED V2",
|
||||
"ttgo-lora32-v1": {
|
||||
"name": "TTGO LoRa32-OLED V1",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-lora32-v21": {
|
||||
"name": "TTGO LoRa32-OLED v2.1.6",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-t-beam": {
|
||||
"name": "TTGO T-Beam",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-t-oi-plus": {
|
||||
"name": "TTGO T-OI PLUS RISC-V ESP32-C3",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"ttgo-t-watch": {
|
||||
"name": "TTGO T-Watch",
|
||||
"ttgo-lora32-v2": {
|
||||
"name": "TTGO LoRa32-OLED V2",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-t1": {
|
||||
@@ -2235,6 +2186,18 @@ BOARDS = {
|
||||
"name": "TTGO T7 V1.4 Mini32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-t-beam": {
|
||||
"name": "TTGO T-Beam",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ttgo-t-oi-plus": {
|
||||
"name": "TTGO T-OI PLUS RISC-V ESP32-C3",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"ttgo-t-watch": {
|
||||
"name": "TTGO T-Watch",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"turta_iot_node": {
|
||||
"name": "Turta IoT Node",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -2307,17 +2270,9 @@ BOARDS = {
|
||||
"name": "SQFMI Watchy v2.0",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"waveshare_esp32_s3_zero": {
|
||||
"name": "Waveshare ESP32-S3-Zero",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"waveshare_esp32s3_touch_lcd_128": {
|
||||
"name": "Waveshare ESP32-S3-Touch-LCD-1.28 (16 MB QD, 2MB PSRAM)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"weactstudio_esp32c3coreboard": {
|
||||
"name": "WeAct Studio ESP32C3CoreBoard",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
"wemosbat": {
|
||||
"name": "WeMos WiFi and Bluetooth Battery",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wemos_d1_mini32": {
|
||||
"name": "WEMOS D1 MINI ESP32",
|
||||
@@ -2327,10 +2282,6 @@ BOARDS = {
|
||||
"name": "WEMOS D1 R32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wemosbat": {
|
||||
"name": "WeMos WiFi and Bluetooth Battery",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wesp32": {
|
||||
"name": "Silicognition wESP32",
|
||||
"variant": VARIANT_ESP32,
|
||||
@@ -2339,14 +2290,14 @@ BOARDS = {
|
||||
"name": "Widora AIR",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wifiduino32": {
|
||||
"name": "Blinker WiFiduino32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wifiduino32c3": {
|
||||
"name": "Blinker WiFiduinoV2 (ESP32-C3)",
|
||||
"variant": VARIANT_ESP32C3,
|
||||
},
|
||||
"wifiduino32": {
|
||||
"name": "Blinker WiFiduino32",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wifiduino32s3": {
|
||||
"name": "Blinker WiFiduino32S3",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
@@ -2355,32 +2306,12 @@ BOARDS = {
|
||||
"name": "Pycom WiPy3",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"ws_esp32_s3_matrix": {
|
||||
"name": "Waveshare ESP32-S3-Matrix",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"wt32-eth01": {
|
||||
"name": "Wireless-Tag WT32-ETH01 Ethernet Module",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"wt32-sc01-plus": {
|
||||
"name": "wt32-sc01-plus",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"xinabox_cw02": {
|
||||
"name": "XinaBox CW02",
|
||||
"variant": VARIANT_ESP32,
|
||||
},
|
||||
"yb_esp32s3_amp_v2": {
|
||||
"name": "YelloByte YB-ESP32-S3-AMP (Rev.2)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"yb_esp32s3_amp_v3": {
|
||||
"name": "YelloByte YB-ESP32-S3-AMP (Rev.3)",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
"yb_esp32s3_eth": {
|
||||
"name": "YelloByte YB-ESP32-S3-ETH",
|
||||
"variant": VARIANT_ESP32S3,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ void EZOSensor::dump_config() {
|
||||
LOG_SENSOR("", "EZO", this);
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EZO circuit failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ static const std::string DOSING_MODE_CONTINUOUS = "Continuous";
|
||||
void EzoPMP::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with EZO-PMP circuit failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ static const char *const TAG = "factory_reset.button";
|
||||
|
||||
void FactoryResetButton::dump_config() { LOG_BUTTON("", "Factory Reset Button", this); }
|
||||
void FactoryResetButton::press_action() {
|
||||
ESP_LOGI(TAG, "Resetting...");
|
||||
ESP_LOGI(TAG, "Resetting to factory defaults...");
|
||||
// Let MQTT settle a bit
|
||||
delay(100); // NOLINT
|
||||
global_preferences->reset();
|
||||
|
||||
@@ -14,7 +14,7 @@ void FactoryResetSwitch::write_state(bool state) {
|
||||
this->publish_state(false);
|
||||
|
||||
if (state) {
|
||||
ESP_LOGI(TAG, "Resetting...");
|
||||
ESP_LOGI(TAG, "Resetting to factory defaults...");
|
||||
// Let MQTT settle a bit
|
||||
delay(100); // NOLINT
|
||||
global_preferences->reset();
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace gcja5 {
|
||||
|
||||
static const char *const TAG = "gcja5";
|
||||
|
||||
void GCJA5Component::setup() { ESP_LOGCONFIG(TAG, "Running setup"); }
|
||||
|
||||
void GCJA5Component::loop() {
|
||||
const uint32_t now = App.get_loop_component_start_time();
|
||||
if (now - this->last_transmission_ >= 500) {
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace gcja5 {
|
||||
|
||||
class GCJA5Component : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
||||
|
||||
@@ -60,7 +60,7 @@ void GDK101Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "GDK101:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with GDK101 failed!");
|
||||
}
|
||||
#ifdef USE_SENSOR
|
||||
LOG_SENSOR(" ", "Firmware Version", this->fw_version_sensor_);
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace gpio {
|
||||
static const char *const TAG = "gpio.output";
|
||||
|
||||
void GPIOBinaryOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Binary Output:");
|
||||
ESP_LOGCONFIG(TAG, "GPIO Binary Output:");
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
LOG_BINARY_OUTPUT(this);
|
||||
}
|
||||
|
||||
@@ -67,17 +67,17 @@ void GroveGasMultichannelV2Component::dump_config() {
|
||||
if (this->is_failed()) {
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGW(TAG, "Communication failed! Is the sensor connected?");
|
||||
break;
|
||||
case APP_INVALID:
|
||||
ESP_LOGW(TAG, "Sensor reported invalid APP installed");
|
||||
ESP_LOGW(TAG, "Sensor reported invalid APP installed.");
|
||||
break;
|
||||
case APP_START_FAILED:
|
||||
ESP_LOGW(TAG, "Sensor reported APP start failed");
|
||||
ESP_LOGW(TAG, "Sensor reported APP start failed.");
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unknown setup error");
|
||||
ESP_LOGW(TAG, "Unknown setup error!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void HDC1080Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HDC1080:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HDC1080 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_);
|
||||
|
||||
@@ -23,7 +23,7 @@ void HM3301Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HM3301:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (error_code_ == ERROR_COMM) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HM3301 failed!");
|
||||
}
|
||||
|
||||
LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_);
|
||||
|
||||
@@ -73,7 +73,7 @@ void HMC5883LComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HMC5883L:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->error_code_ == COMMUNICATION_FAILED) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HMC5883L failed!");
|
||||
} else if (this->error_code_ == ID_REGISTERS) {
|
||||
ESP_LOGE(TAG, "The ID registers don't match - Is this really an HMC5883L?");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void HoneywellHIComponent::read_sensor_data_() {
|
||||
uint8_t data[4];
|
||||
|
||||
if (this->read(data, sizeof(data)) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void HoneywellHIComponent::read_sensor_data_() {
|
||||
|
||||
void HoneywellHIComponent::start_measurement_() {
|
||||
if (this->write(REQUEST_CMD, sizeof(REQUEST_CMD)) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ bool HoneywellHIComponent::is_measurement_ready_() {
|
||||
uint8_t data[1];
|
||||
|
||||
if (this->read(data, sizeof(data)) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!");
|
||||
this->mark_failed();
|
||||
return false;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void HoneywellHIComponent::dump_config() {
|
||||
ESP_LOGD(TAG, "Honeywell HIH:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with Honeywell HIH failed!");
|
||||
}
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
|
||||
|
||||
@@ -14,7 +14,7 @@ static const char *const TAG = "honeywellabp2";
|
||||
|
||||
void HONEYWELLABP2Sensor::read_sensor_data() {
|
||||
if (this->read(raw_data_, 7) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ABP2 failed!");
|
||||
this->status_set_warning("couldn't read sensor data");
|
||||
return;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ void HONEYWELLABP2Sensor::read_sensor_data() {
|
||||
|
||||
void HONEYWELLABP2Sensor::start_measurement() {
|
||||
if (this->write(i2c_cmd_, 3) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ABP2 failed!");
|
||||
this->status_set_warning("couldn't start measurement");
|
||||
return;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ void HONEYWELLABP2Sensor::start_measurement() {
|
||||
|
||||
bool HONEYWELLABP2Sensor::is_measurement_ready() {
|
||||
if (this->read(raw_data_, 1) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with ABP2 failed!");
|
||||
this->status_set_warning("couldn't check measurement");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void HTE501Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HTE501 failed!");
|
||||
break;
|
||||
case CRC_CHECK_FAILED:
|
||||
ESP_LOGE(TAG, "The crc check failed");
|
||||
|
||||
@@ -10,7 +10,6 @@ from esphome.const import (
|
||||
CONF_TIMEOUT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_URL,
|
||||
CONF_WATCHDOG_TIMEOUT,
|
||||
PLATFORM_HOST,
|
||||
__version__,
|
||||
)
|
||||
@@ -44,6 +43,7 @@ CONF_USERAGENT = "useragent"
|
||||
CONF_VERIFY_SSL = "verify_ssl"
|
||||
CONF_FOLLOW_REDIRECTS = "follow_redirects"
|
||||
CONF_REDIRECT_LIMIT = "redirect_limit"
|
||||
CONF_WATCHDOG_TIMEOUT = "watchdog_timeout"
|
||||
CONF_BUFFER_SIZE_RX = "buffer_size_rx"
|
||||
CONF_BUFFER_SIZE_TX = "buffer_size_tx"
|
||||
CONF_CA_CERTIFICATE_PATH = "ca_certificate_path"
|
||||
|
||||
@@ -32,7 +32,7 @@ void HTU21DComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HTU21D:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HTU21D failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_);
|
||||
|
||||
@@ -161,7 +161,7 @@ void HTU31DComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "HTU31D:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HTU31D failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_);
|
||||
|
||||
@@ -21,14 +21,14 @@ void HYT271Component::update() {
|
||||
|
||||
if (this->write(&raw_data[0], 0) != i2c::ERROR_OK) {
|
||||
this->status_set_warning();
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HYT271 failed! => Ask new values");
|
||||
return;
|
||||
}
|
||||
this->set_timeout("wait_convert", 50, [this]() {
|
||||
uint8_t raw_data[4];
|
||||
if (this->read(raw_data, 4) != i2c::ERROR_OK) {
|
||||
this->status_set_warning();
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with HYT271 failed! => Read values");
|
||||
return;
|
||||
}
|
||||
uint16_t raw_temperature = ((raw_data[2] << 8) | raw_data[3]) >> 2;
|
||||
|
||||
@@ -94,13 +94,13 @@ void ArduinoI2CBus::dump_config() {
|
||||
break;
|
||||
}
|
||||
if (this->scan_) {
|
||||
ESP_LOGI(TAG, "Results from bus scan:");
|
||||
ESP_LOGI(TAG, "Results from i2c bus scan:");
|
||||
if (scan_results_.empty()) {
|
||||
ESP_LOGI(TAG, "Found no devices");
|
||||
ESP_LOGI(TAG, "Found no i2c devices!");
|
||||
} else {
|
||||
for (const auto &s : scan_results_) {
|
||||
if (s.second) {
|
||||
ESP_LOGI(TAG, "Found device at address 0x%02X", s.first);
|
||||
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", s.first);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unknown error at address 0x%02X", s.first);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ ErrorCode ArduinoI2CBus::writev(uint8_t address, WriteBuffer *buffers, size_t cn
|
||||
/// https://www.nxp.com/docs/en/user-guide/UM10204.pdf
|
||||
/// https://www.analog.com/media/en/technical-documentation/application-notes/54305147357414AN686_0.pdf
|
||||
void ArduinoI2CBus::recover_() {
|
||||
ESP_LOGI(TAG, "Performing bus recovery");
|
||||
ESP_LOGI(TAG, "Performing I2C bus recovery");
|
||||
|
||||
// For the upcoming operations, target for a 100kHz toggle frequency.
|
||||
// This is the maximum frequency for I2C running in standard-mode.
|
||||
@@ -232,7 +232,7 @@ void ArduinoI2CBus::recover_() {
|
||||
// line. In that case, the I2C bus cannot be recovered.
|
||||
delayMicroseconds(half_period_usec);
|
||||
if (digitalRead(scl_pin_) == LOW) { // NOLINT
|
||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW on the bus");
|
||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW on the I2C bus");
|
||||
recovery_result_ = RECOVERY_FAILED_SCL_LOW;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ void IDFI2CBus::setup() {
|
||||
#endif
|
||||
|
||||
if (port_ == I2C_NUM_MAX) {
|
||||
ESP_LOGE(TAG, "No more than %u buses supported", SOC_HP_I2C_NUM);
|
||||
ESP_LOGE(TAG, "Too many I2C buses configured. Max %u supported.", SOC_HP_I2C_NUM);
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -99,13 +99,13 @@ void IDFI2CBus::dump_config() {
|
||||
break;
|
||||
}
|
||||
if (this->scan_) {
|
||||
ESP_LOGI(TAG, "Results from bus scan:");
|
||||
ESP_LOGI(TAG, "Results from i2c bus scan:");
|
||||
if (scan_results_.empty()) {
|
||||
ESP_LOGI(TAG, "Found no devices");
|
||||
ESP_LOGI(TAG, "Found no i2c devices!");
|
||||
} else {
|
||||
for (const auto &s : scan_results_) {
|
||||
if (s.second) {
|
||||
ESP_LOGI(TAG, "Found device at address 0x%02X", s.first);
|
||||
ESP_LOGI(TAG, "Found i2c device at address 0x%02X", s.first);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unknown error at address 0x%02X", s.first);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ ErrorCode IDFI2CBus::writev(uint8_t address, WriteBuffer *buffers, size_t cnt, b
|
||||
/// https://www.nxp.com/docs/en/user-guide/UM10204.pdf
|
||||
/// https://www.analog.com/media/en/technical-documentation/application-notes/54305147357414AN686_0.pdf
|
||||
void IDFI2CBus::recover_() {
|
||||
ESP_LOGI(TAG, "Performing bus recovery");
|
||||
ESP_LOGI(TAG, "Performing I2C bus recovery");
|
||||
|
||||
const gpio_num_t scl_pin = static_cast<gpio_num_t>(scl_pin_);
|
||||
const gpio_num_t sda_pin = static_cast<gpio_num_t>(sda_pin_);
|
||||
@@ -294,7 +294,7 @@ void IDFI2CBus::recover_() {
|
||||
// with the SCL line. In that case, the I2C bus cannot be recovered.
|
||||
delayMicroseconds(half_period_usec);
|
||||
if (gpio_get_level(scl_pin) == 0) {
|
||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW on the bus");
|
||||
ESP_LOGE(TAG, "Recovery failed: SCL is held LOW on the I2C bus");
|
||||
recovery_result_ = RECOVERY_FAILED_SCL_LOW;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ struct SensorData {
|
||||
|
||||
void IAQCore::setup() {
|
||||
if (this->write(nullptr, 0) != i2c::ERROR_OK) {
|
||||
ESP_LOGD(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGD(TAG, "Communication failed!");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void IAQCore::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with AMS iAQ Core failed!");
|
||||
}
|
||||
LOG_SENSOR(" ", "CO2", this->co2_);
|
||||
LOG_SENSOR(" ", "TVOC", this->tvoc_);
|
||||
|
||||
@@ -134,7 +134,7 @@ void INA219Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with INA219 failed!");
|
||||
return;
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
@@ -88,7 +88,7 @@ void INA226Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with INA226 failed!");
|
||||
return;
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
@@ -203,7 +203,7 @@ void INA2XX::dump_config() {
|
||||
this->dev_id_);
|
||||
}
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with INA2xx failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
ESP_LOGCONFIG(TAG, " Shunt resistance = %f Ohm", this->shunt_resistance_ohm_);
|
||||
|
||||
@@ -60,7 +60,7 @@ void INA3221Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "INA3221:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with INA3221 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
|
||||
@@ -6,12 +6,9 @@ from esphome.const import (
|
||||
CONF_FULL_UPDATE_EVERY,
|
||||
CONF_ID,
|
||||
CONF_LAMBDA,
|
||||
CONF_MIRROR_X,
|
||||
CONF_MIRROR_Y,
|
||||
CONF_MODEL,
|
||||
CONF_OE_PIN,
|
||||
CONF_PAGES,
|
||||
CONF_TRANSFORM,
|
||||
CONF_WAKEUP_PIN,
|
||||
)
|
||||
|
||||
@@ -39,6 +36,7 @@ CONF_SPH_PIN = "sph_pin"
|
||||
CONF_SPV_PIN = "spv_pin"
|
||||
CONF_VCOM_PIN = "vcom_pin"
|
||||
|
||||
|
||||
inkplate6_ns = cg.esphome_ns.namespace("inkplate6")
|
||||
Inkplate6 = inkplate6_ns.class_(
|
||||
"Inkplate6",
|
||||
@@ -64,12 +62,6 @@ CONFIG_SCHEMA = cv.All(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(Inkplate6),
|
||||
cv.Optional(CONF_GREYSCALE, default=False): cv.boolean,
|
||||
cv.Optional(CONF_TRANSFORM): cv.Schema(
|
||||
{
|
||||
cv.Optional(CONF_MIRROR_X, default=False): cv.boolean,
|
||||
cv.Optional(CONF_MIRROR_Y, default=False): cv.boolean,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_PARTIAL_UPDATING, default=True): cv.boolean,
|
||||
cv.Optional(CONF_FULL_UPDATE_EVERY, default=10): cv.uint32_t,
|
||||
cv.Optional(CONF_MODEL, default="inkplate_6"): cv.enum(
|
||||
@@ -134,9 +126,6 @@ async def to_code(config):
|
||||
cg.add(var.set_writer(lambda_))
|
||||
|
||||
cg.add(var.set_greyscale(config[CONF_GREYSCALE]))
|
||||
if transform := config.get(CONF_TRANSFORM):
|
||||
cg.add(var.set_mirror_x(transform[CONF_MIRROR_X]))
|
||||
cg.add(var.set_mirror_y(transform[CONF_MIRROR_Y]))
|
||||
cg.add(var.set_partial_updating(config[CONF_PARTIAL_UPDATING]))
|
||||
cg.add(var.set_full_update_every(config[CONF_FULL_UPDATE_EVERY]))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "inkplate.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_ESP32_FRAMEWORK_ARDUINO
|
||||
|
||||
@@ -156,12 +156,6 @@ void HOT Inkplate6::draw_absolute_pixel_internal(int x, int y, Color color) {
|
||||
if (x >= this->get_width_internal() || y >= this->get_height_internal() || x < 0 || y < 0)
|
||||
return;
|
||||
|
||||
if (this->mirror_y_)
|
||||
y = this->get_height_internal() - y - 1;
|
||||
|
||||
if (this->mirror_x_)
|
||||
x = this->get_width_internal() - x - 1;
|
||||
|
||||
if (this->greyscale_) {
|
||||
int x1 = x / 2;
|
||||
int x_sub = x % 2;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/components/display/display_buffer.h"
|
||||
#include "esphome/components/i2c/i2c.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/components/i2c/i2c.h"
|
||||
#include "esphome/components/display/display_buffer.h"
|
||||
|
||||
#ifdef USE_ESP32_FRAMEWORK_ARDUINO
|
||||
|
||||
@@ -92,9 +92,6 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
||||
if (this->is_ready())
|
||||
this->initialize_();
|
||||
}
|
||||
void set_mirror_y(bool mirror_y) { this->mirror_y_ = mirror_y; }
|
||||
void set_mirror_x(bool mirror_x) { this->mirror_x_ = mirror_x; }
|
||||
|
||||
void set_partial_updating(bool partial_updating) { this->partial_updating_ = partial_updating; }
|
||||
void set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; }
|
||||
|
||||
@@ -224,8 +221,6 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
||||
|
||||
bool block_partial_{true};
|
||||
bool greyscale_;
|
||||
bool mirror_y_{false};
|
||||
bool mirror_x_{false};
|
||||
bool partial_updating_;
|
||||
|
||||
InkplateModel model_;
|
||||
|
||||
@@ -20,7 +20,8 @@ std::string build_json(const json_build_t &f) {
|
||||
ESP_LOGV(TAG, "Attempting to allocate %zu bytes for JSON serialization", request_size);
|
||||
DynamicJsonDocument json_document(request_size);
|
||||
if (json_document.capacity() == 0) {
|
||||
ESP_LOGE(TAG, "Could not allocate memory for document! Requested %zu bytes, largest free heap block: %zu bytes",
|
||||
ESP_LOGE(TAG,
|
||||
"Could not allocate memory for JSON document! Requested %zu bytes, largest free heap block: %zu bytes",
|
||||
request_size, free_heap);
|
||||
return "{}";
|
||||
}
|
||||
@@ -28,7 +29,7 @@ std::string build_json(const json_build_t &f) {
|
||||
f(root);
|
||||
if (json_document.overflowed()) {
|
||||
if (request_size == free_heap) {
|
||||
ESP_LOGE(TAG, "Could not allocate memory for document! Overflowed largest free heap block: %zu bytes",
|
||||
ESP_LOGE(TAG, "Could not allocate memory for JSON document! Overflowed largest free heap block: %zu bytes",
|
||||
free_heap);
|
||||
return "{}";
|
||||
}
|
||||
@@ -53,7 +54,7 @@ bool parse_json(const std::string &data, const json_parse_t &f) {
|
||||
while (true) {
|
||||
DynamicJsonDocument json_document(request_size);
|
||||
if (json_document.capacity() == 0) {
|
||||
ESP_LOGE(TAG, "Could not allocate memory for document! Requested %zu bytes, free heap: %zu", request_size,
|
||||
ESP_LOGE(TAG, "Could not allocate memory for JSON document! Requested %zu bytes, free heap: %zu", request_size,
|
||||
free_heap);
|
||||
return false;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ bool parse_json(const std::string &data, const json_parse_t &f) {
|
||||
request_size *= 2;
|
||||
continue;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Parse error: %s", err.c_str());
|
||||
ESP_LOGE(TAG, "JSON parse error: %s", err.c_str());
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ static const char *const TAG = "kamstrup_kmp";
|
||||
void KamstrupKMPComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "kamstrup_kmp:");
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with Kamstrup meter failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ void PCF8574LCDDisplay::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with LCD Display failed!");
|
||||
}
|
||||
}
|
||||
void PCF8574LCDDisplay::write_n_bits(uint8_t value, uint8_t n) {
|
||||
|
||||
@@ -113,7 +113,7 @@ void LTRAlsPs501Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Actual gain", this->actual_gain_sensor_);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with I2C LTR-501/301/558 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ void LTRAlsPsComponent::dump_config() {
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with I2C LTR-303/329/55x/659 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void MAX17043Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MAX17043:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MAX17043 failed");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Battery Voltage", this->voltage_sensor_);
|
||||
|
||||
@@ -48,7 +48,7 @@ void MAX44009Sensor::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MAX44009:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MAX44009 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void MCP4725::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->error_code_ == COMMUNICATION_FAILED) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MCP4725 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ void MCP4728Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MCP4728:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MCP4728 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ void MCP9808Sensor::setup() {
|
||||
uint16_t manu = 0;
|
||||
if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) {
|
||||
this->mark_failed();
|
||||
ESP_LOGE(TAG, "Incorrect manufacturer ID (%X) for '%s'", manu, this->name_.c_str());
|
||||
ESP_LOGE(TAG, "%s manufacuturer id failed, device returned %X", this->name_.c_str(), manu);
|
||||
return;
|
||||
}
|
||||
uint16_t dev_id = 0;
|
||||
if (!this->read_byte_16(MCP9808_REG_DEVICE_ID, &dev_id) || dev_id != MCP9808_DEV_ID) {
|
||||
this->mark_failed();
|
||||
ESP_LOGE(TAG, "Incorrect device ID (%X) for '%s'", dev_id, this->name_.c_str());
|
||||
ESP_LOGE(TAG, "%s device id failed, device returned %X", this->name_.c_str(), dev_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void MCP9808Sensor::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "%s:", this->name_.c_str());
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->name_.c_str());
|
||||
ESP_LOGE(TAG, "Communication with %s failed!", this->name_.c_str());
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this);
|
||||
|
||||
@@ -17,7 +17,7 @@ void MDNSComponent::setup() {
|
||||
|
||||
esp_err_t err = mdns_init();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Init failed: %s", esp_err_to_name(err));
|
||||
ESP_LOGW(TAG, "mDNS init failed: %s", esp_err_to_name(err));
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ void MDNSComponent::setup() {
|
||||
}
|
||||
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "Failed to register service %s: %s", service.service_type.c_str(), esp_err_to_name(err));
|
||||
ESP_LOGW(TAG, "Failed to register mDNS service %s: %s", service.service_type.c_str(), esp_err_to_name(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ void MLX90393Cls::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MLX90393 failed!");
|
||||
return;
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
|
||||
@@ -29,7 +29,7 @@ static const char *const TAG = "mlx90614";
|
||||
void MLX90614Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
if (!this->write_emissivity_()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MLX90614 failed!");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void MLX90614Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MLX90614:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MLX90614 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Ambient", this->ambient_sensor_);
|
||||
|
||||
@@ -79,7 +79,7 @@ void MMC5603Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MMC5603:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->error_code_ == COMMUNICATION_FAILED) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MMC5603 failed!");
|
||||
} else if (this->error_code_ == ID_REGISTERS) {
|
||||
ESP_LOGE(TAG, "The ID registers don't match - Is this really an MMC5603?");
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||
|
||||
} else {
|
||||
// data starts at 2 and length is 4 for read registers commands
|
||||
if (this->role == ModbusRole::SERVER && (function_code == 0x1 || function_code == 0x3 || function_code == 0x4)) {
|
||||
if (this->role == ModbusRole::SERVER && (function_code == 0x3 || function_code == 0x4)) {
|
||||
data_offset = 2;
|
||||
data_len = 4;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void MPL3115A2Component::dump_config() {
|
||||
if (this->is_failed()) {
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MPL3115A2 failed!");
|
||||
break;
|
||||
case WRONG_ID:
|
||||
ESP_LOGE(TAG, "MPL3115A2 has invalid id");
|
||||
|
||||
@@ -72,7 +72,7 @@ void MPR121Component::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
switch (this->error_code_) {
|
||||
case COMMUNICATION_FAILED:
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MPR121 failed!");
|
||||
break;
|
||||
case WRONG_CHIP_STATE:
|
||||
ESP_LOGE(TAG, "MPR121 has wrong default value for CONFIG2?");
|
||||
|
||||
@@ -86,7 +86,7 @@ void MPU6050Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MPU6050:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MPU6050 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);
|
||||
|
||||
@@ -91,7 +91,7 @@ void MPU6886Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MPU6886:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MPU6886 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Acceleration X", this->accel_x_sensor_);
|
||||
|
||||
@@ -32,7 +32,7 @@ void MS5611Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MS5611:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MS5611 failed!");
|
||||
}
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
||||
|
||||
@@ -140,7 +140,7 @@ void MS8607Component::dump_config() {
|
||||
// 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());
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MS8607 failed.");
|
||||
switch (this->error_code_) {
|
||||
case ErrorCode::PT_RESET_FAILED:
|
||||
ESP_LOGE(TAG, "Temperature/Pressure RESET failed");
|
||||
|
||||
@@ -159,7 +159,7 @@ void MSA3xxComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MSA3xx:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with MSA3xx failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Model: %s", model_to_string(this->model_));
|
||||
ESP_LOGCONFIG(TAG, " Power Mode: %s", power_mode_to_string(this->power_mode_));
|
||||
|
||||
@@ -127,7 +127,7 @@ void NAU7802Sensor::dump_config() {
|
||||
LOG_I2C_DEVICE(this);
|
||||
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL_FOR, this->get_name().c_str());
|
||||
ESP_LOGE(TAG, "Communication with NAU7802 failed earlier, during setup");
|
||||
return;
|
||||
}
|
||||
// Note these may differ from the values on the device if calbration has been run
|
||||
|
||||
@@ -17,10 +17,12 @@ void NPI19Component::setup() {
|
||||
uint16_t raw_pressure(0);
|
||||
i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure);
|
||||
if (err != i2c::ERROR_OK) {
|
||||
ESP_LOGCONFIG(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGCONFIG(TAG, " I2C Communication Failed...");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGCONFIG(TAG, " Success...");
|
||||
}
|
||||
|
||||
void NPI19Component::dump_config() {
|
||||
@@ -88,7 +90,7 @@ void NPI19Component::update() {
|
||||
i2c::ErrorCode err = this->read_(raw_temperature, raw_pressure);
|
||||
|
||||
if (err != i2c::ERROR_OK) {
|
||||
ESP_LOGW(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGW(TAG, "I2C Communication Failed");
|
||||
this->status_set_warning();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void PCA6416AComponent::dump_config() {
|
||||
}
|
||||
LOG_I2C_DEVICE(this)
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with PCA6416A failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ void PCA9554Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, " I/O Pins: %d", this->pin_count_);
|
||||
LOG_I2C_DEVICE(this)
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with PCA9554 failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void PCF85063Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PCF85063:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with PCF85063 failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void PCF8563Component::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "PCF8563:");
|
||||
LOG_I2C_DEVICE(this);
|
||||
if (this->is_failed()) {
|
||||
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
||||
ESP_LOGE(TAG, "Communication with PCF8563 failed!");
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user