diff --git a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h index e517376d0f..304ba465e9 100644 --- a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h +++ b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h @@ -21,10 +21,13 @@ class GPIOBinarySensorStore { } bool has_changed() { - InterruptLock lock; - bool changed = this->changed_; + // No lock needed: single writer (ISR) / single reader (main loop) pattern + // Volatile bool operations are atomic on all ESPHome-supported platforms + if (!this->changed_) { + return false; + } this->changed_ = false; - return changed; + return true; } protected: