From 37180f748debf353824f8de6c86818d165e6a7fa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 23 Aug 2026 10:12:17 -0500 Subject: [PATCH] [time] Skip posix_tz.cpp when no timezone is configured --- esphome/components/time/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/esphome/components/time/__init__.py b/esphome/components/time/__init__.py index 35fad0a450..ab1c192292 100644 --- a/esphome/components/time/__init__.py +++ b/esphome/components/time/__init__.py @@ -9,6 +9,7 @@ from esphome import automation from esphome.automation import Condition import esphome.codegen as cg from esphome.components.zephyr import zephyr_add_prj_conf +from esphome.config_helpers import filter_source_files_from_defines import esphome.config_validation as cv from esphome.const import ( CONF_AT, @@ -473,3 +474,10 @@ async def to_code(config): async def time_has_time_to_code(config, condition_id, template_arg, args): paren = await cg.get_variable(config[CONF_ID]) return cg.new_Pvariable(condition_id, template_arg, paren) + + +# posix_tz.cpp is fully #ifdef'd on USE_TIME_TIMEZONE, set only when a +# timezone is configured or detected. +FILTER_SOURCE_FILES = filter_source_files_from_defines( + {"posix_tz.cpp": "USE_TIME_TIMEZONE"} +)