Compare commits

...

3 Commits

Author SHA1 Message Date
J. Nick Koston
cf691a43b2 [cse7766] Fix power reading stuck when load switches off
When the load is switched off and current drops below the chip's
measurable threshold (~50mA), the CSE7766 sets have_power=false
indicating no valid power measurement. The code was not publishing
any value in this case, leaving the power sensor stuck at its last
reading (e.g., 200W) for 10-20 seconds.

This regression was introduced in 2024.2.0 when PR #6180 refactored
the code from an accumulator-based design to direct publishing. The
original code handled this case by incrementing power_counts_ when
have_voltage && !have_power, effectively publishing 0W.

Fixes esphome/esphome#13613
2026-02-03 05:48:47 +01:00
J. Nick Koston
d4110bf650 [lock] Store state strings in flash and avoid heap allocation in set_state (#13729) 2026-02-03 05:29:24 +01:00
Andrew Gillis
ff6f7d3248 [mipi_dsi] Add WAVESHARE-ESP32-P4-WIFI6-TOUCH-LCD-7B (#13608) 2026-02-03 14:59:51 +11:00
4 changed files with 41 additions and 9 deletions

View File

@@ -152,6 +152,10 @@ void CSE7766Component::parse_data_() {
if (this->power_sensor_ != nullptr) {
this->power_sensor_->publish_state(power);
}
} else if (this->power_sensor_ != nullptr) {
// No valid power measurement from chip - publish 0W to avoid stale readings
// This typically happens when current is below the measurable threshold (~50mA)
this->power_sensor_->publish_state(0.0f);
}
float current = 0.0f;

View File

@@ -2,6 +2,7 @@
#include "esphome/core/defines.h"
#include "esphome/core/controller_registry.h"
#include "esphome/core/log.h"
#include "esphome/core/progmem.h"
namespace esphome::lock {
@@ -84,21 +85,21 @@ LockCall &LockCall::set_state(optional<LockState> state) {
this->state_ = state;
return *this;
}
LockCall &LockCall::set_state(const std::string &state) {
if (str_equals_case_insensitive(state, "LOCKED")) {
LockCall &LockCall::set_state(const char *state) {
if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("LOCKED")) == 0) {
this->set_state(LOCK_STATE_LOCKED);
} else if (str_equals_case_insensitive(state, "UNLOCKED")) {
} else if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("UNLOCKED")) == 0) {
this->set_state(LOCK_STATE_UNLOCKED);
} else if (str_equals_case_insensitive(state, "JAMMED")) {
} else if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("JAMMED")) == 0) {
this->set_state(LOCK_STATE_JAMMED);
} else if (str_equals_case_insensitive(state, "LOCKING")) {
} else if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("LOCKING")) == 0) {
this->set_state(LOCK_STATE_LOCKING);
} else if (str_equals_case_insensitive(state, "UNLOCKING")) {
} else if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("UNLOCKING")) == 0) {
this->set_state(LOCK_STATE_UNLOCKING);
} else if (str_equals_case_insensitive(state, "NONE")) {
} else if (ESPHOME_strcasecmp_P(state, ESPHOME_PSTR("NONE")) == 0) {
this->set_state(LOCK_STATE_NONE);
} else {
ESP_LOGW(TAG, "'%s' - Unrecognized state %s", this->parent_->get_name().c_str(), state.c_str());
ESP_LOGW(TAG, "'%s' - Unrecognized state %s", this->parent_->get_name().c_str(), state);
}
return *this;
}

View File

@@ -83,7 +83,8 @@ class LockCall {
/// Set the state of the lock device.
LockCall &set_state(optional<LockState> state);
/// Set the state of the lock device based on a string.
LockCall &set_state(const std::string &state);
LockCall &set_state(const char *state);
LockCall &set_state(const std::string &state) { return this->set_state(state.c_str()); }
void perform();

View File

@@ -94,3 +94,29 @@ DriverChip(
(0x29, 0x00),
],
)
DriverChip(
"WAVESHARE-ESP32-P4-WIFI6-TOUCH-LCD-7B",
height=600,
width=1024,
hsync_back_porch=160,
hsync_pulse_width=10,
hsync_front_porch=160,
vsync_back_porch=23,
vsync_pulse_width=1,
vsync_front_porch=12,
pclk_frequency="52MHz",
lane_bit_rate="900Mbps",
no_transform=True,
color_order="RGB",
initsequence=[
(0x80, 0x8B),
(0x81, 0x78),
(0x82, 0x84),
(0x83, 0x88),
(0x84, 0xA8),
(0x85, 0xE3),
(0x86, 0x88),
(0xB2, 0x10),
],
)