mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 09:01:49 +00:00 
			
		
		
		
	fixes
This commit is contained in:
		@@ -10,6 +10,7 @@ from esphome.components.esp32.const import (
 | 
				
			|||||||
    VARIANT_ESP32S2,
 | 
					    VARIANT_ESP32S2,
 | 
				
			||||||
    VARIANT_ESP32S3,
 | 
					    VARIANT_ESP32S3,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_ANALOG,
 | 
					    CONF_ANALOG,
 | 
				
			||||||
@@ -19,7 +20,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE
 | 
					from esphome.core import CORE
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_BLOCK,
 | 
					    CONF_BLOCK,
 | 
				
			||||||
@@ -9,7 +10,6 @@ from esphome.const import (
 | 
				
			|||||||
    CONF_LOOP_TIME,
 | 
					    CONF_LOOP_TIME,
 | 
				
			||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@OttoWinter"]
 | 
					CODEOWNERS = ["@OttoWinter"]
 | 
				
			||||||
DEPENDENCIES = ["logger"]
 | 
					DEPENDENCIES = ["logger"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ from esphome.components.esp32.const import (
 | 
				
			|||||||
    VARIANT_ESP32S2,
 | 
					    VARIANT_ESP32S2,
 | 
				
			||||||
    VARIANT_ESP32S3,
 | 
					    VARIANT_ESP32S3,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_DEFAULT,
 | 
					    CONF_DEFAULT,
 | 
				
			||||||
@@ -29,7 +30,6 @@ from esphome.const import (
 | 
				
			|||||||
    PLATFORM_ESP8266,
 | 
					    PLATFORM_ESP8266,
 | 
				
			||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
WAKEUP_PINS = {
 | 
					WAKEUP_PINS = {
 | 
				
			||||||
    VARIANT_ESP32: [
 | 
					    VARIANT_ESP32: [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@ from esphome import automation
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import esp32
 | 
					from esphome.components import esp32
 | 
				
			||||||
from esphome.components.const import CONF_REQUEST_HEADERS
 | 
					from esphome.components.const import CONF_REQUEST_HEADERS
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_ESP8266_DISABLE_SSL_SUPPORT,
 | 
					    CONF_ESP8266_DISABLE_SSL_SUPPORT,
 | 
				
			||||||
@@ -17,7 +18,7 @@ from esphome.const import (
 | 
				
			|||||||
    __version__,
 | 
					    __version__,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, Lambda
 | 
					from esphome.core import CORE, Lambda
 | 
				
			||||||
from esphome.helpers import IS_MACOS, filter_source_files_from_platform
 | 
					from esphome.helpers import IS_MACOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEPENDENCIES = ["network"]
 | 
					DEPENDENCIES = ["network"]
 | 
				
			||||||
AUTO_LOAD = ["json", "watchdog"]
 | 
					AUTO_LOAD = ["json", "watchdog"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ import logging
 | 
				
			|||||||
from esphome import pins
 | 
					from esphome import pins
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import esp32
 | 
					from esphome.components import esp32
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_ADDRESS,
 | 
					    CONF_ADDRESS,
 | 
				
			||||||
@@ -22,7 +23,6 @@ from esphome.const import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
import esphome.final_validate as fv
 | 
					import esphome.final_validate as fv
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
LOGGER = logging.getLogger(__name__)
 | 
					LOGGER = logging.getLogger(__name__)
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ import logging
 | 
				
			|||||||
from os.path import dirname, isfile, join
 | 
					from os.path import dirname, isfile, join
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_BOARD,
 | 
					    CONF_BOARD,
 | 
				
			||||||
@@ -24,7 +25,6 @@ from esphome.const import (
 | 
				
			|||||||
    __version__,
 | 
					    __version__,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE
 | 
					from esphome.core import CORE
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from . import gpio  # noqa
 | 
					from . import gpio  # noqa
 | 
				
			||||||
from .const import (
 | 
					from .const import (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ from esphome.components.libretiny.const import (
 | 
				
			|||||||
    COMPONENT_LN882X,
 | 
					    COMPONENT_LN882X,
 | 
				
			||||||
    COMPONENT_RTL87XX,
 | 
					    COMPONENT_RTL87XX,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_ARGS,
 | 
					    CONF_ARGS,
 | 
				
			||||||
@@ -45,7 +46,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, Lambda, coroutine_with_priority
 | 
					from esphome.core import CORE, Lambda, coroutine_with_priority
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
logger_ns = cg.esphome_ns.namespace("logger")
 | 
					logger_ns = cg.esphome_ns.namespace("logger")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components.esp32 import add_idf_component
 | 
					from esphome.components.esp32 import add_idf_component
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_DISABLED,
 | 
					    CONF_DISABLED,
 | 
				
			||||||
@@ -11,7 +12,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
DEPENDENCIES = ["network"]
 | 
					DEPENDENCIES = ["network"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ from esphome.automation import Condition
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import logger
 | 
					from esphome.components import logger
 | 
				
			||||||
from esphome.components.esp32 import add_idf_sdkconfig_option
 | 
					from esphome.components.esp32 import add_idf_sdkconfig_option
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_AVAILABILITY,
 | 
					    CONF_AVAILABILITY,
 | 
				
			||||||
@@ -57,7 +58,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEPENDENCIES = ["network"]
 | 
					DEPENDENCIES = ["network"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import uart
 | 
					from esphome.components import uart
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
from esphome.const import PlatformFramework
 | 
					from esphome.const import PlatformFramework
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
nextion_ns = cg.esphome_ns.namespace("nextion")
 | 
					nextion_ns = cg.esphome_ns.namespace("nextion")
 | 
				
			||||||
Nextion = nextion_ns.class_("Nextion", cg.PollingComponent, uart.UARTDevice)
 | 
					Nextion = nextion_ns.class_("Nextion", cg.PollingComponent, uart.UARTDevice)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
from esphome import automation
 | 
					from esphome import automation
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_ESPHOME,
 | 
					    CONF_ESPHOME,
 | 
				
			||||||
@@ -10,7 +11,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
AUTO_LOAD = ["md5", "safe_mode"]
 | 
					AUTO_LOAD = ["md5", "safe_mode"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
from esphome import pins
 | 
					from esphome import pins
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import esp32, esp32_rmt, remote_base
 | 
					from esphome.components import esp32, esp32_rmt, remote_base
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_BUFFER_SIZE,
 | 
					    CONF_BUFFER_SIZE,
 | 
				
			||||||
@@ -18,7 +19,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, TimePeriod
 | 
					from esphome.core import CORE, TimePeriod
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CONF_FILTER_SYMBOLS = "filter_symbols"
 | 
					CONF_FILTER_SYMBOLS = "filter_symbols"
 | 
				
			||||||
CONF_RECEIVE_SYMBOLS = "receive_symbols"
 | 
					CONF_RECEIVE_SYMBOLS = "receive_symbols"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
from esphome import automation, pins
 | 
					from esphome import automation, pins
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components import esp32, esp32_rmt, remote_base
 | 
					from esphome.components import esp32, esp32_rmt, remote_base
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_CARRIER_DUTY_PERCENT,
 | 
					    CONF_CARRIER_DUTY_PERCENT,
 | 
				
			||||||
@@ -15,7 +16,6 @@ from esphome.const import (
 | 
				
			|||||||
    PlatformFramework,
 | 
					    PlatformFramework,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE
 | 
					from esphome.core import CORE
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUTO_LOAD = ["remote_base"]
 | 
					AUTO_LOAD = ["remote_base"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ from esphome.components.esp32.const import (
 | 
				
			|||||||
    VARIANT_ESP32S2,
 | 
					    VARIANT_ESP32S2,
 | 
				
			||||||
    VARIANT_ESP32S3,
 | 
					    VARIANT_ESP32S3,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_CLK_PIN,
 | 
					    CONF_CLK_PIN,
 | 
				
			||||||
@@ -35,7 +36,6 @@ from esphome.const import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
import esphome.final_validate as fv
 | 
					import esphome.final_validate as fv
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core", "@clydebarrow"]
 | 
					CODEOWNERS = ["@esphome/core", "@clydebarrow"]
 | 
				
			||||||
spi_ns = cg.esphome_ns.namespace("spi")
 | 
					spi_ns = cg.esphome_ns.namespace("spi")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@ import re
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from esphome import automation, pins
 | 
					from esphome import automation, pins
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_AFTER,
 | 
					    CONF_AFTER,
 | 
				
			||||||
@@ -31,7 +32,6 @@ from esphome.const import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE
 | 
					from esphome.core import CORE
 | 
				
			||||||
import esphome.final_validate as fv
 | 
					import esphome.final_validate as fv
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
from esphome.yaml_util import make_data_base
 | 
					from esphome.yaml_util import make_data_base
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CODEOWNERS = ["@esphome/core"]
 | 
					CODEOWNERS = ["@esphome/core"]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ from esphome.automation import Condition
 | 
				
			|||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
from esphome.components.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant
 | 
					from esphome.components.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant
 | 
				
			||||||
from esphome.components.network import IPAddress
 | 
					from esphome.components.network import IPAddress
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_AP,
 | 
					    CONF_AP,
 | 
				
			||||||
@@ -43,7 +44,6 @@ from esphome.const import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
from esphome.core import CORE, HexInt, coroutine_with_priority
 | 
					from esphome.core import CORE, HexInt, coroutine_with_priority
 | 
				
			||||||
import esphome.final_validate as fv
 | 
					import esphome.final_validate as fv
 | 
				
			||||||
from esphome.helpers import filter_source_files_from_platform
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from . import wpa2_eap
 | 
					from . import wpa2_eap
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,13 @@
 | 
				
			|||||||
from esphome.const import CONF_ID
 | 
					from collections.abc import Callable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from esphome.const import (
 | 
				
			||||||
 | 
					    CONF_ID,
 | 
				
			||||||
 | 
					    KEY_CORE,
 | 
				
			||||||
 | 
					    KEY_TARGET_FRAMEWORK,
 | 
				
			||||||
 | 
					    KEY_TARGET_PLATFORM,
 | 
				
			||||||
 | 
					    PlatformFramework,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					from esphome.core import CORE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Extend:
 | 
					class Extend:
 | 
				
			||||||
@@ -103,3 +112,45 @@ def merge_config(full_old, full_new):
 | 
				
			|||||||
        return new
 | 
					        return new
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return merge(full_old, full_new)
 | 
					    return merge(full_old, full_new)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def filter_source_files_from_platform(
 | 
				
			||||||
 | 
					    files_map: dict[str, set[PlatformFramework]],
 | 
				
			||||||
 | 
					) -> Callable[[], list[str]]:
 | 
				
			||||||
 | 
					    """Helper to build a FILTER_SOURCE_FILES function from platform mapping.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Args:
 | 
				
			||||||
 | 
					        files_map: Dict mapping filename to set of PlatformFramework enums
 | 
				
			||||||
 | 
					                  that should compile this file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Returns:
 | 
				
			||||||
 | 
					        Function that returns list of files to exclude for current platform
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    # Pre-build lookup map from (platform, framework) tuples to PlatformFramework enum
 | 
				
			||||||
 | 
					    _PLATFORM_FRAMEWORK_LOOKUP = {pf.value: pf for pf in PlatformFramework}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def filter_source_files() -> list[str]:
 | 
				
			||||||
 | 
					        # Get current platform/framework
 | 
				
			||||||
 | 
					        core_data = CORE.data.get(KEY_CORE, {})
 | 
				
			||||||
 | 
					        target_platform = core_data.get(KEY_TARGET_PLATFORM)
 | 
				
			||||||
 | 
					        target_framework = core_data.get(KEY_TARGET_FRAMEWORK)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if not target_platform or not target_framework:
 | 
				
			||||||
 | 
					            return []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Direct lookup of current PlatformFramework
 | 
				
			||||||
 | 
					        current_platform_framework = _PLATFORM_FRAMEWORK_LOOKUP.get(
 | 
				
			||||||
 | 
					            (target_platform, target_framework)
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if not current_platform_framework:
 | 
				
			||||||
 | 
					            return []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Return files that should be excluded for current platform
 | 
				
			||||||
 | 
					        return [
 | 
				
			||||||
 | 
					            filename
 | 
				
			||||||
 | 
					            for filename, platforms in files_map.items()
 | 
				
			||||||
 | 
					            if current_platform_framework not in platforms
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return filter_source_files
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,7 @@ from pathlib import Path
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from esphome import automation, core
 | 
					from esphome import automation, core
 | 
				
			||||||
import esphome.codegen as cg
 | 
					import esphome.codegen as cg
 | 
				
			||||||
 | 
					from esphome.config_helpers import filter_source_files_from_platform
 | 
				
			||||||
import esphome.config_validation as cv
 | 
					import esphome.config_validation as cv
 | 
				
			||||||
from esphome.const import (
 | 
					from esphome.const import (
 | 
				
			||||||
    CONF_AREA,
 | 
					    CONF_AREA,
 | 
				
			||||||
@@ -41,7 +42,6 @@ from esphome.const import (
 | 
				
			|||||||
from esphome.core import CORE, coroutine_with_priority
 | 
					from esphome.core import CORE, coroutine_with_priority
 | 
				
			||||||
from esphome.helpers import (
 | 
					from esphome.helpers import (
 | 
				
			||||||
    copy_file_if_changed,
 | 
					    copy_file_if_changed,
 | 
				
			||||||
    filter_source_files_from_platform,
 | 
					 | 
				
			||||||
    fnv1a_32bit_hash,
 | 
					    fnv1a_32bit_hash,
 | 
				
			||||||
    get_str_env,
 | 
					    get_str_env,
 | 
				
			||||||
    walk_files,
 | 
					    walk_files,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
import codecs
 | 
					import codecs
 | 
				
			||||||
from collections.abc import Callable
 | 
					 | 
				
			||||||
from contextlib import suppress
 | 
					from contextlib import suppress
 | 
				
			||||||
import ipaddress
 | 
					import ipaddress
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
@@ -8,12 +7,8 @@ from pathlib import Path
 | 
				
			|||||||
import platform
 | 
					import platform
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
from typing import TYPE_CHECKING
 | 
					 | 
				
			||||||
from urllib.parse import urlparse
 | 
					from urllib.parse import urlparse
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if TYPE_CHECKING:
 | 
					 | 
				
			||||||
    from esphome.const import PlatformFramework
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
_LOGGER = logging.getLogger(__name__)
 | 
					_LOGGER = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IS_MACOS = platform.system() == "Darwin"
 | 
					IS_MACOS = platform.system() == "Darwin"
 | 
				
			||||||
@@ -510,54 +505,3 @@ _DISALLOWED_CHARS = re.compile(r"[^a-zA-Z0-9-_]")
 | 
				
			|||||||
def sanitize(value):
 | 
					def sanitize(value):
 | 
				
			||||||
    """Same behaviour as `helpers.cpp` method `str_sanitize`."""
 | 
					    """Same behaviour as `helpers.cpp` method `str_sanitize`."""
 | 
				
			||||||
    return _DISALLOWED_CHARS.sub("_", value)
 | 
					    return _DISALLOWED_CHARS.sub("_", value)
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def filter_source_files_from_platform(
 | 
					 | 
				
			||||||
    files_map: dict[str, set["PlatformFramework"]],
 | 
					 | 
				
			||||||
) -> Callable[[], list[str]]:
 | 
					 | 
				
			||||||
    """Helper to build a FILTER_SOURCE_FILES function from platform mapping.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Args:
 | 
					 | 
				
			||||||
        files_map: Dict mapping filename to set of PlatformFramework enums
 | 
					 | 
				
			||||||
                  that should compile this file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Returns:
 | 
					 | 
				
			||||||
        Function that returns list of files to exclude for current platform
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    # Import here to avoid circular imports
 | 
					 | 
				
			||||||
    from esphome.const import (
 | 
					 | 
				
			||||||
        KEY_CORE,
 | 
					 | 
				
			||||||
        KEY_TARGET_FRAMEWORK,
 | 
					 | 
				
			||||||
        KEY_TARGET_PLATFORM,
 | 
					 | 
				
			||||||
        PlatformFramework,
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    from esphome.core import CORE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Pre-build lookup map from (platform, framework) tuples to PlatformFramework enum
 | 
					 | 
				
			||||||
    _PLATFORM_FRAMEWORK_LOOKUP = {pf.value: pf for pf in PlatformFramework}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def filter_source_files() -> list[str]:
 | 
					 | 
				
			||||||
        # Get current platform/framework
 | 
					 | 
				
			||||||
        core_data = CORE.data.get(KEY_CORE, {})
 | 
					 | 
				
			||||||
        target_platform = core_data.get(KEY_TARGET_PLATFORM)
 | 
					 | 
				
			||||||
        target_framework = core_data.get(KEY_TARGET_FRAMEWORK)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if not target_platform or not target_framework:
 | 
					 | 
				
			||||||
            return []
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Direct lookup of current PlatformFramework
 | 
					 | 
				
			||||||
        current_platform_framework = _PLATFORM_FRAMEWORK_LOOKUP.get(
 | 
					 | 
				
			||||||
            (target_platform, target_framework)
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if not current_platform_framework:
 | 
					 | 
				
			||||||
            return []
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Return files that should be excluded for current platform
 | 
					 | 
				
			||||||
        return [
 | 
					 | 
				
			||||||
            filename
 | 
					 | 
				
			||||||
            for filename, platforms in files_map.items()
 | 
					 | 
				
			||||||
            if current_platform_framework not in platforms
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return filter_source_files
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user