diff --git a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h index 304ba465e9..17f7b4eb19 100644 --- a/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h +++ b/esphome/components/gpio/binary_sensor/gpio_binary_sensor.h @@ -16,7 +16,8 @@ class GPIOBinarySensorStore { static void gpio_intr(GPIOBinarySensorStore *arg); bool get_state() const { - InterruptLock lock; + // No lock needed: state_ is atomically updated by ISR + // Volatile ensures we read the latest value return this->state_; }