diff --git a/esphome/__main__.py b/esphome/__main__.py index b0f541f521..9dcc5cdfe8 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -1002,6 +1002,12 @@ def parse_args(argv): action="append", default=[], ) + options_parser.add_argument( + "--ignore-pin-conflicts", + help="Disable pin conflict validation (for testing grouped components)", + action="store_true", + default=False, + ) parser = argparse.ArgumentParser( description=f"ESPHome {const.__version__}", parents=[options_parser] @@ -1260,6 +1266,7 @@ def run_esphome(argv): args = parse_args(argv) CORE.dashboard = args.dashboard + CORE.ignore_pin_conflicts = args.ignore_pin_conflicts # Create address cache from command-line arguments CORE.address_cache = AddressCache.from_cli_args( diff --git a/esphome/core/__init__.py b/esphome/core/__init__.py index 7ab8a3ba71..744e32abf8 100644 --- a/esphome/core/__init__.py +++ b/esphome/core/__init__.py @@ -529,6 +529,8 @@ class EsphomeCore: self.dashboard = False # True if command is run from vscode api self.vscode = False + # True if pin conflict validation should be ignored + self.ignore_pin_conflicts = False # The name of the node self.name: str | None = None # The friendly name of the node diff --git a/esphome/pins.py b/esphome/pins.py index 4f9b4859a1..bcd554a720 100644 --- a/esphome/pins.py +++ b/esphome/pins.py @@ -118,7 +118,11 @@ class PinRegistry(dict): 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: + if ( + count != 1 + and not allow_others + and not CORE.ignore_pin_conflicts + ): raise cv.Invalid( f"Pin {pin_config[CONF_NUMBER]} is used in multiple places" )