Nodes/ComfyUI_Inteliweb_nodes/Input Switch (Inteliweb)
ComfyUI Node

Input Switch (Inteliweb)

A lazy A/B switch that only evaluates the branch you pick

By maoper11·Created about a year ago·Updated 9 days ago· 4
Input Switch (Inteliweb)
  • input1
  • selected_value
  • selected_label
  • selected_index
select1

Switches are where ComfyUI stops being a pipeline and starts acting like a program, and the Input Switch is the A/B variety: a manual routing valve that passes whichever input you point it at. The author credits Impact Pack's Switch (Any) as the conceptual inspiration, but this one is its own implementation, and it has one property that makes it genuinely better for heavy graphs: the inputs are lazy, so only the branch you select ever gets evaluated.

How it works

You connect any number of inputs - input1, input2, … - and they can be any type. The socket is the wildcard *, so it'll route an IMAGE, a STRING, a MODEL, a LATENT, whatever. Set the select integer to choose which one comes out the other side. The lazy part is the kicker: check_lazy_status() tells ComfyUI to evaluate only the selected input, which means an expensive upstream loader on an unselected branch doesn't run at all. That's the difference between "a switch that routes already-computed values" and "a switch that chooses which computation happens," and for model stacks it's the whole point.

There's a second nicety: connect something to the last open slot and a new one appears, so you grow the switch as needed instead of reserving ten sockets up front.

Inputs and outputs.

  • select - one-based index of the input to pass through (INT, default 1).
  • input1inputN - dynamic, any type.

Outputs are three: selected_value (the routed value, any type), selected_label (a STRING - the input's custom label if you named it in the workflow, otherwise its name), and selected_index (the INT index, handy for feeding back into other logic).

Installing it

Part of the Inteliweb pack; install once, restart, done:

cd ComfyUI/custom_nodes
git clone https://github.com/maoper11/comfyui_inteliweb_nodes.git
cd comfyui_inteliweb_nodes
python -m pip install -r requirements.txt

Or via ComfyUI Manager, "ComfyUI_Inteliweb_nodes". Just psutil and nvidia-ml-py, no models to download.

Where people get tripped up

Two things. First, if select points at a slot you never connected, the node logs a warning and returns None with an empty label - it won't crash, but your downstream node may silently fail on None, so wire before you select. Second, and this one comes straight from the README: ComfyUI still has general limitations with autogrow inputs and dynamic types at subgraph boundaries. If you're using this inside a subgraph, prefer stable, explicit types on the subgraph's exposed inputs where possible - the dynamic * sockets are exactly the thing that misbehaves there. It's a small, sharp tool: for "keep two model loaders and flip between them," it's hard to beat.

CategoryInteliweb/Utils

Inputs (2)

NameTypeDefaultDescription
selectINT11–999999Input number to send to the output.
input1opt*Any input. Connecting the last slot adds another input.

Outputs (3)

NameTypeDescription
selected_value*Value from the selected input.
selected_labelSTRINGCustom label of the selected input, or its input name.
selected_indexINTSelected one-based input index.