Checks for pins used in multiple places (#5666)

This commit is contained in:
Clyde Stubbs 2023-12-05 10:56:53 +11:00 committed by GitHub
parent df5394d51c
commit d9792b0d92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1335 additions and 575 deletions

View file

@ -1,7 +1,7 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome import pins from esphome import pins
from esphome.const import CONF_ANALOG, CONF_INPUT from esphome.const import CONF_ANALOG, CONF_INPUT, CONF_NUMBER
from esphome.core import CORE from esphome.core import CORE
from esphome.components.esp32 import get_esp32_variant from esphome.components.esp32 import get_esp32_variant
@ -152,7 +152,8 @@ def validate_adc_pin(value):
return cv.only_on_rp2040("TEMPERATURE") return cv.only_on_rp2040("TEMPERATURE")
if CORE.is_esp32: if CORE.is_esp32:
value = pins.internal_gpio_input_pin_number(value) conf = pins.internal_gpio_input_pin_schema(value)
value = conf[CONF_NUMBER]
variant = get_esp32_variant() variant = get_esp32_variant()
if ( if (
variant not in ESP32_VARIANT_ADC1_PIN_TO_CHANNEL variant not in ESP32_VARIANT_ADC1_PIN_TO_CHANNEL
@ -166,24 +167,23 @@ def validate_adc_pin(value):
): ):
raise cv.Invalid(f"{variant} doesn't support ADC on this pin") raise cv.Invalid(f"{variant} doesn't support ADC on this pin")
return pins.internal_gpio_input_pin_schema(value) return conf
if CORE.is_esp8266: if CORE.is_esp8266:
value = pins.internal_gpio_pin_number({CONF_ANALOG: True, CONF_INPUT: True})( conf = pins.gpio_pin_schema(
value
)
if value != 17: # A0
raise cv.Invalid("ESP8266: Only pin A0 (GPIO17) supports ADC")
return pins.gpio_pin_schema(
{CONF_ANALOG: True, CONF_INPUT: True}, internal=True {CONF_ANALOG: True, CONF_INPUT: True}, internal=True
)(value) )(value)
if conf[CONF_NUMBER] != 17: # A0
raise cv.Invalid("ESP8266: Only pin A0 (GPIO17) supports ADC")
return conf
if CORE.is_rp2040: if CORE.is_rp2040:
value = pins.internal_gpio_input_pin_number(value) conf = pins.internal_gpio_input_pin_schema(value)
if value not in (26, 27, 28, 29): number = conf[CONF_NUMBER]
if number not in (26, 27, 28, 29):
raise cv.Invalid("RP2040: Only pins 26, 27, 28 and 29 support ADC") raise cv.Invalid("RP2040: Only pins 26, 27, 28 and 29 support ADC")
return pins.internal_gpio_input_pin_schema(value) return conf
if CORE.is_libretiny: if CORE.is_libretiny:
return pins.gpio_pin_schema( return pins.gpio_pin_schema(

View file

@ -3,15 +3,13 @@ from typing import Any
from esphome.const import ( from esphome.const import (
CONF_ID, CONF_ID,
CONF_INPUT,
CONF_INVERTED, CONF_INVERTED,
CONF_MODE, CONF_MODE,
CONF_NUMBER, CONF_NUMBER,
CONF_OPEN_DRAIN, CONF_OPEN_DRAIN,
CONF_OUTPUT, CONF_OUTPUT,
CONF_PULLDOWN,
CONF_PULLUP,
CONF_IGNORE_STRAPPING_WARNING, CONF_IGNORE_STRAPPING_WARNING,
PLATFORM_ESP32,
) )
from esphome import pins from esphome import pins
from esphome.core import CORE from esphome.core import CORE
@ -33,7 +31,6 @@ from .const import (
esp32_ns, esp32_ns,
) )
from .gpio_esp32 import esp32_validate_gpio_pin, esp32_validate_supports from .gpio_esp32 import esp32_validate_gpio_pin, esp32_validate_supports
from .gpio_esp32_s2 import esp32_s2_validate_gpio_pin, esp32_s2_validate_supports from .gpio_esp32_s2 import esp32_s2_validate_gpio_pin, esp32_s2_validate_supports
from .gpio_esp32_c3 import esp32_c3_validate_gpio_pin, esp32_c3_validate_supports from .gpio_esp32_c3 import esp32_c3_validate_gpio_pin, esp32_c3_validate_supports
@ -42,7 +39,6 @@ from .gpio_esp32_c2 import esp32_c2_validate_gpio_pin, esp32_c2_validate_support
from .gpio_esp32_c6 import esp32_c6_validate_gpio_pin, esp32_c6_validate_supports from .gpio_esp32_c6 import esp32_c6_validate_gpio_pin, esp32_c6_validate_supports
from .gpio_esp32_h2 import esp32_h2_validate_gpio_pin, esp32_h2_validate_supports from .gpio_esp32_h2 import esp32_h2_validate_gpio_pin, esp32_h2_validate_supports
ESP32InternalGPIOPin = esp32_ns.class_("ESP32InternalGPIOPin", cg.InternalGPIOPin) ESP32InternalGPIOPin = esp32_ns.class_("ESP32InternalGPIOPin", cg.InternalGPIOPin)
@ -161,33 +157,22 @@ DRIVE_STRENGTHS = {
} }
gpio_num_t = cg.global_ns.enum("gpio_num_t") gpio_num_t = cg.global_ns.enum("gpio_num_t")
CONF_DRIVE_STRENGTH = "drive_strength" CONF_DRIVE_STRENGTH = "drive_strength"
ESP32_PIN_SCHEMA = cv.All( ESP32_PIN_SCHEMA = cv.All(
{ pins.gpio_base_schema(ESP32InternalGPIOPin, validate_gpio_pin).extend(
cv.GenerateID(): cv.declare_id(ESP32InternalGPIOPin), {
cv.Required(CONF_NUMBER): validate_gpio_pin, cv.Optional(CONF_IGNORE_STRAPPING_WARNING, default=False): cv.boolean,
cv.Optional(CONF_MODE, default={}): cv.Schema( cv.Optional(CONF_DRIVE_STRENGTH, default="20mA"): cv.All(
{ cv.float_with_unit("current", "mA", optional_unit=True),
cv.Optional(CONF_INPUT, default=False): cv.boolean, cv.enum(DRIVE_STRENGTHS),
cv.Optional(CONF_OUTPUT, default=False): cv.boolean, ),
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean, }
cv.Optional(CONF_PULLUP, default=False): cv.boolean, ),
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
}
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
cv.Optional(CONF_IGNORE_STRAPPING_WARNING, default=False): cv.boolean,
cv.Optional(CONF_DRIVE_STRENGTH, default="20mA"): cv.All(
cv.float_with_unit("current", "mA", optional_unit=True),
cv.enum(DRIVE_STRENGTHS),
),
},
validate_supports, validate_supports,
) )
@pins.PIN_SCHEMA_REGISTRY.register("esp32", ESP32_PIN_SCHEMA) @pins.PIN_SCHEMA_REGISTRY.register(PLATFORM_ESP32, ESP32_PIN_SCHEMA)
async def esp32_pin_to_code(config): async def esp32_pin_to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
num = config[CONF_NUMBER] num = config[CONF_NUMBER]

View file

@ -12,6 +12,7 @@ from esphome.const import (
CONF_OUTPUT, CONF_OUTPUT,
CONF_PULLDOWN, CONF_PULLDOWN,
CONF_PULLUP, CONF_PULLUP,
PLATFORM_ESP8266,
) )
from esphome import pins from esphome import pins
from esphome.core import CORE, coroutine_with_priority from esphome.core import CORE, coroutine_with_priority
@ -21,10 +22,8 @@ import esphome.codegen as cg
from . import boards from . import boards
from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
ESP8266GPIOPin = esp8266_ns.class_("ESP8266GPIOPin", cg.InternalGPIOPin) ESP8266GPIOPin = esp8266_ns.class_("ESP8266GPIOPin", cg.InternalGPIOPin)
@ -124,6 +123,8 @@ def validate_supports(value):
(True, False, False, False, False), (True, False, False, False, False),
# OUTPUT # OUTPUT
(False, True, False, False, False), (False, True, False, False, False),
# INPUT and OUTPUT, e.g. for i2c
(True, True, False, False, False),
# INPUT_PULLUP # INPUT_PULLUP
(True, False, False, True, False), (True, False, False, True, False),
# INPUT_PULLDOWN_16 # INPUT_PULLDOWN_16
@ -142,21 +143,11 @@ def validate_supports(value):
ESP8266_PIN_SCHEMA = cv.All( ESP8266_PIN_SCHEMA = cv.All(
{ pins.gpio_base_schema(
cv.GenerateID(): cv.declare_id(ESP8266GPIOPin), ESP8266GPIOPin,
cv.Required(CONF_NUMBER): validate_gpio_pin, validate_gpio_pin,
cv.Optional(CONF_MODE, default={}): cv.Schema( modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
{ ),
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
}
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
},
validate_supports, validate_supports,
) )
@ -167,7 +158,7 @@ class PinInitialState:
level: int = 255 level: int = 255
@pins.PIN_SCHEMA_REGISTRY.register("esp8266", ESP8266_PIN_SCHEMA) @pins.PIN_SCHEMA_REGISTRY.register(PLATFORM_ESP8266, ESP8266_PIN_SCHEMA)
async def esp8266_pin_to_code(config): async def esp8266_pin_to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
num = config[CONF_NUMBER] num = config[CONF_NUMBER]

View file

@ -17,10 +17,8 @@ import esphome.codegen as cg
from .const import host_ns from .const import host_ns
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
HostGPIOPin = host_ns.class_("HostGPIOPin", cg.InternalGPIOPin) HostGPIOPin = host_ns.class_("HostGPIOPin", cg.InternalGPIOPin)
@ -45,21 +43,10 @@ def validate_gpio_pin(value):
return _translate_pin(value) return _translate_pin(value)
HOST_PIN_SCHEMA = cv.All( HOST_PIN_SCHEMA = pins.gpio_base_schema(
{ HostGPIOPin,
cv.GenerateID(): cv.declare_id(HostGPIOPin), validate_gpio_pin,
cv.Required(CONF_NUMBER): validate_gpio_pin, modes=[CONF_INPUT, CONF_OUTPUT, CONF_OPEN_DRAIN, CONF_PULLUP, CONF_PULLDOWN],
cv.Optional(CONF_MODE, default={}): cv.Schema(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
}
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
},
) )

View file

@ -39,9 +39,8 @@ def _bus_declare_type(value):
raise NotImplementedError raise NotImplementedError
pin_with_input_and_output_support = cv.All( pin_with_input_and_output_support = pins.internal_gpio_pin_number(
pins.internal_gpio_pin_number({CONF_INPUT: True}), {CONF_OUTPUT: True, CONF_INPUT: True}
pins.internal_gpio_pin_number({CONF_OUTPUT: True}),
) )

View file

@ -186,25 +186,11 @@ def validate_gpio_usage(value):
return value return value
BASE_PIN_SCHEMA = cv.Schema( BASE_PIN_SCHEMA = pins.gpio_base_schema(
{ ArduinoInternalGPIOPin,
cv.GenerateID(): cv.declare_id(ArduinoInternalGPIOPin), validate_gpio_pin,
cv.Required(CONF_NUMBER): validate_gpio_pin, modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
cv.Optional(CONF_MODE, default={}): cv.Schema( ).add_extra(validate_gpio_usage)
{
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
}
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
},
)
BASE_PIN_SCHEMA.add_extra(validate_gpio_usage)
async def component_pin_to_code(config): async def component_pin_to_code(config):

View file

@ -74,20 +74,14 @@ def validate_mode(value):
CONF_MAX6956 = "max6956" CONF_MAX6956 = "max6956"
MAX6956_PIN_SCHEMA = cv.All( MAX6956_PIN_SCHEMA = pins.gpio_base_schema(
MAX6956GPIOPin,
cv.int_range(min=4, max=31),
modes=[CONF_INPUT, CONF_PULLUP, CONF_OUTPUT],
mode_validator=validate_mode,
).extend(
{ {
cv.GenerateID(): cv.declare_id(MAX6956GPIOPin),
cv.Required(CONF_MAX6956): cv.use_id(MAX6956), cv.Required(CONF_MAX6956): cv.use_id(MAX6956),
cv.Required(CONF_NUMBER): cv.int_range(min=4, max=31),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
} }
) )

View file

@ -45,19 +45,15 @@ def validate_mode(value):
CONF_MCP23016 = "mcp23016" CONF_MCP23016 = "mcp23016"
MCP23016_PIN_SCHEMA = cv.All( MCP23016_PIN_SCHEMA = pins.gpio_base_schema(
MCP23016GPIOPin,
cv.int_range(min=0, max=15),
modes=[CONF_INPUT, CONF_OUTPUT],
mode_validator=validate_mode,
invertable=True,
).extend(
{ {
cv.GenerateID(): cv.declare_id(MCP23016GPIOPin),
cv.Required(CONF_MCP23016): cv.use_id(MCP23016), cv.Required(CONF_MCP23016): cv.use_id(MCP23016),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
} }
) )

View file

@ -54,20 +54,16 @@ def validate_mode(value):
CONF_MCP23XXX = "mcp23xxx" CONF_MCP23XXX = "mcp23xxx"
MCP23XXX_PIN_SCHEMA = cv.All(
MCP23XXX_PIN_SCHEMA = pins.gpio_base_schema(
MCP23XXXGPIOPin,
cv.int_range(min=0, max=15),
modes=[CONF_INPUT, CONF_OUTPUT, CONF_PULLUP],
mode_validator=validate_mode,
invertable=True,
).extend(
{ {
cv.GenerateID(): cv.declare_id(MCP23XXXGPIOPin),
cv.Required(CONF_MCP23XXX): cv.use_id(MCP23XXXBase), cv.Required(CONF_MCP23XXX): cv.use_id(MCP23XXXBase),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
cv.Optional(CONF_INTERRUPT, default="NO_INTERRUPT"): cv.enum( cv.Optional(CONF_INTERRUPT, default="NO_INTERRUPT"): cv.enum(
MCP23XXX_INTERRUPT_MODES, upper=True MCP23XXX_INTERRUPT_MODES, upper=True
), ),

View file

@ -52,20 +52,15 @@ def validate_mode(value):
return value return value
PCA9554_PIN_SCHEMA = cv.All( PCA9554_PIN_SCHEMA = pins.gpio_base_schema(
PCA9554GPIOPin,
cv.int_range(min=0, max=15),
modes=[CONF_INPUT, CONF_OUTPUT],
mode_validator=validate_mode,
).extend(
{ {
cv.GenerateID(): cv.declare_id(PCA9554GPIOPin),
cv.Required(CONF_PCA9554): cv.use_id(PCA9554Component), cv.Required(CONF_PCA9554): cv.use_id(PCA9554Component),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15), }
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
},
) )

View file

@ -48,19 +48,15 @@ def validate_mode(value):
return value return value
PCF8574_PIN_SCHEMA = cv.All( PCF8574_PIN_SCHEMA = pins.gpio_base_schema(
PCF8574GPIOPin,
cv.int_range(min=0, max=17),
modes=[CONF_INPUT, CONF_OUTPUT],
mode_validator=validate_mode,
invertable=True,
).extend(
{ {
cv.GenerateID(): cv.declare_id(PCF8574GPIOPin),
cv.Required(CONF_PCF8574): cv.use_id(PCF8574Component), cv.Required(CONF_PCF8574): cv.use_id(PCF8574Component),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=17),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
} }
) )

View file

@ -1,7 +1,6 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import ( from esphome.const import (
CONF_ANALOG,
CONF_ID, CONF_ID,
CONF_INPUT, CONF_INPUT,
CONF_INVERTED, CONF_INVERTED,
@ -11,6 +10,7 @@ from esphome.const import (
CONF_OUTPUT, CONF_OUTPUT,
CONF_PULLDOWN, CONF_PULLDOWN,
CONF_PULLUP, CONF_PULLUP,
CONF_ANALOG,
) )
from esphome.core import CORE from esphome.core import CORE
from esphome import pins from esphome import pins
@ -78,22 +78,10 @@ def validate_supports(value):
RP2040_PIN_SCHEMA = cv.All( RP2040_PIN_SCHEMA = cv.All(
cv.Schema( pins.gpio_base_schema(
{ RP2040GPIOPin,
cv.GenerateID(): cv.declare_id(RP2040GPIOPin), validate_gpio_pin,
cv.Required(CONF_NUMBER): validate_gpio_pin, modes=pins.GPIO_STANDARD_MODES + (CONF_ANALOG,),
cv.Optional(CONF_MODE, default={}): cv.Schema(
{
cv.Optional(CONF_ANALOG, default=False): cv.boolean,
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
cv.Optional(CONF_OPEN_DRAIN, default=False): cv.boolean,
cv.Optional(CONF_PULLUP, default=False): cv.boolean,
cv.Optional(CONF_PULLDOWN, default=False): cv.boolean,
}
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
}
), ),
validate_supports, validate_supports,
) )

View file

@ -5,7 +5,6 @@ from esphome.components import spi
from esphome.const import ( from esphome.const import (
CONF_ID, CONF_ID,
CONF_SPI_ID, CONF_SPI_ID,
CONF_MODE,
CONF_NUMBER, CONF_NUMBER,
CONF_INVERTED, CONF_INVERTED,
CONF_DATA_PIN, CONF_DATA_PIN,
@ -35,7 +34,6 @@ CONF_LATCH_PIN = "latch_pin"
CONF_OE_PIN = "oe_pin" CONF_OE_PIN = "oe_pin"
CONF_SR_COUNT = "sr_count" CONF_SR_COUNT = "sr_count"
CONFIG_SCHEMA = cv.Any( CONFIG_SCHEMA = cv.Any(
cv.Schema( cv.Schema(
{ {
@ -88,24 +86,20 @@ async def to_code(config):
def _validate_output_mode(value): def _validate_output_mode(value):
if value is not True: if value.get(CONF_OUTPUT) is not True:
raise cv.Invalid("Only output mode is supported") raise cv.Invalid("Only output mode is supported")
return value return value
SN74HC595_PIN_SCHEMA = cv.All( SN74HC595_PIN_SCHEMA = pins.gpio_base_schema(
SN74HC595GPIOPin,
cv.int_range(min=0, max=2047),
modes=[CONF_OUTPUT],
mode_validator=_validate_output_mode,
invertable=True,
).extend(
{ {
cv.GenerateID(): cv.declare_id(SN74HC595GPIOPin),
cv.Required(CONF_SN74HC595): cv.use_id(SN74HC595Component), cv.Required(CONF_SN74HC595): cv.use_id(SN74HC595Component),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=2048, max_included=False),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_OUTPUT, default=True): cv.All(
cv.boolean, _validate_output_mode
),
},
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
} }
) )

View file

@ -7,6 +7,7 @@ import re
from typing import Optional, Union from typing import Optional, Union
from contextlib import contextmanager from contextlib import contextmanager
import contextvars
import voluptuous as vol import voluptuous as vol
@ -53,6 +54,7 @@ def iter_components(config):
ConfigPath = list[Union[str, int]] ConfigPath = list[Union[str, int]]
path_context = contextvars.ContextVar("Config path")
def _path_begins_with(path: ConfigPath, other: ConfigPath) -> bool: def _path_begins_with(path: ConfigPath, other: ConfigPath) -> bool:
@ -489,6 +491,7 @@ class SchemaValidationStep(ConfigValidationStep):
def run(self, result: Config) -> None: def run(self, result: Config) -> None:
if self.comp.config_schema is None: if self.comp.config_schema is None:
return return
token = path_context.set(self.path)
with result.catch_error(self.path): with result.catch_error(self.path):
if self.comp.is_platform: if self.comp.is_platform:
# Remove 'platform' key for validation # Remove 'platform' key for validation
@ -507,6 +510,7 @@ class SchemaValidationStep(ConfigValidationStep):
validated = schema(self.conf) validated = schema(self.conf)
result.set_by_path(self.path, validated) result.set_by_path(self.path, validated)
path_context.reset(token)
result.add_validation_step(FinalValidateValidationStep(self.path, self.comp)) result.add_validation_step(FinalValidateValidationStep(self.path, self.comp))
@ -652,37 +656,24 @@ class FinalValidateValidationStep(ConfigValidationStep):
if self.comp.final_validate_schema is not None: if self.comp.final_validate_schema is not None:
self.comp.final_validate_schema(conf) self.comp.final_validate_schema(conf)
fconf = fv.full_config.get()
def _check_pins(c):
for value in c.values():
if not isinstance(value, dict):
continue
for key, (
_,
_,
pin_final_validate,
) in pins.PIN_SCHEMA_REGISTRY.items():
if (
key != CORE.target_platform
and key in value
and pin_final_validate is not None
):
pin_final_validate(fconf, value)
# Check for pin configs and a final_validate schema in the pin registry
confs = conf
if not isinstance(
confs, list
): # Handle components like SPI that have a list instead of MULTI_CONF
confs = [conf]
for c in confs:
if c: # Some component have None or empty schemas
_check_pins(c)
fv.full_config.reset(token) fv.full_config.reset(token)
class PinUseValidationCheck(ConfigValidationStep):
"""Check for pin reuse"""
priority = -30 # Should happen after component final validations
def __init__(self) -> None:
pass
def run(self, result: Config) -> None:
if result.errors:
# If result already has errors, skip this step
return
pins.PIN_SCHEMA_REGISTRY.final_validate(result)
def validate_config(config, command_line_substitutions) -> Config: def validate_config(config, command_line_substitutions) -> Config:
result = Config() result = Config()
@ -778,6 +769,7 @@ def validate_config(config, command_line_substitutions) -> Config:
for domain, conf in config.items(): for domain, conf in config.items():
result.add_validation_step(LoadValidationStep(domain, conf)) result.add_validation_step(LoadValidationStep(domain, conf))
result.add_validation_step(IDPassValidationStep()) result.add_validation_step(IDPassValidationStep())
result.add_validation_step(PinUseValidationCheck())
result.run_validation_steps() result.run_validation_steps()

View file

@ -46,6 +46,7 @@ CONF_ADDRESS = "address"
CONF_ADDRESSABLE_LIGHT_ID = "addressable_light_id" CONF_ADDRESSABLE_LIGHT_ID = "addressable_light_id"
CONF_ADVANCED = "advanced" CONF_ADVANCED = "advanced"
CONF_AFTER = "after" CONF_AFTER = "after"
CONF_ALLOW_OTHER_USES = "allow_other_uses"
CONF_ALPHA = "alpha" CONF_ALPHA = "alpha"
CONF_ALTITUDE = "altitude" CONF_ALTITUDE = "altitude"
CONF_ANALOG = "analog" CONF_ANALOG = "analog"

View file

@ -526,6 +526,8 @@ class EsphomeCore:
self.quiet = False self.quiet = False
def reset(self): def reset(self):
from esphome.pins import PIN_SCHEMA_REGISTRY
self.dashboard = False self.dashboard = False
self.name = None self.name = None
self.friendly_name = None self.friendly_name = None
@ -545,6 +547,7 @@ class EsphomeCore:
self.platformio_options = {} self.platformio_options = {}
self.loaded_integrations = set() self.loaded_integrations = set()
self.component_ids = set() self.component_ids = set()
PIN_SCHEMA_REGISTRY.reset()
@property @property
def address(self) -> Optional[str]: def address(self) -> Optional[str]:

View file

@ -1,5 +1,7 @@
import operator import operator
from functools import reduce from functools import reduce
import esphome.config_validation as cv
from esphome.core import CORE, ID
from esphome.const import ( from esphome.const import (
CONF_INPUT, CONF_INPUT,
@ -10,16 +12,120 @@ from esphome.const import (
CONF_PULLDOWN, CONF_PULLDOWN,
CONF_PULLUP, CONF_PULLUP,
CONF_IGNORE_STRAPPING_WARNING, CONF_IGNORE_STRAPPING_WARNING,
CONF_ALLOW_OTHER_USES,
CONF_INVERTED,
) )
from esphome.util import PinRegistry
from esphome.core import CORE
class PinRegistry(dict):
def __init__(self):
super().__init__()
self.pins_used = {}
def reset(self):
self.pins_used = {}
def get_count(self, key, number):
"""
Get the number of places a given pin is used.
:param key: The ID of the defining component
:param number: The pin number
:return: The number of places the pin is used.
"""
pin_key = (key, number)
return self.pins_used[pin_key] if pin_key in self.pins_used else 0
def register(self, name, schema, final_validate=None):
"""
Register a pin schema
:param name:
:param schema:
:param final_validate:
:return:
"""
def decorator(fun):
self[name] = (fun, schema, final_validate)
return fun
return decorator
def validate(self, conf, key=None):
"""
Validate a pin against a registered schema
:param conf The pin config
:param key: an optional scalar key (e.g. platform)
:return: The transformed result
"""
from esphome.config import path_context
key = self.get_key(conf) if key is None else key
# Element 1 is the pin validation function
# evaluate here so a validation failure skips the rest
result = self[key][1](conf)
if CONF_NUMBER in result:
# key maps to the pin schema
if isinstance(key, ID):
key = key.id
pin_key = (key, result[CONF_NUMBER])
if pin_key not in self.pins_used:
self.pins_used[pin_key] = []
# client_id identifies the instance of the providing component
client_id = result.get(key)
self.pins_used[pin_key].append((path_context.get(), client_id, result))
# return the validated pin config
return result
def get_key(self, conf):
"""
Is there a key in conf corresponding to a registered pin schema?
If not, fall back to the default platform schema.
:param conf The config for the component
:return: the schema key
"""
keys = list(filter(lambda k: k in conf, self))
return keys[0] if keys else CORE.target_platform
def get_to_code(self, key):
"""
Return the code generator function for a pin schema, stored as tuple element 0
:param conf: The pin config
:param key An optional specific key
:return: The awaitable coroutine
"""
key = self.get_key(key) if isinstance(key, dict) else key
return self[key][0]
def final_validate(self, fconf):
"""
Run the final validation for all pins, and check for reuse
:param fconf: The full config
"""
for (key, _), pin_list in self.pins_used.items():
count = len(pin_list) # number of places same pin used.
final_val_fun = self[key][2] # final validation function
for pin_path, client_id, pin_config in pin_list:
with fconf.catch_error([cv.ROOT_CONFIG_PATH] + pin_path):
if final_val_fun is not None:
# Get the containing path of the config providing this pin.
parent_path = fconf.get_path_for_id(client_id)[:-1]
parent_config = fconf.get_config_for_path(parent_path)
final_val_fun(pin_config, parent_config)
allow_others = pin_config.get(CONF_ALLOW_OTHER_USES, False)
if count != 1 and not allow_others:
raise cv.Invalid(
f"Pin {pin_config[CONF_NUMBER]} is used in multiple places"
)
if count == 1 and allow_others:
raise cv.Invalid(
f"Pin {pin_config[CONF_NUMBER]} incorrectly sets {CONF_ALLOW_OTHER_USES}: true"
)
PIN_SCHEMA_REGISTRY = PinRegistry() PIN_SCHEMA_REGISTRY = PinRegistry()
def _set_mode(value, default_mode): def _set_mode(value, default_mode):
import esphome.config_validation as cv
if CONF_MODE not in value: if CONF_MODE not in value:
return {**value, CONF_MODE: default_mode} return {**value, CONF_MODE: default_mode}
mode = value[CONF_MODE] mode = value[CONF_MODE]
@ -65,20 +171,26 @@ def _schema_creator(default_mode, internal: bool = False):
if not isinstance(value, dict): if not isinstance(value, dict):
return validator({CONF_NUMBER: value}) return validator({CONF_NUMBER: value})
value = _set_mode(value, default_mode) value = _set_mode(value, default_mode)
if not internal: if internal:
for key, entry in PIN_SCHEMA_REGISTRY.items(): return PIN_SCHEMA_REGISTRY.validate(value, CORE.target_platform)
if key != CORE.target_platform and key in value: return PIN_SCHEMA_REGISTRY.validate(value)
return entry[1](value)
return PIN_SCHEMA_REGISTRY[CORE.target_platform][1](value)
return validator return validator
def _internal_number_creator(mode): def _internal_number_creator(mode):
def validator(value): def validator(value):
value_d = {CONF_NUMBER: value} if isinstance(value, dict):
if CONF_MODE in value or CONF_INVERTED in value:
raise cv.Invalid(
"This variable only supports pin numbers, not full pin schemas "
"(with inverted and mode)."
)
value_d = value
else:
value_d = {CONF_NUMBER: value}
value_d = _set_mode(value_d, mode) value_d = _set_mode(value_d, mode)
return PIN_SCHEMA_REGISTRY[CORE.target_platform][1](value_d)[CONF_NUMBER] return PIN_SCHEMA_REGISTRY.validate(value_d, CORE.target_platform)[CONF_NUMBER]
return validator return validator
@ -149,8 +261,6 @@ internal_gpio_input_pullup_pin_number = _internal_number_creator(
def check_strapping_pin(conf, strapping_pin_list, logger): def check_strapping_pin(conf, strapping_pin_list, logger):
import esphome.config_validation as cv
num = conf[CONF_NUMBER] num = conf[CONF_NUMBER]
if num in strapping_pin_list and not conf.get(CONF_IGNORE_STRAPPING_WARNING): if num in strapping_pin_list and not conf.get(CONF_IGNORE_STRAPPING_WARNING):
logger.warning( logger.warning(
@ -161,3 +271,52 @@ def check_strapping_pin(conf, strapping_pin_list, logger):
# mitigate undisciplined use of strapping: # mitigate undisciplined use of strapping:
if num not in strapping_pin_list and conf.get(CONF_IGNORE_STRAPPING_WARNING): if num not in strapping_pin_list and conf.get(CONF_IGNORE_STRAPPING_WARNING):
raise cv.Invalid(f"GPIO{num} is not a strapping pin") raise cv.Invalid(f"GPIO{num} is not a strapping pin")
GPIO_STANDARD_MODES = (
CONF_INPUT,
CONF_OUTPUT,
CONF_OPEN_DRAIN,
CONF_PULLUP,
CONF_PULLDOWN,
)
def gpio_validate_modes(value):
if not value[CONF_INPUT] and not value[CONF_OUTPUT]:
raise cv.Invalid("Mode must be input or output")
return value
def gpio_base_schema(
pin_type,
number_validator,
modes=GPIO_STANDARD_MODES,
mode_validator=gpio_validate_modes,
invertable=True,
):
"""
Generate a base gpio pin schema
:param pin_type: The type for the pin variable
:param number_validator: A validator for the pin number
:param modes: The available modes, default is all standard modes
:param mode_validator: A validator function for the pin mode
:param invertable: If the pin supports hardware inversion
:return: A schema for the pin
"""
mode_default = len(modes) == 1
mode_dict = dict(
map(lambda m: (cv.Optional(m, default=mode_default), cv.boolean), modes)
)
schema = cv.Schema(
{
cv.GenerateID(): cv.declare_id(pin_type),
cv.Required(CONF_NUMBER): number_validator,
cv.Optional(CONF_ALLOW_OTHER_USES): cv.boolean,
cv.Optional(CONF_MODE, default={}): cv.All(mode_dict, mode_validator),
}
)
if invertable:
return schema.extend({cv.Optional(CONF_INVERTED, default=False): cv.boolean})
return schema

View file

@ -57,32 +57,6 @@ class SimpleRegistry(dict):
return decorator return decorator
def _final_validate(parent_id_key, fun):
def validator(fconf, pin_config):
import esphome.config_validation as cv
parent_path = fconf.get_path_for_id(pin_config[parent_id_key])[:-1]
parent_config = fconf.get_config_for_path(parent_path)
pin_path = fconf.get_path_for_id(pin_config[const.CONF_ID])[:-1]
with cv.prepend_path([cv.ROOT_CONFIG_PATH] + pin_path):
fun(pin_config, parent_config)
return validator
class PinRegistry(dict):
def register(self, name, schema, final_validate=None):
if final_validate is not None:
final_validate = _final_validate(name, final_validate)
def decorator(fun):
self[name] = (fun, schema, final_validate)
return fun
return decorator
def safe_print(message="", end="\n"): def safe_print(message="", end="\n"):
from esphome.core import CORE from esphome.core import CORE

View file

@ -54,7 +54,9 @@ power_supply:
i2c: i2c:
sda: 21 sda: 21
scl: 22 scl:
number: 22
allow_other_uses: true
scan: true scan: true
frequency: 100kHz frequency: 100kHz
setup_priority: -100 setup_priority: -100
@ -86,7 +88,9 @@ light:
- platform: fastled_clockless - platform: fastled_clockless
id: addr1 id: addr1
chipset: WS2811 chipset: WS2811
pin: GPIO23 pin:
allow_other_uses: true
number: GPIO23
num_leds: 60 num_leds: 60
rgb_order: BRG rgb_order: BRG
max_refresh_rate: 20ms max_refresh_rate: 20ms
@ -168,8 +172,12 @@ light:
- platform: fastled_spi - platform: fastled_spi
id: addr2 id: addr2
chipset: WS2801 chipset: WS2801
data_pin: GPIO23 data_pin:
clock_pin: GPIO22 allow_other_uses: true
number: GPIO23
clock_pin:
number: GPIO22
allow_other_uses: true
data_rate: 2MHz data_rate: 2MHz
num_leds: 60 num_leds: 60
rgb_order: BRG rgb_order: BRG
@ -190,7 +198,9 @@ light:
variant: SK6812 variant: SK6812
method: ESP32_I2S_0 method: ESP32_I2S_0
num_leds: 60 num_leds: 60
pin: GPIO23 pin:
allow_other_uses: true
number: GPIO23
- platform: partition - platform: partition
name: Partition Light name: Partition Light
segments: segments:

View file

@ -181,8 +181,12 @@ mqtt:
- light.turn_off: ${roomname}_lights - light.turn_off: ${roomname}_lights
i2c: i2c:
sda: 21 sda:
scl: 22 allow_other_uses: true
number: 21
scl:
allow_other_uses: true
number: 22
scan: true scan: true
frequency: 100kHz frequency: 100kHz
setup_priority: -100 setup_priority: -100
@ -190,15 +194,23 @@ i2c:
spi: spi:
id: spi_bus id: spi_bus
clk_pin: GPIO21 clk_pin:
mosi_pin: GPIO22 allow_other_uses: true
miso_pin: GPIO23 number: GPIO21
mosi_pin:
allow_other_uses: true
number: GPIO22
miso_pin:
allow_other_uses: true
number: GPIO23
uart: uart:
- tx_pin: - tx_pin:
allow_other_uses: true
number: GPIO22 number: GPIO22
inverted: true inverted: true
rx_pin: rx_pin:
allow_other_uses: true
number: GPIO23 number: GPIO23
inverted: true inverted: true
baud_rate: 115200 baud_rate: 115200
@ -220,18 +232,30 @@ uart:
- lambda: UARTDebug::log_int(direction, bytes, ','); - lambda: UARTDebug::log_int(direction, bytes, ',');
- lambda: UARTDebug::log_binary(direction, bytes, ';'); - lambda: UARTDebug::log_binary(direction, bytes, ';');
- id: ld2410_uart - id: ld2410_uart
tx_pin: 18 tx_pin:
rx_pin: 23 allow_other_uses: true
number: 18
rx_pin:
allow_other_uses: true
number: 23
baud_rate: 256000 baud_rate: 256000
parity: NONE parity: NONE
stop_bits: 1 stop_bits: 1
- id: dfrobot_mmwave_uart - id: dfrobot_mmwave_uart
tx_pin: 14 tx_pin:
rx_pin: 27 allow_other_uses: true
number: 14
rx_pin:
allow_other_uses: true
number: 27
baud_rate: 115200 baud_rate: 115200
- id: ld2420_uart - id: ld2420_uart
tx_pin: 17 tx_pin:
rx_pin: 16 allow_other_uses: true
number: 17
rx_pin:
allow_other_uses: true
number: 16
baud_rate: 115200 baud_rate: 115200
parity: NONE parity: NONE
stop_bits: 1 stop_bits: 1
@ -282,12 +306,16 @@ power_supply:
keep_on_time: 10s keep_on_time: 10s
pin: pin:
number: 13 number: 13
allow_other_uses: true
inverted: true inverted: true
deep_sleep: deep_sleep:
run_duration: 20s run_duration: 20s
sleep_duration: 50s sleep_duration: 50s
wakeup_pin: GPIO2 wakeup_pin:
allow_other_uses: true
number: GPIO2
ignore_strapping_warning: true
wakeup_pin_mode: INVERT_WAKEUP wakeup_pin_mode: INVERT_WAKEUP
ads1115: ads1115:
@ -295,11 +323,18 @@ ads1115:
i2c_id: i2c_bus i2c_id: i2c_bus
dallas: dallas:
pin: GPIO23 pin:
allow_other_uses: true
number: GPIO23
as3935_spi: as3935_spi:
cs_pin: GPIO12 cs_pin:
irq_pin: GPIO13 ignore_strapping_warning: true
allow_other_uses: true
number: GPIO12
irq_pin:
allow_other_uses: true
number: GPIO13
esp32_ble: esp32_ble:
io_capability: keyboard_only io_capability: keyboard_only
@ -339,16 +374,24 @@ bedjet:
time_id: sntp_time time_id: sntp_time
mcp23s08: mcp23s08:
- id: mcp23s08_hub - id: mcp23s08_hub
cs_pin: GPIO12 cs_pin:
ignore_strapping_warning: true
number: GPIO12
allow_other_uses: true
deviceaddress: 0 deviceaddress: 0
mcp23s17: mcp23s17:
- id: mcp23s17_hub - id: mcp23s17_hub
cs_pin: GPIO12 cs_pin:
ignore_strapping_warning: true
number: GPIO12
allow_other_uses: true
deviceaddress: 1 deviceaddress: 1
micronova: micronova:
enable_rx_pin: 4 enable_rx_pin:
allow_other_uses: true
number: 4
uart_id: uart_0 uart_id: uart_0
dfrobot_sen0395: dfrobot_sen0395:
@ -539,7 +582,9 @@ sensor:
name: NIR name: NIR
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: atm90e26 - platform: atm90e26
cs_pin: 5 cs_pin:
allow_other_uses: true
number: 5
voltage: voltage:
name: Line Voltage name: Line Voltage
current: current:
@ -558,7 +603,9 @@ sensor:
gain_voltage: 26400 gain_voltage: 26400
gain_ct: 31251 gain_ct: 31251
- platform: atm90e32 - platform: atm90e32
cs_pin: 5 cs_pin:
allow_other_uses: true
number: 5
phase_a: phase_a:
voltage: voltage:
name: EMON Line Voltage A name: EMON Line Voltage A
@ -675,7 +722,9 @@ sensor:
index: 1 index: 1
name: Living Room Temperature 2 name: Living Room Temperature 2
- platform: dht - platform: dht
pin: GPIO26 pin:
allow_other_uses: true
number: GPIO26
temperature: temperature:
id: dht_temperature id: dht_temperature
name: Living Room Temperature 3 name: Living Room Temperature 3
@ -692,7 +741,9 @@ sensor:
update_interval: 15s update_interval: 15s
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: duty_cycle - platform: duty_cycle
pin: GPIO25 pin:
allow_other_uses: true
number: GPIO25
name: Duty Cycle Sensor name: Duty Cycle Sensor
- platform: ee895 - platform: ee895
co2: co2:
@ -721,9 +772,15 @@ sensor:
update_interval: 15s update_interval: 15s
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: hlw8012 - platform: hlw8012
sel_pin: 5 sel_pin:
cf_pin: 14 allow_other_uses: true
cf1_pin: 13 number: 5
cf_pin:
allow_other_uses: true
number: 14
cf1_pin:
allow_other_uses: true
number: 13
current: current:
name: HLW8012 Current name: HLW8012 Current
voltage: voltage:
@ -772,7 +829,9 @@ sensor:
max_pressure: 15 max_pressure: 15
temperature: temperature:
name: Honeywell temperature name: Honeywell temperature
cs_pin: GPIO5 cs_pin:
allow_other_uses: true
number: GPIO5
- platform: honeywellabp2_i2c - platform: honeywellabp2_i2c
pressure: pressure:
name: Honeywell2 pressure name: Honeywell2 pressure
@ -806,8 +865,12 @@ sensor:
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: hx711 - platform: hx711
name: HX711 Value name: HX711 Value
dout_pin: GPIO23 dout_pin:
clk_pin: GPIO25 allow_other_uses: true
number: GPIO23
clk_pin:
allow_other_uses: true
number: GPIO25
gain: 128 gain: 128
update_interval: 15s update_interval: 15s
- platform: ina219 - platform: ina219
@ -880,22 +943,30 @@ sensor:
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: max6675 - platform: max6675
name: Living Room Temperature name: Living Room Temperature
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
update_interval: 15s update_interval: 15s
- platform: max31855 - platform: max31855
name: Den Temperature name: Den Temperature
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
update_interval: 15s update_interval: 15s
reference_temperature: reference_temperature:
name: MAX31855 Internal Temperature name: MAX31855 Internal Temperature
- platform: max31856 - platform: max31856
name: BBQ Temperature name: BBQ Temperature
cs_pin: GPIO17 cs_pin:
allow_other_uses: true
number: GPIO17
update_interval: 15s update_interval: 15s
mains_filter: 50Hz mains_filter: 50Hz
- platform: max31865 - platform: max31865
name: Water Tank Temperature name: Water Tank Temperature
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
update_interval: 15s update_interval: 15s
reference_resistance: 430 Ω reference_resistance: 430 Ω
rtd_nominal_resistance: 100 Ω rtd_nominal_resistance: 100 Ω
@ -1007,7 +1078,10 @@ sensor:
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: pulse_counter - platform: pulse_counter
name: Pulse Counter name: Pulse Counter
pin: GPIO12 pin:
ignore_strapping_warning: true
number: GPIO12
allow_other_uses: true
count_mode: count_mode:
rising_edge: INCREMENT rising_edge: INCREMENT
falling_edge: DECREMENT falling_edge: DECREMENT
@ -1016,7 +1090,10 @@ sensor:
- platform: pulse_meter - platform: pulse_meter
name: Pulse Meter name: Pulse Meter
id: pulse_meter_sensor id: pulse_meter_sensor
pin: GPIO12 pin:
ignore_strapping_warning: true
number: GPIO12
allow_other_uses: true
internal_filter: 100ms internal_filter: 100ms
timeout: 2 min timeout: 2 min
on_value: on_value:
@ -1039,9 +1116,15 @@ sensor:
- platform: rotary_encoder - platform: rotary_encoder
name: Rotary Encoder name: Rotary Encoder
id: rotary_encoder1 id: rotary_encoder1
pin_a: GPIO23 pin_a:
pin_b: GPIO25 allow_other_uses: true
pin_reset: GPIO25 number: GPIO23
pin_b:
allow_other_uses: true
number: GPIO25
pin_reset:
allow_other_uses: true
number: GPIO25
filters: filters:
- or: - or:
- debounce: 0.1s - debounce: 0.1s
@ -1064,7 +1147,9 @@ sensor:
- display_menu.up: - display_menu.up:
- platform: pulse_width - platform: pulse_width
name: Pulse Width name: Pulse Width
pin: GPIO12 pin:
allow_other_uses: true
number: GPIO12
- platform: sm300d2 - platform: sm300d2
uart_id: uart_0 uart_id: uart_0
co2: co2:
@ -1247,9 +1332,12 @@ sensor:
address: 0x48 address: 0x48
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: ultrasonic - platform: ultrasonic
trigger_pin: GPIO25 trigger_pin:
allow_other_uses: true
number: GPIO25
echo_pin: echo_pin:
number: GPIO23 number: GPIO23
allow_other_uses: true
inverted: true inverted: true
name: Ultrasonic Sensor name: Ultrasonic Sensor
timeout: 5.5m timeout: 5.5m
@ -1296,9 +1384,14 @@ sensor:
pin: pin:
number: GPIO04 number: GPIO04
mode: INPUT mode: INPUT
allow_other_uses: true
- platform: zyaura - platform: zyaura
clock_pin: GPIO5 clock_pin:
data_pin: GPIO4 allow_other_uses: true
number: GPIO5
data_pin:
allow_other_uses: true
number: GPIO4
co2: co2:
name: ZyAura CO2 name: ZyAura CO2
temperature: temperature:
@ -1572,6 +1665,7 @@ binary_sensor:
mcp23xxx: mcp23s08_hub mcp23xxx: mcp23s08_hub
# Use pin number 1 # Use pin number 1
number: 1 number: 1
allow_other_uses: true
# One of INPUT or INPUT_PULLUP # One of INPUT or INPUT_PULLUP
mode: INPUT_PULLUP mode: INPUT_PULLUP
inverted: false inverted: false
@ -1581,6 +1675,7 @@ binary_sensor:
mcp23xxx: mcp23s17_hub mcp23xxx: mcp23s17_hub
# Use pin number 1 # Use pin number 1
number: 1 number: 1
allow_other_uses: true
# One of INPUT or INPUT_PULLUP # One of INPUT or INPUT_PULLUP
mode: INPUT_PULLUP mode: INPUT_PULLUP
inverted: false inverted: false
@ -1589,13 +1684,16 @@ binary_sensor:
pin: pin:
mcp23xxx: mcp23s17_hub mcp23xxx: mcp23s17_hub
# Use pin number 1 # Use pin number 1
allow_other_uses: true
number: 1 number: 1
# One of INPUT or INPUT_PULLUP # One of INPUT or INPUT_PULLUP
mode: INPUT_PULLUP mode: INPUT_PULLUP
inverted: false inverted: false
interrupt: FALLING interrupt: FALLING
- platform: gpio - platform: gpio
pin: GPIO9 pin:
allow_other_uses: true
number: GPIO9
name: Living Room Window name: Living Room Window
device_class: window device_class: window
filters: filters:
@ -1664,11 +1762,13 @@ binary_sensor:
- platform: gpio - platform: gpio
pin: pin:
number: GPIO9 number: GPIO9
allow_other_uses: true
mode: INPUT_PULLUP mode: INPUT_PULLUP
name: Living Room Window 2 name: Living Room Window 2
- platform: gpio - platform: gpio
pin: pin:
number: GPIO9 number: GPIO9
allow_other_uses: true
mode: INPUT_OUTPUT_OPEN_DRAIN mode: INPUT_OUTPUT_OPEN_DRAIN
name: Living Room Button name: Living Room Button
- platform: status - platform: status
@ -1747,6 +1847,7 @@ binary_sensor:
pin: pin:
mcp23xxx: mcp23017_hub mcp23xxx: mcp23017_hub
number: 1 number: 1
allow_other_uses: true
mode: INPUT mode: INPUT
inverted: true inverted: true
- platform: gpio - platform: gpio
@ -1767,6 +1868,7 @@ binary_sensor:
name: Speed Fan Cycle binary sensor" name: Speed Fan Cycle binary sensor"
pin: pin:
number: 18 number: 18
allow_other_uses: true
mode: mode:
input: true input: true
pulldown: true pulldown: true
@ -1891,42 +1993,66 @@ tlc59208f:
i2c_id: i2c_bus i2c_id: i2c_bus
my9231: my9231:
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 allow_other_uses: true
number: GPIO12
clock_pin:
allow_other_uses: true
number: GPIO14
num_channels: 6 num_channels: 6
num_chips: 2 num_chips: 2
bit_depth: 16 bit_depth: 16
sm2235: sm2235:
data_pin: GPIO4 data_pin:
clock_pin: GPIO5 allow_other_uses: true
number: GPIO4
clock_pin:
allow_other_uses: true
number: GPIO5
max_power_color_channels: 9 max_power_color_channels: 9
max_power_white_channels: 9 max_power_white_channels: 9
sm2335: sm2335:
data_pin: GPIO4 data_pin:
clock_pin: GPIO5 allow_other_uses: true
number: GPIO4
clock_pin:
allow_other_uses: true
number: GPIO5
max_power_color_channels: 9 max_power_color_channels: 9
max_power_white_channels: 9 max_power_white_channels: 9
bp1658cj: bp1658cj:
data_pin: GPIO3 data_pin:
clock_pin: GPIO5 allow_other_uses: true
number: GPIO3
clock_pin:
allow_other_uses: true
number: GPIO5
max_power_color_channels: 4 max_power_color_channels: 4
max_power_white_channels: 6 max_power_white_channels: 6
bp5758d: bp5758d:
data_pin: GPIO3 data_pin:
clock_pin: GPIO5 allow_other_uses: true
number: GPIO3
clock_pin:
allow_other_uses: true
number: GPIO5
output: output:
- platform: gpio - platform: gpio
pin: GPIO26 pin:
allow_other_uses: true
number: GPIO26
id: gpio_26 id: gpio_26
power_supply: atx_power_supply power_supply: atx_power_supply
inverted: false inverted: false
- platform: ledc - platform: ledc
pin: 19 pin:
allow_other_uses: true
number: 19
id: gpio_19 id: gpio_19
frequency: 1500Hz frequency: 1500Hz
channel: 14 channel: 14
@ -1996,6 +2122,7 @@ output:
pin: pin:
pcf8574: pcf8574_hub pcf8574: pcf8574_hub
number: 0 number: 0
#allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
@ -2003,6 +2130,7 @@ output:
pin: pin:
pca9554: pca9554_hub pca9554: pca9554_hub
number: 0 number: 0
#allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
@ -2010,6 +2138,7 @@ output:
pin: pin:
mcp23xxx: mcp23017_hub mcp23xxx: mcp23017_hub
number: 0 number: 0
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
@ -2017,6 +2146,7 @@ output:
pin: pin:
mcp23xxx: mcp23008_hub mcp23xxx: mcp23008_hub
number: 0 number: 0
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
@ -2076,14 +2206,22 @@ output:
channel: 3 channel: 3
- platform: slow_pwm - platform: slow_pwm
id: id24 id: id24
pin: GPIO26 pin:
allow_other_uses: true
number: GPIO26
period: 15s period: 15s
- platform: ac_dimmer - platform: ac_dimmer
id: dimmer1 id: dimmer1
gate_pin: GPIO5 gate_pin:
zero_cross_pin: GPIO26 allow_other_uses: true
number: GPIO5
zero_cross_pin:
allow_other_uses: true
number: GPIO26
- platform: esp32_dac - platform: esp32_dac
pin: GPIO25 pin:
allow_other_uses: true
number: GPIO25
id: dac_output id: dac_output
- platform: mcp4725 - platform: mcp4725
id: mcp4725_dac_output id: mcp4725_dac_output
@ -2147,9 +2285,15 @@ output:
current: 10 current: 10
- platform: x9c - platform: x9c
id: test_x9c id: test_x9c
cs_pin: GPIO25 cs_pin:
inc_pin: GPIO26 allow_other_uses: true
ud_pin: GPIO27 number: GPIO25
inc_pin:
allow_other_uses: true
number: GPIO26
ud_pin:
allow_other_uses: true
number: GPIO27
initial_value: 0.5 initial_value: 0.5
light: light:
@ -2256,7 +2400,9 @@ light:
warm_white_color_temperature: 500 mireds warm_white_color_temperature: 500 mireds
remote_transmitter: remote_transmitter:
- pin: 32 - pin:
allow_other_uses: true
number: 32
carrier_duty_percent: 100% carrier_duty_percent: 100%
climate: climate:
@ -2440,6 +2586,7 @@ switch:
mcp23xxx: mcp23s08_hub mcp23xxx: mcp23s08_hub
# Use pin number 0 # Use pin number 0
number: 0 number: 0
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
@ -2448,10 +2595,13 @@ switch:
mcp23xxx: mcp23s17_hub mcp23xxx: mcp23s17_hub
# Use pin number 0 # Use pin number 0
number: 1 number: 1
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
inverted: false inverted: false
- platform: gpio - platform: gpio
pin: GPIO25 pin:
allow_other_uses: true
number: GPIO25
name: Living Room Dehumidifier name: Living Room Dehumidifier
icon: "mdi:restart" icon: "mdi:restart"
inverted: true inverted: true
@ -2834,12 +2984,24 @@ display:
id: my_lcd_gpio id: my_lcd_gpio
dimensions: 18x4 dimensions: 18x4
data_pins: data_pins:
- GPIO19 -
- GPIO21 allow_other_uses: true
- GPIO22 number: GPIO19
- GPIO23 -
enable_pin: GPIO23 allow_other_uses: true
rs_pin: GPIO25 number: GPIO21
-
allow_other_uses: true
number: GPIO22
-
allow_other_uses: true
number: GPIO23
enable_pin:
allow_other_uses: true
number: GPIO23
rs_pin:
allow_other_uses: true
number: GPIO25
lambda: |- lambda: |-
it.print("Hello World!"); it.print("Hello World!");
- platform: lcd_pcf8574 - platform: lcd_pcf8574
@ -2860,13 +3022,19 @@ display:
it.print("Hello World!"); it.print("Hello World!");
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: max7219 - platform: max7219
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
num_chips: 1 num_chips: 1
lambda: |- lambda: |-
it.print("01234567"); it.print("01234567");
- platform: tm1637 - platform: tm1637
clk_pin: GPIO23 clk_pin:
dio_pin: GPIO25 allow_other_uses: true
number: GPIO23
dio_pin:
allow_other_uses: true
number: GPIO25
intensity: 3 intensity: 3
lambda: |- lambda: |-
it.print("1234"); it.print("1234");
@ -2874,6 +3042,7 @@ display:
clk_pin: clk_pin:
mcp23xxx: mcp23017_hub mcp23xxx: mcp23017_hub
number: 1 number: 1
allow_other_uses: true
dio_pin: dio_pin:
mcp23xxx: mcp23017_hub mcp23xxx: mcp23017_hub
number: 2 number: 2
@ -2883,15 +3052,23 @@ display:
lambda: |- lambda: |-
it.print("1234"); it.print("1234");
- platform: pcd8544 - platform: pcd8544
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
contrast: 60 contrast: 60
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1306_i2c - platform: ssd1306_i2c
model: SSD1306_128X64 model: SSD1306_128X64
reset_pin: GPIO23 reset_pin:
allow_other_uses: true
number: GPIO23
address: 0x3C address: 0x3C
id: display1 id: display1
contrast: 60% contrast: 60%
@ -2912,28 +3089,48 @@ display:
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: ssd1306_spi - platform: ssd1306_spi
model: SSD1306 128x64 model: SSD1306 128x64
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1322_spi - platform: ssd1322_spi
model: SSD1322 256x64 model: SSD1322 256x64
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1325_spi - platform: ssd1325_spi
model: SSD1325 128x64 model: SSD1325 128x64
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1327_i2c - platform: ssd1327_i2c
model: SSD1327 128X128 model: SSD1327 128X128
reset_pin: GPIO23 reset_pin:
allow_other_uses: true
number: GPIO23
address: 0x3D address: 0x3D
id: display1327 id: display1327
brightness: 60% brightness: 60%
@ -2947,29 +3144,53 @@ display:
i2c_id: i2c_bus i2c_id: i2c_bus
- platform: ssd1327_spi - platform: ssd1327_spi
model: SSD1327 128x128 model: SSD1327 128x128
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1331_spi - platform: ssd1331_spi
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ssd1351_spi - platform: ssd1351_spi
model: SSD1351 128x128 model: SSD1351 128x128
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
reset_pin: GPIO23 number: GPIO23
dc_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: st7789v - platform: st7789v
model: TTGO TDisplay 135x240 model: TTGO TDisplay 135x240
cs_pin: GPIO5 cs_pin:
dc_pin: GPIO16 allow_other_uses: true
reset_pin: GPIO23 number: GPIO5
dc_pin:
allow_other_uses: true
number: GPIO16
reset_pin:
allow_other_uses: true
number: GPIO23
backlight_pin: no backlight_pin: no
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
@ -2977,15 +3198,22 @@ display:
width: 128 width: 128
height: 64 height: 64
cs_pin: cs_pin:
allow_other_uses: true
number: GPIO23 number: GPIO23
inverted: true inverted: true
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: st7735 - platform: st7735
model: INITR_BLACKTAB model: INITR_BLACKTAB
cs_pin: GPIO5 cs_pin:
dc_pin: GPIO16 allow_other_uses: true
reset_pin: GPIO23 number: GPIO5
dc_pin:
allow_other_uses: true
number: GPIO16
reset_pin:
allow_other_uses: true
number: GPIO23
rotation: 0 rotation: 0
device_width: 128 device_width: 128
device_height: 160 device_height: 160
@ -3001,10 +3229,16 @@ display:
mirror_x: true mirror_x: true
mirror_y: false mirror_y: false
model: TFT 2.4 model: TFT 2.4
cs_pin: GPIO5 cs_pin:
dc_pin: GPIO4 allow_other_uses: true
number: GPIO5
dc_pin:
allow_other_uses: true
number: GPIO4
color_palette: GRAYSCALE color_palette: GRAYSCALE
reset_pin: GPIO22 reset_pin:
allow_other_uses: true
number: GPIO22
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: ili9xxx - platform: ili9xxx
@ -3014,9 +3248,15 @@ display:
offset_width: 20 offset_width: 20
offset_height: 10 offset_height: 10
model: TFT 2.4 model: TFT 2.4
cs_pin: GPIO5 cs_pin:
dc_pin: GPIO4 allow_other_uses: true
reset_pin: GPIO22 number: GPIO5
dc_pin:
allow_other_uses: true
number: GPIO4
reset_pin:
allow_other_uses: true
number: GPIO22
auto_clear_enabled: false auto_clear_enabled: false
rotation: 90 rotation: 90
lambda: |- lambda: |-
@ -3041,10 +3281,18 @@ display:
it.print_battery(true); it.print_battery(true);
- platform: tm1621 - platform: tm1621
id: tm1621_display id: tm1621_display
cs_pin: GPIO17 cs_pin:
data_pin: GPIO5 allow_other_uses: true
read_pin: GPIO23 number: GPIO17
write_pin: GPIO18 data_pin:
allow_other_uses: true
number: GPIO5
read_pin:
allow_other_uses: true
number: GPIO23
write_pin:
allow_other_uses: true
number: GPIO18
lambda: |- lambda: |-
it.printf(0, "%.1f", id(dht_temperature).state); it.printf(0, "%.1f", id(dht_temperature).state);
it.display_celsius(true); it.display_celsius(true);
@ -3053,12 +3301,18 @@ display:
tm1651: tm1651:
id: tm1651_battery id: tm1651_battery
clk_pin: GPIO23 clk_pin:
dio_pin: GPIO23 allow_other_uses: true
number: GPIO23
dio_pin:
allow_other_uses: true
number: GPIO23
remote_receiver: remote_receiver:
id: rcvr id: rcvr
pin: GPIO32 pin:
allow_other_uses: true
number: GPIO32
dump: all dump: all
on_coolix: on_coolix:
then: then:
@ -3068,11 +3322,16 @@ remote_receiver:
delay: !lambda "return uint32_t(x.code) + x.protocol;" delay: !lambda "return uint32_t(x.code) + x.protocol;"
status_led: status_led:
pin: GPIO2 pin:
allow_other_uses: true
number: GPIO2
ignore_strapping_warning: true
pn532_spi: pn532_spi:
id: pn532_bs id: pn532_bs
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
update_interval: 1s update_interval: 1s
on_tag: on_tag:
- lambda: |- - lambda: |-
@ -3094,7 +3353,9 @@ rdm6300:
uart_id: uart_0 uart_id: uart_0
rc522_spi: rc522_spi:
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
update_interval: 1s update_interval: 1s
on_tag: on_tag:
- lambda: |- - lambda: |-
@ -3287,9 +3548,15 @@ mcp23016:
stepper: stepper:
- platform: a4988 - platform: a4988
id: my_stepper id: my_stepper
step_pin: GPIO23 step_pin:
dir_pin: GPIO25 allow_other_uses: true
sleep_pin: GPIO25 number: GPIO23
dir_pin:
allow_other_uses: true
number: GPIO25
sleep_pin:
allow_other_uses: true
number: GPIO25
max_speed: 250 steps/s max_speed: 250 steps/s
acceleration: 100 steps/s^2 acceleration: 100 steps/s^2
deceleration: 200 steps/s^2 deceleration: 200 steps/s^2
@ -3397,14 +3664,26 @@ text_sensor:
sn74hc595: sn74hc595:
- id: sn74hc595_hub - id: sn74hc595_hub
data_pin: GPIO21 data_pin:
clock_pin: GPIO23 allow_other_uses: true
latch_pin: GPIO22 number: GPIO21
oe_pin: GPIO32 clock_pin:
allow_other_uses: true
number: GPIO23
latch_pin:
allow_other_uses: true
number: GPIO22
oe_pin:
allow_other_uses: true
number: GPIO32
sr_count: 2 sr_count: 2
- id: sn74hc595_hub_2 - id: sn74hc595_hub_2
latch_pin: GPIO22 latch_pin:
oe_pin: GPIO32 allow_other_uses: true
number: GPIO22
oe_pin:
allow_other_uses: true
number: GPIO32
sr_count: 2 sr_count: 2
spi_id: spi_bus spi_id: spi_bus
@ -3456,8 +3735,12 @@ canbus:
} }
- platform: esp32_can - platform: esp32_can
id: esp32_internal_can id: esp32_internal_can
rx_pin: GPIO04 rx_pin:
tx_pin: GPIO05 allow_other_uses: true
number: GPIO04
tx_pin:
allow_other_uses: true
number: GPIO05
can_id: 4 can_id: 4
bit_rate: 50kbps bit_rate: 50kbps
on_frame: on_frame:

View file

@ -44,25 +44,42 @@ uart:
rx_pin: 3 rx_pin: 3
baud_rate: 9600 baud_rate: 9600
- id: uart_2 - id: uart_2
tx_pin: 17 tx_pin:
rx_pin: 16 allow_other_uses: true
number: 17
rx_pin:
allow_other_uses: true
number: 16
baud_rate: 19200 baud_rate: 19200
i2c: i2c:
sda:
number: 21
allow_other_uses: true
frequency: 100khz frequency: 100khz
spi: spi:
- id: spi_1 - id: spi_1
clk_pin: 12 clk_pin:
mosi_pin: 13 allow_other_uses: true
miso_pin: 14 number: 12
mosi_pin:
allow_other_uses: true
number: 13
miso_pin:
allow_other_uses: true
number: 14
- id: spi_2 - id: spi_2
clk_pin: 32 clk_pin:
allow_other_uses: true
number: 32
mosi_pin: 33 mosi_pin: 33
modbus: modbus:
uart_id: uart_1 uart_id: uart_1
flow_control_pin: 5 flow_control_pin:
allow_other_uses: true
number: 5
id: mod_bus1 id: mod_bus1
modbus_controller: modbus_controller:
@ -229,9 +246,15 @@ binary_sensor:
lambda: return x[0] & 1; lambda: return x[0] & 1;
tlc5947: tlc5947:
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 allow_other_uses: true
lat_pin: GPIO15 number: GPIO12
clock_pin:
allow_other_uses: true
number: GPIO14
lat_pin:
allow_other_uses: true
number: GPIO15
gp8403: gp8403:
- id: gp8403_5v - id: gp8403_5v
@ -417,7 +440,9 @@ sensor:
- platform: adc - platform: adc
id: adc_sensor_p32 id: adc_sensor_p32
name: ADC pin 32 name: ADC pin 32
pin: 32 pin:
allow_other_uses: true
number: 32
attenuation: 11db attenuation: 11db
update_interval: 1s update_interval: 1s
- platform: internal_temperature - platform: internal_temperature
@ -584,7 +609,9 @@ sensor:
name: Kuntze temperature name: Kuntze temperature
- platform: ade7953_i2c - platform: ade7953_i2c
irq_pin: 16 irq_pin:
allow_other_uses: true
number: 16
voltage: voltage:
name: ADE7953 Voltage name: ADE7953 Voltage
current_a: current_a:
@ -612,7 +639,9 @@ sensor:
- platform: ade7953_spi - platform: ade7953_spi
spi_id: spi_1 spi_id: spi_1
cs_pin: 04 cs_pin: 04
irq_pin: 16 irq_pin:
allow_other_uses: true
number: 16
voltage: voltage:
name: ADE7953 Voltage name: ADE7953 Voltage
current_a: current_a:
@ -683,7 +712,9 @@ switch:
display: display:
- platform: tm1638 - platform: tm1638
id: primarydisplay id: primarydisplay
stb_pin: 5 #TM1638 STB stb_pin:
allow_other_uses: true
number: 5 #TM1638 STB
clk_pin: 18 #TM1638 CLK clk_pin: 18 #TM1638 CLK
dio_pin: 23 #TM1638 DIO dio_pin: 23 #TM1638 DIO
update_interval: 5s update_interval: 5s
@ -728,20 +759,32 @@ text_sensor:
sn74hc165: sn74hc165:
id: sn74hc165_hub id: sn74hc165_hub
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 allow_other_uses: true
load_pin: GPIO27 number: GPIO12
clock_inhibit_pin: GPIO26 clock_pin:
allow_other_uses: true
number: GPIO14
load_pin:
number: GPIO27
clock_inhibit_pin:
number: GPIO26
sr_count: 4 sr_count: 4
matrix_keypad: matrix_keypad:
id: keypad id: keypad
rows: rows:
- pin: 21 - pin:
allow_other_uses: true
number: 21
- pin: 19 - pin: 19
columns: columns:
- pin: 17 - pin:
- pin: 16 allow_other_uses: true
number: 17
- pin:
allow_other_uses: true
number: 16
keys: "1234" keys: "1234"
key_collector: key_collector:
@ -753,14 +796,18 @@ key_collector:
light: light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
id: led_strip id: led_strip
pin: 13 pin:
allow_other_uses: true
number: 13
num_leds: 60 num_leds: 60
rmt_channel: 6 rmt_channel: 6
rgb_order: GRB rgb_order: GRB
chipset: ws2812 chipset: ws2812
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
id: led_strip2 id: led_strip2
pin: 15 pin:
allow_other_uses: true
number: 15
num_leds: 60 num_leds: 60
rmt_channel: 2 rmt_channel: 2
rgb_order: RGB rgb_order: RGB

View file

@ -17,11 +17,17 @@ substitutions:
ethernet: ethernet:
type: LAN8720 type: LAN8720
mdc_pin: GPIO23 mdc_pin:
mdio_pin: GPIO25 allow_other_uses: true
number: GPIO23
mdio_pin:
allow_other_uses: true
number: GPIO25
clk_mode: GPIO0_IN clk_mode: GPIO0_IN
phy_addr: 0 phy_addr: 0
power_pin: GPIO25 power_pin:
allow_other_uses: true
number: GPIO25
manual_ip: manual_ip:
static_ip: 192.168.178.56 static_ip: 192.168.178.56
gateway: 192.168.178.1 gateway: 192.168.178.1
@ -37,18 +43,32 @@ mdns:
api: api:
i2c: i2c:
sda: 21 sda:
scl: 22 allow_other_uses: true
number: 21
scl:
allow_other_uses: true
number: 22
scan: false scan: false
spi: spi:
clk_pin: GPIO21 clk_pin:
mosi_pin: GPIO22 allow_other_uses: true
miso_pin: GPIO23 number: GPIO21
mosi_pin:
allow_other_uses: true
number: GPIO22
miso_pin:
allow_other_uses: true
number: GPIO23
uart: uart:
tx_pin: GPIO22 tx_pin:
rx_pin: GPIO23 allow_other_uses: true
number: GPIO22
rx_pin:
allow_other_uses: true
number: GPIO23
baud_rate: 115200 baud_rate: 115200
# Specifically added for testing debug with no after: definition. # Specifically added for testing debug with no after: definition.
debug: debug:
@ -73,21 +93,29 @@ deep_sleep:
gpio_wakeup_reason: 10s gpio_wakeup_reason: 10s
touch_wakeup_reason: 15s touch_wakeup_reason: 15s
sleep_duration: 50s sleep_duration: 50s
wakeup_pin: GPIO2 wakeup_pin:
allow_other_uses: true
number: GPIO2
wakeup_pin_mode: INVERT_WAKEUP wakeup_pin_mode: INVERT_WAKEUP
as3935_i2c: as3935_i2c:
irq_pin: GPIO12 irq_pin:
allow_other_uses: true
number: GPIO12
mcp3008: mcp3008:
- id: mcp3008_hub - id: mcp3008_hub
cs_pin: GPIO12 cs_pin:
allow_other_uses: true
number: GPIO12
output: output:
- platform: ac_dimmer - platform: ac_dimmer
id: dimmer1 id: dimmer1
gate_pin: GPIO5 gate_pin: GPIO5
zero_cross_pin: GPIO12 zero_cross_pin:
allow_other_uses: true
number: GPIO12
sensor: sensor:
- platform: homeassistant - platform: homeassistant
@ -534,7 +562,9 @@ binary_sensor:
name: Mi Motion Sensor 2 Button name: Mi Motion Sensor 2 Button
- platform: gpio - platform: gpio
id: gpio_set_retry_test id: gpio_set_retry_test
pin: GPIO9 pin:
allow_other_uses: true
number: GPIO9
on_press: on_press:
then: then:
- lambda: |- - lambda: |-
@ -601,7 +631,9 @@ xiaomi_rtcgq02lm:
bindkey: "48403ebe2d385db8d0c187f81e62cb64" bindkey: "48403ebe2d385db8d0c187f81e62cb64"
status_led: status_led:
pin: GPIO2 pin:
allow_other_uses: true
number: GPIO2
text_sensor: text_sensor:
- platform: version - platform: version
@ -704,9 +736,13 @@ script:
stepper: stepper:
- platform: uln2003 - platform: uln2003
id: my_stepper id: my_stepper
pin_a: GPIO23 pin_a:
allow_other_uses: true
number: GPIO23
pin_b: GPIO27 pin_b: GPIO27
pin_c: GPIO25 pin_c:
allow_other_uses: true
number: GPIO25
pin_d: GPIO26 pin_d: GPIO26
sleep_when_done: false sleep_when_done: false
step_mode: HALF_STEP step_mode: HALF_STEP
@ -731,7 +767,9 @@ display:
offset_height: 35 offset_height: 35
offset_width: 0 offset_width: 0
dc_pin: GPIO13 dc_pin: GPIO13
reset_pin: GPIO9 reset_pin:
allow_other_uses: true
number: GPIO9
image: image:
- id: binary_image - id: binary_image

View file

@ -29,14 +29,24 @@ web_server:
version: 2 version: 2
i2c: i2c:
sda: 4 sda:
scl: 5 allow_other_uses: true
number: 4
scl:
allow_other_uses: true
number: 5
scan: false scan: false
spi: spi:
clk_pin: GPIO12 clk_pin:
mosi_pin: GPIO13 allow_other_uses: true
miso_pin: GPIO14 number: GPIO12
mosi_pin:
allow_other_uses: true
number: GPIO13
miso_pin:
allow_other_uses: true
number: GPIO14
ota: ota:
@ -52,7 +62,9 @@ sensor:
name: VL53L0x Distance name: VL53L0x Distance
address: 0x29 address: 0x29
update_interval: 60s update_interval: 60s
enable_pin: GPIO13 enable_pin:
allow_other_uses: true
number: GPIO13
timeout: 200us timeout: 200us
- platform: apds9960 - platform: apds9960
type: clear type: clear
@ -170,7 +182,9 @@ sensor:
name: Custom Sensor name: Custom Sensor
- platform: ade7953_i2c - platform: ade7953_i2c
irq_pin: GPIO16 irq_pin:
allow_other_uses: true
number: GPIO16
voltage: voltage:
name: ADE7953 Voltage name: ADE7953 Voltage
id: ade7953_voltage id: ade7953_voltage
@ -199,8 +213,12 @@ sensor:
update_interval: 1s update_interval: 1s
- platform: ade7953_spi - platform: ade7953_spi
cs_pin: GPIO04 cs_pin:
irq_pin: GPIO16 allow_other_uses: true
number: GPIO04
irq_pin:
allow_other_uses: true
number: GPIO16
voltage: voltage:
name: ADE7953 Voltage name: ADE7953 Voltage
current_a: current_a:
@ -360,8 +378,12 @@ text_sensor:
name: Custom Text Sensor name: Custom Text Sensor
sm2135: sm2135:
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 allow_other_uses: true
number: GPIO12
clock_pin:
allow_other_uses: true
number: GPIO14
rgb_current: 20mA rgb_current: 20mA
cw_current: 60mA cw_current: 60mA
@ -379,6 +401,7 @@ switch:
pin: pin:
mcp23xxx: mcp23017_hub mcp23xxx: mcp23017_hub
number: 0 number: 0
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
interlock: &interlock [gpio_switch1, gpio_switch2, gpio_switch3] interlock: &interlock [gpio_switch1, gpio_switch2, gpio_switch3]
- platform: gpio - platform: gpio
@ -386,11 +409,14 @@ switch:
pin: pin:
mcp23xxx: mcp23008_hub mcp23xxx: mcp23008_hub
number: 0 number: 0
allow_other_uses: true
mode: OUTPUT mode: OUTPUT
interlock: *interlock interlock: *interlock
- platform: gpio - platform: gpio
id: gpio_switch3 id: gpio_switch3
pin: GPIO1 pin:
allow_other_uses: true
number: GPIO1
interlock: *interlock interlock: *interlock
- platform: custom - platform: custom
lambda: |- lambda: |-
@ -440,10 +466,18 @@ custom_component:
stepper: stepper:
- platform: uln2003 - platform: uln2003
id: my_stepper id: my_stepper
pin_a: GPIO12 pin_a:
pin_b: GPIO13 allow_other_uses: true
pin_c: GPIO14 number: GPIO12
pin_d: GPIO15 pin_b:
allow_other_uses: true
number: GPIO13
pin_c:
allow_other_uses: true
number: GPIO14
pin_d:
allow_other_uses: true
number: GPIO15
sleep_when_done: false sleep_when_done: false
step_mode: HALF_STEP step_mode: HALF_STEP
max_speed: 250 steps/s max_speed: 250 steps/s
@ -451,8 +485,12 @@ stepper:
deceleration: inf deceleration: inf
- platform: a4988 - platform: a4988
id: my_stepper2 id: my_stepper2
step_pin: GPIO1 step_pin:
dir_pin: GPIO2 allow_other_uses: true
number: GPIO1
dir_pin:
allow_other_uses: true
number: GPIO2
max_speed: 0.1 steps/s max_speed: 0.1 steps/s
acceleration: 10 steps/s^2 acceleration: 10 steps/s^2
deceleration: 10 steps/s^2 deceleration: 10 steps/s^2
@ -556,11 +594,14 @@ cover:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm
id: out id: out
pin: D3 pin:
number: D3
frequency: 50Hz frequency: 50Hz
- platform: esp8266_pwm - platform: esp8266_pwm
id: out2 id: out2
pin: D4 pin:
allow_other_uses: true
number: D4
- platform: custom - platform: custom
type: binary type: binary
lambda: |- lambda: |-
@ -572,7 +613,9 @@ output:
- platform: sigma_delta_output - platform: sigma_delta_output
id: sddac id: sddac
update_interval: 60s update_interval: 60s
pin: D4 pin:
allow_other_uses: true
number: D4
turn_on_action: turn_on_action:
then: then:
- logger.log: "Turned on" - logger.log: "Turned on"
@ -593,7 +636,9 @@ output:
outputs: outputs:
- id: custom_float - id: custom_float
- platform: slow_pwm - platform: slow_pwm
pin: GPIO5 pin:
allow_other_uses: true
number: GPIO5
id: my_slow_pwm id: my_slow_pwm
period: 15s period: 15s
restart_cycle_on_state_change: false restart_cycle_on_state_change: false
@ -635,12 +680,18 @@ servo:
ttp229_lsf: ttp229_lsf:
ttp229_bsf: ttp229_bsf:
sdo_pin: D2 sdo_pin:
scl_pin: D1 allow_other_uses: true
number: D2
scl_pin:
allow_other_uses: true
number: D1
display: display:
- platform: max7219digit - platform: max7219digit
cs_pin: GPIO15 cs_pin:
allow_other_uses: true
number: GPIO15
num_chips: 4 num_chips: 4
rotate_chip: 0 rotate_chip: 0
intensity: 10 intensity: 10
@ -666,10 +717,20 @@ button:
name: Restart Button (Factory Default Settings) name: Restart Button (Factory Default Settings)
cd74hc4067: cd74hc4067:
pin_s0: GPIO12 pin_s0:
pin_s1: GPIO13 allow_other_uses: true
pin_s2: GPIO14 number: GPIO12
pin_s3: GPIO15 pin_s1:
allow_other_uses: true
number: GPIO13
pin_s2:
allow_other_uses: true
number: GPIO14
pin_s3:
allow_other_uses: true
number: GPIO15
adc128s102: adc128s102:
cs_pin: GPIO12 cs_pin:
allow_other_uses: true
number: GPIO12

View file

@ -223,55 +223,102 @@ uart:
tx_pin: tx_pin:
number: GPIO1 number: GPIO1
inverted: true inverted: true
rx_pin: GPIO3 allow_other_uses: true
rx_pin:
allow_other_uses: true
number: GPIO3
baud_rate: 115200 baud_rate: 115200
- id: uart_2 - id: uart_2
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_3 - id: uart_3
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 4800 baud_rate: 4800
- id: uart_4 - id: uart_4
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_5 - id: uart_5
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_6 - id: uart_6
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_7 - id: uart_7
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 38400 baud_rate: 38400
- id: uart_8 - id: uart_8
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 4800 baud_rate: 4800
parity: NONE parity: NONE
stop_bits: 2 stop_bits: 2
# Specifically added for testing debug with no options at all. # Specifically added for testing debug with no options at all.
debug: debug:
- id: uart_9 - id: uart_9
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_10 - id: uart_10
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_11 - id: uart_11
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
- id: uart_12 - id: uart_12
tx_pin: GPIO4 tx_pin:
rx_pin: GPIO5 allow_other_uses: true
number: GPIO4
rx_pin:
allow_other_uses: true
number: GPIO5
baud_rate: 9600 baud_rate: 9600
modbus: modbus:
@ -748,13 +795,19 @@ binary_sensor:
- platform: gpio - platform: gpio
id: bin1 id: bin1
pin: 1 pin:
allow_other_uses: true
number: 1
- platform: gpio - platform: gpio
id: bin2 id: bin2
pin: 2 pin:
allow_other_uses: true
number: 2
- platform: gpio - platform: gpio
id: bin3 id: bin3
pin: 3 pin:
allow_other_uses: true
number: 3
globals: globals:
- id: my_global_string - id: my_global_string
@ -762,11 +815,15 @@ globals:
initial_value: '""' initial_value: '""'
remote_receiver: remote_receiver:
pin: GPIO12 pin:
allow_other_uses: true
number: GPIO12
dump: [] dump: []
status_led: status_led:
pin: GPIO2 pin:
allow_other_uses: true
number: GPIO2
text_sensor: text_sensor:
- platform: daly_bms - platform: daly_bms
@ -819,13 +876,19 @@ script:
switch: switch:
- platform: gpio - platform: gpio
id: gpio_switch1 id: gpio_switch1
pin: 1 pin:
allow_other_uses: true
number: 1
- platform: gpio - platform: gpio
id: gpio_switch2 id: gpio_switch2
pin: 2 pin:
allow_other_uses: true
number: 2
- platform: gpio - platform: gpio
id: gpio_switch3 id: gpio_switch3
pin: 3 pin:
allow_other_uses: true
number: 3
- platform: nextion - platform: nextion
id: r0 id: r0
@ -1023,13 +1086,18 @@ sprinkler:
output: output:
- platform: esp8266_pwm - platform: esp8266_pwm
id: out id: out
pin: D3 pin:
number: D3
frequency: 50Hz frequency: 50Hz
- platform: esp8266_pwm - platform: esp8266_pwm
id: out2 id: out2
pin: D4 pin:
allow_other_uses: true
number: D4
- platform: slow_pwm - platform: slow_pwm
pin: GPIO5 pin:
allow_other_uses: true
number: GPIO5
id: my_slow_pwm id: my_slow_pwm
period: 15s period: 15s
restart_cycle_on_state_change: false restart_cycle_on_state_change: false
@ -1039,7 +1107,9 @@ e131:
light: light:
- platform: neopixelbus - platform: neopixelbus
name: Neopixelbus Light name: Neopixelbus Light
pin: GPIO1 pin:
allow_other_uses: true
number: GPIO1
type: GRBW type: GRBW
variant: SK6812 variant: SK6812
method: ESP8266_UART0 method: ESP8266_UART0
@ -1071,6 +1141,12 @@ light:
max_brightness: 500 max_brightness: 500
firmware: "51.6" firmware: "51.6"
uart_id: uart_11 uart_id: uart_11
nrst_pin:
number: 5
allow_other_uses: true
boot0_pin:
number: 4
allow_other_uses: true
sim800l: sim800l:
uart_id: uart_4 uart_id: uart_4
@ -1096,8 +1172,12 @@ dfplayer:
logger.log: Playback finished event logger.log: Playback finished event
tm1651: tm1651:
id: tm1651_battery id: tm1651_battery
clk_pin: D6 clk_pin:
dio_pin: D5 allow_other_uses: true
number: D6
dio_pin:
allow_other_uses: true
number: D5
rf_bridge: rf_bridge:
uart_id: uart_5 uart_id: uart_5
@ -1150,7 +1230,9 @@ display:
lambda: 'ESP_LOGD("display","Display shows new page %u", x);' lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
fingerprint_grow: fingerprint_grow:
sensing_pin: 4 sensing_pin:
allow_other_uses: true
number: 4
password: 0x12FE37DC password: 0x12FE37DC
new_password: 0xA65B9840 new_password: 0xA65B9840
on_finger_scan_matched: on_finger_scan_matched:
@ -1184,7 +1266,9 @@ dsmr:
decryption_key: 00112233445566778899aabbccddeeff decryption_key: 00112233445566778899aabbccddeeff
uart_id: uart_6 uart_id: uart_6
max_telegram_length: 1000 max_telegram_length: 1000
request_pin: D5 request_pin:
allow_other_uses: true
number: D5
request_interval: 20s request_interval: 20s
receive_timeout: 100ms receive_timeout: 100ms
@ -1197,8 +1281,11 @@ qr_code:
value: https://esphome.io/index.html value: https://esphome.io/index.html
lightwaverf: lightwaverf:
read_pin: 13 read_pin:
write_pin: 14 number: 13
write_pin:
allow_other_uses: true
number: 14
alarm_control_panel: alarm_control_panel:
- platform: template - platform: template

View file

@ -10,11 +10,17 @@ substitutions:
ethernet: ethernet:
type: LAN8720 type: LAN8720
mdc_pin: GPIO23 mdc_pin:
mdio_pin: GPIO25 allow_other_uses: true
number: GPIO23
mdio_pin:
allow_other_uses: true
number: GPIO25
clk_mode: GPIO0_IN clk_mode: GPIO0_IN
phy_addr: 0 phy_addr: 0
power_pin: GPIO25 power_pin:
allow_other_uses: true
number: GPIO25
manual_ip: manual_ip:
static_ip: 192.168.178.56 static_ip: 192.168.178.56
gateway: 192.168.178.1 gateway: 192.168.178.1
@ -34,29 +40,49 @@ mqtt:
api: api:
i2c: i2c:
sda: 21 sda:
scl: 22 allow_other_uses: true
number: 21
scl:
allow_other_uses: true
number: 22
scan: false scan: false
spi: spi:
- id: spi_id_1 - id: spi_id_1
clk_pin: GPIO21 clk_pin:
mosi_pin: GPIO22 allow_other_uses: true
miso_pin: GPIO23 number: GPIO21
mosi_pin:
allow_other_uses: true
number: GPIO22
miso_pin:
allow_other_uses: true
number: GPIO23
interface: hardware interface: hardware
- id: spi_id_2 - id: spi_id_2
clk_pin: GPIO32 clk_pin:
mosi_pin: GPIO33 number: GPIO32
mosi_pin:
number: GPIO33
interface: hardware interface: hardware
uart: uart:
- id: uart115200 - id: uart115200
tx_pin: GPIO22 tx_pin:
rx_pin: GPIO23 allow_other_uses: true
number: GPIO22
rx_pin:
allow_other_uses: true
number: GPIO23
baud_rate: 115200 baud_rate: 115200
- id: uart9600 - id: uart9600
tx_pin: GPIO22 tx_pin:
rx_pin: GPIO23 allow_other_uses: true
number: GPIO22
rx_pin:
allow_other_uses: true
number: GPIO23
baud_rate: 9600 baud_rate: 9600
- id: uart_he60r - id: uart_he60r
tx_pin: 22 tx_pin: 22
@ -91,6 +117,7 @@ tuya:
status_pin: status_pin:
number: 14 number: 14
inverted: true inverted: true
allow_other_uses: true
select: select:
- platform: tuya - platform: tuya
@ -117,7 +144,9 @@ sx1509:
mcp3204: mcp3204:
spi_id: spi_id_1 spi_id: spi_id_1
cs_pin: GPIO23 cs_pin:
allow_other_uses: true
number: GPIO23
dac7678: dac7678:
address: 0x4A address: 0x4A
@ -510,7 +539,9 @@ light:
id: led_matrix_32x8 id: led_matrix_32x8
name: led_matrix_32x8 name: led_matrix_32x8
chipset: WS2812B chipset: WS2812B
pin: GPIO15 pin:
allow_other_uses: true
number: GPIO15
num_leds: 256 num_leds: 256
rgb_order: GRB rgb_order: GRB
default_transition_length: 0s default_transition_length: 0s
@ -566,20 +597,36 @@ display:
- platform: waveshare_epaper - platform: waveshare_epaper
spi_id: spi_id_1 spi_id: spi_id_1
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
busy_pin: GPIO23 number: GPIO23
reset_pin: GPIO23 dc_pin:
allow_other_uses: true
number: GPIO23
busy_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
model: 2.13in-ttgo-b1 model: 2.13in-ttgo-b1
full_update_every: 30 full_update_every: 30
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper - platform: waveshare_epaper
spi_id: spi_id_1 spi_id: spi_id_1
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
busy_pin: GPIO23 number: GPIO23
reset_pin: GPIO23 dc_pin:
allow_other_uses: true
number: GPIO23
busy_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
model: 2.90in model: 2.90in
full_update_every: 30 full_update_every: 30
reset_duration: 200ms reset_duration: 200ms
@ -587,20 +634,36 @@ display:
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper - platform: waveshare_epaper
spi_id: spi_id_1 spi_id: spi_id_1
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
busy_pin: GPIO23 number: GPIO23
reset_pin: GPIO23 dc_pin:
allow_other_uses: true
number: GPIO23
busy_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
model: 2.90inv2 model: 2.90inv2
full_update_every: 30 full_update_every: 30
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper - platform: waveshare_epaper
spi_id: spi_id_1 spi_id: spi_id_1
cs_pin: GPIO23 cs_pin:
dc_pin: GPIO23 allow_other_uses: true
busy_pin: GPIO23 number: GPIO23
reset_pin: GPIO23 dc_pin:
allow_other_uses: true
number: GPIO23
busy_pin:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO23
model: 1.54in-m5coreink-m09 model: 1.54in-m5coreink-m09
lambda: |- lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height()); it.rectangle(0, 0, it.get_width(), it.get_height());
@ -610,15 +673,54 @@ display:
partial_updating: false partial_updating: false
update_interval: 60s update_interval: 60s
ckv_pin: GPIO1 display_data_1_pin:
sph_pin: GPIO1 number: 5
gmod_pin: GPIO1 allow_other_uses: true
gpio0_enable_pin: GPIO1 display_data_2_pin:
oe_pin: GPIO1 number: 18
spv_pin: GPIO1 allow_other_uses: true
powerup_pin: GPIO1 display_data_3_pin:
wakeup_pin: GPIO1 number: 19
vcom_pin: GPIO1 allow_other_uses: true
display_data_5_pin:
number: 25
allow_other_uses: true
display_data_4_pin:
number: 23
allow_other_uses: true
display_data_6_pin:
number: 26
allow_other_uses: true
display_data_7_pin:
number: 27
allow_other_uses: true
ckv_pin:
allow_other_uses: true
number: GPIO1
sph_pin:
allow_other_uses: true
number: GPIO1
gmod_pin:
allow_other_uses: true
number: GPIO1
gpio0_enable_pin:
allow_other_uses: true
number: GPIO1
oe_pin:
allow_other_uses: true
number: GPIO1
spv_pin:
allow_other_uses: true
number: GPIO1
powerup_pin:
allow_other_uses: true
number: GPIO1
wakeup_pin:
allow_other_uses: true
number: GPIO1
vcom_pin:
allow_other_uses: true
number: GPIO1
number: number:
- platform: tuya - platform: tuya
@ -706,18 +808,54 @@ output:
id: dac7678_1_ch7 id: dac7678_1_ch7
esp32_camera: esp32_camera:
name: ESP-32 Camera name: ESP-32 Camera
data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19] data_pins:
vsync_pin: GPIO22 - number: GPIO17
href_pin: GPIO26 allow_other_uses: true
pixel_clock_pin: GPIO21 - number: GPIO35
allow_other_uses: true
-
number: GPIO34
-
number: GPIO5
allow_other_uses: true
-
number: GPIO39
-
number: GPIO18
allow_other_uses: true
-
number: GPIO36
allow_other_uses: true
-
number: GPIO19
allow_other_uses: true
vsync_pin:
allow_other_uses: true
number: GPIO22
href_pin:
allow_other_uses: true
number: GPIO26
pixel_clock_pin:
allow_other_uses: true
number: GPIO21
external_clock: external_clock:
pin: GPIO27 pin:
allow_other_uses: true
number: GPIO27
frequency: 20MHz frequency: 20MHz
i2c_pins: i2c_pins:
sda: GPIO25 sda:
scl: GPIO23 allow_other_uses: true
reset_pin: GPIO15 number: GPIO25
power_down_pin: GPIO1 scl:
allow_other_uses: true
number: GPIO23
reset_pin:
allow_other_uses: true
number: GPIO15
power_down_pin:
allow_other_uses: true
number: GPIO1
resolution: 640x480 resolution: 640x480
jpeg_quality: 10 jpeg_quality: 10
@ -748,8 +886,12 @@ button:
touchscreen: touchscreen:
- platform: ektf2232 - platform: ektf2232
interrupt_pin: GPIO36 interrupt_pin:
rts_pin: GPIO5 allow_other_uses: true
number: GPIO36
rts_pin:
allow_other_uses: true
number: GPIO5
display: inkplate_display display: inkplate_display
on_touch: on_touch:
- logger.log: - logger.log:
@ -759,8 +901,11 @@ touchscreen:
- platform: xpt2046 - platform: xpt2046
id: xpt_touchscreen id: xpt_touchscreen
spi_id: spi_id_2 spi_id: spi_id_2
cs_pin: 17 cs_pin:
interrupt_pin: 16 allow_other_uses: true
number: 17
interrupt_pin:
number: 16
display: inkplate_display display: inkplate_display
update_interval: 50ms update_interval: 50ms
report_interval: 1s report_interval: 1s
@ -777,7 +922,9 @@ touchscreen:
- platform: lilygo_t5_47 - platform: lilygo_t5_47
id: lilygo_touchscreen id: lilygo_touchscreen
interrupt_pin: GPIO36 interrupt_pin:
allow_other_uses: true
number: GPIO36
display: inkplate_display display: inkplate_display
on_touch: on_touch:
- logger.log: - logger.log:
@ -789,16 +936,26 @@ touchscreen:
i2s_audio: i2s_audio:
i2s_lrclk_pin: GPIO26 i2s_lrclk_pin:
i2s_bclk_pin: GPIO27 allow_other_uses: true
i2s_mclk_pin: GPIO25 number: GPIO26
i2s_bclk_pin:
allow_other_uses: true
number: GPIO27
i2s_mclk_pin:
allow_other_uses: true
number: GPIO25
media_player: media_player:
- platform: i2s_audio - platform: i2s_audio
name: None name: None
dac_type: external dac_type: external
i2s_dout_pin: GPIO25 i2s_dout_pin:
mute_pin: GPIO14 allow_other_uses: true
number: GPIO25
mute_pin:
allow_other_uses: true
number: GPIO14
on_state: on_state:
- media_player.play: - media_player.play:
- media_player.play_media: http://localhost/media.mp3 - media_player.play_media: http://localhost/media.mp3
@ -827,12 +984,16 @@ prometheus:
microphone: microphone:
- platform: i2s_audio - platform: i2s_audio
id: mic_id_adc id: mic_id_adc
adc_pin: GPIO35 adc_pin:
allow_other_uses: true
number: GPIO35
adc_type: internal adc_type: internal
- platform: i2s_audio - platform: i2s_audio
id: mic_id_external id: mic_id_external
i2s_din_pin: GPIO23 i2s_din_pin:
allow_other_uses: true
number: GPIO23
adc_type: external adc_type: external
pdm: false pdm: false
@ -840,7 +1001,9 @@ speaker:
- platform: i2s_audio - platform: i2s_audio
id: speaker_id id: speaker_id
dac_type: external dac_type: external
i2s_dout_pin: GPIO25 i2s_dout_pin:
allow_other_uses: true
number: GPIO25
mode: mono mode: mono
voice_assistant: voice_assistant:

View file

@ -42,17 +42,27 @@ uart:
baud_rate: 9600 baud_rate: 9600
- id: uart_2 - id: uart_2
tx_pin: tx_pin:
allow_other_uses: true
number: 17 number: 17
inverted: true inverted: true
rx_pin: 16 rx_pin:
allow_other_uses: true
number: 16
baud_rate: 19200 baud_rate: 19200
i2c: i2c:
sda:
allow_other_uses: true
number: 21
scl:
number: 22
frequency: 100khz frequency: 100khz
modbus: modbus:
uart_id: uart_1 uart_id: uart_1
flow_control_pin: 5 flow_control_pin:
allow_other_uses: true
number: 5
id: mod_bus1 id: mod_bus1
modbus_controller: modbus_controller:
@ -214,9 +224,15 @@ binary_sensor:
lambda: return x[0] & 1; lambda: return x[0] & 1;
tlc5947: tlc5947:
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 number: GPIO12
lat_pin: GPIO15 allow_other_uses: true
clock_pin:
allow_other_uses: true
number: GPIO14
lat_pin:
allow_other_uses: true
number: GPIO15
gp8403: gp8403:
- id: gp8403_5v - id: gp8403_5v
@ -614,7 +630,9 @@ switch:
display: display:
- platform: tm1638 - platform: tm1638
id: primarydisplay id: primarydisplay
stb_pin: 5 #TM1638 STB stb_pin:
allow_other_uses: true
number: 5 #TM1638 STB
clk_pin: 18 #TM1638 CLK clk_pin: 18 #TM1638 CLK
dio_pin: 23 #TM1638 DIO dio_pin: 23 #TM1638 DIO
update_interval: 5s update_interval: 5s
@ -659,8 +677,12 @@ text_sensor:
sn74hc165: sn74hc165:
id: sn74hc165_hub id: sn74hc165_hub
data_pin: GPIO12 data_pin:
clock_pin: GPIO14 allow_other_uses: true
number: GPIO12
clock_pin:
allow_other_uses: true
number: GPIO14
load_pin: GPIO27 load_pin: GPIO27
clock_inhibit_pin: GPIO26 clock_inhibit_pin: GPIO26
sr_count: 4 sr_count: 4
@ -668,11 +690,17 @@ sn74hc165:
matrix_keypad: matrix_keypad:
id: keypad id: keypad
rows: rows:
- pin: 21 - pin:
allow_other_uses: true
number: 21
- pin: 19 - pin: 19
columns: columns:
- pin: 17 - pin:
- pin: 16 allow_other_uses: true
number: 17
- pin:
allow_other_uses: true
number: 16
keys: "1234" keys: "1234"
has_pulldowns: true has_pulldowns: true
@ -692,7 +720,9 @@ light:
chipset: ws2812 chipset: ws2812
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
id: led_strip2 id: led_strip2
pin: 15 pin:
allow_other_uses: true
number: 15
num_leds: 60 num_leds: 60
rmt_channel: 2 rmt_channel: 2
rgb_order: RGB rgb_order: RGB

View file

@ -57,7 +57,9 @@ display:
model: ili9342 model: ili9342
cs_pin: GPIO5 cs_pin: GPIO5
dc_pin: GPIO4 dc_pin: GPIO4
reset_pin: GPIO48 reset_pin:
number: GPIO48
allow_other_uses: true
i2c: i2c:
scl: GPIO18 scl: GPIO18
@ -68,7 +70,10 @@ touchscreen:
interrupt_pin: interrupt_pin:
number: GPIO3 number: GPIO3
ignore_strapping_warning: true ignore_strapping_warning: true
reset_pin: GPIO48 allow_other_uses: false
reset_pin:
number: GPIO48
allow_other_uses: true
binary_sensor: binary_sensor:
- platform: tt21100 - platform: tt21100