ComfyUI Node

PVL Switch Huge

A ten-way switch that only runs the case you picked

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Switch Huge
  • input_default
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • input_6
  • input_7
  • input_8
  • input_9
  • input_10
  • output
switch_condition
case_1
case_2
case_3
case_4
case_5
case_6
case_7
case_8
case_9
case_10

When you're beyond true/false and need to route one value to one of ten handlers, a two-way switch won't cut it. PVL Switch Huge is a ten-case router: you give it a switch_condition string and ten case_ strings, wire up to ten inputs, and it sends the matching input to the output. Everything else - including the expensive upstreams of the cases you didn't pick - is skipped, because like the pack's PVL Switch, this one is lazy.

It's from pvlprk/comfyui-pvl-api-nodes ("ComfyUI Assistant Node"). The mental model is a switch/case statement from C or JavaScript, minus the break statements you always forgot.

How it works

  • switch_condition - the value being tested.
  • case_1case_10 - the strings it's compared against, with plain equality.
  • input_default - the fallback; used when switch_condition matches none of the ten cases. Required, so there's always an output.
  • input_1input_10 - the ten optional wildcard inputs, one per case.

Routing: switch_condition == case_N → output input_N; no match → output input_default. All inputs are wildcard (*), so you can route images, models, prompts, or numbers through the same node - whatever the cases resolve to.

The lazy part is the reason to care. check_lazy_status tells ComfyUI to evaluate only the one input that matches (plus input_default when nothing matches). So ten candidate subgraphs attached to one router don't cost you ten runs - the nine losers never execute. That's the difference between a "huge" node that's just convenient and one that's actually useful.

What you'd route through it

The pattern is tag/key-driven dispatch. Feed switch_condition a string from an API response or a dropdown - "fast", "high", "ultra", whatever - and route to different sampler settings, different prompts, different model loaders. It's the 10-way version of the pack's two-way Switch, and it shares the "evaluating only the selected branch" philosophy. If you only ever need two or three cases, the two-way Switch is leaner; this earns its place when the decision tree is genuinely wide.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes

restart, or install via ComfyUI Manager (search "ComfyUI Assistant Node"). No models, no dependencies.

The gotchas

  • Matching is exact string equality. "fast" won't match "Fast" or " fast ". Normalize your condition before it arrives, or you'll silently fall to input_default.
  • input_default is required - leave it unwired and a no-match case will hand you None and likely break downstream.
  • Type consistency across cases. The output type follows whichever case matched, so a mix of, say, prompts and images on different cases will connect fine but confuse whatever consumes the output. Keep all cases the same type.
  • Lazy evaluation skips unchosen branches only where nothing else needs them - if a shared node feeds multiple cases, it still runs.
CategoryPVL_tools

Inputs (22)

NameTypeDefaultDescription
switch_conditionSTRING
case_1STRING
case_2STRING
case_3STRING
case_4STRING
case_5STRING
case_6STRING
case_7STRING
case_8STRING
case_9STRING
case_10STRING
input_default*
input_1opt*
input_2opt*
input_3opt*
input_4opt*
input_5opt*
input_6opt*
input_7opt*
input_8opt*
input_9opt*
input_10opt*

Outputs (1)

NameTypeDescription
output*