mirror of
https://github.com/esphome/esphome.git
synced 2025-10-01 09:32:21 +01:00
[ethernet] Fix Ethernet RMII capable variant validation (#10909)
This commit is contained in:
committed by
GitHub
parent
55593628ef
commit
25fc16163b
@@ -145,13 +145,6 @@ def _validate(config):
|
|||||||
use_address = CORE.name + config[CONF_DOMAIN]
|
use_address = CORE.name + config[CONF_DOMAIN]
|
||||||
config[CONF_USE_ADDRESS] = use_address
|
config[CONF_USE_ADDRESS] = use_address
|
||||||
|
|
||||||
# Validate LAN8670 is only used with ESP32 classic or ESP32-P4
|
|
||||||
if config[CONF_TYPE] == "LAN8670":
|
|
||||||
variant = get_esp32_variant()
|
|
||||||
if variant not in (VARIANT_ESP32, VARIANT_ESP32P4):
|
|
||||||
raise cv.Invalid(
|
|
||||||
f"LAN8670 PHY is only supported on ESP32 classic and ESP32-P4, not {variant}"
|
|
||||||
)
|
|
||||||
if config[CONF_TYPE] in SPI_ETHERNET_TYPES:
|
if config[CONF_TYPE] in SPI_ETHERNET_TYPES:
|
||||||
if _is_framework_spi_polling_mode_supported():
|
if _is_framework_spi_polling_mode_supported():
|
||||||
if CONF_POLLING_INTERVAL in config and CONF_INTERRUPT_PIN in config:
|
if CONF_POLLING_INTERVAL in config and CONF_INTERRUPT_PIN in config:
|
||||||
@@ -184,6 +177,12 @@ def _validate(config):
|
|||||||
del config[CONF_CLK_MODE]
|
del config[CONF_CLK_MODE]
|
||||||
elif CONF_CLK not in config:
|
elif CONF_CLK not in config:
|
||||||
raise cv.Invalid("'clk' is a required option for [ethernet].")
|
raise cv.Invalid("'clk' is a required option for [ethernet].")
|
||||||
|
variant = get_esp32_variant()
|
||||||
|
if variant not in (VARIANT_ESP32, VARIANT_ESP32P4):
|
||||||
|
raise cv.Invalid(
|
||||||
|
f"{config[CONF_TYPE]} PHY requires RMII interface and is only supported "
|
||||||
|
f"on ESP32 classic and ESP32-P4, not {variant}"
|
||||||
|
)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user