diff --git a/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp b/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp index 368061093af..e109576c624 100644 --- a/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp +++ b/esphome/components/uptime/text_sensor/uptime_text_sensor.cpp @@ -62,14 +62,15 @@ void UptimeTextSensor::update() { // If nothing shown, show smallest enabled unit if (!show_days && !show_hours && !show_minutes && !show_seconds) { - if (seconds_enabled) + if (seconds_enabled) { show_seconds = true; - else if (minutes_enabled) + } else if (minutes_enabled) { show_minutes = true; - else if (hours_enabled) + } else if (hours_enabled) { show_hours = true; - else + } else { show_days = true; + } } // Build output string on stack