From c30bc43288b16e53a790baed8acda653272ecca7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Poczkodi?= <gabest11@gmail.com>
Date: Mon, 4 Nov 2024 06:46:04 +0100
Subject: [PATCH] The compiler does not trust its own operator precedence.

---
 esphome/components/deep_sleep/deep_sleep_component.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/esphome/components/deep_sleep/deep_sleep_component.cpp b/esphome/components/deep_sleep/deep_sleep_component.cpp
index 2eab0b831c..8c6f8b8e8d 100644
--- a/esphome/components/deep_sleep/deep_sleep_component.cpp
+++ b/esphome/components/deep_sleep/deep_sleep_component.cpp
@@ -52,7 +52,7 @@ void DeepSleepComponent::set_sleep_duration(uint32_t time_ms) { this->sleep_dura
 void DeepSleepComponent::set_run_duration(uint32_t time_ms) { this->run_duration_ = time_ms; }
 
 void DeepSleepComponent::begin_sleep(bool manual) {
-  if (this->prevent_ && !manual || this->guard_) {
+  if ((this->prevent_ && !manual) || this->guard_) {
     this->next_enter_deep_sleep_ = true;
     return;
   }