Nodes/ComfyUI-nhknodes/πŸ”€ Double Switch - In (nhk)
ComfyUI Node

πŸ”€ Double Switch - In (nhk)

Switch Two Wires as One Unit β€” Double Switch - In (nhk)

By EnashkaΒ·Created 12 months agoΒ·Updated 28 days agoΒ· 23
πŸ”€ Double Switch - In (nhk)
  • A1
  • A2
  • B1
  • B2
  • output1
  • output2
β—„selectortrueβ–Ί

Double Switch - In (nhk) is an A/B switch with two pairs of inputs. A boolean selector decides whether the A pair (A1/A2) or the B pair (B1/B2) flows through to output1/output2. It's for the situation where your data travels in twos and you don't want to keep two separate switches in lockstep.

The name says "In" because it's the input side of a paired design - the pack also ships "Double Switch - Out" for routing one pair to two different destinations. Together they cover "choose which pair goes downstream" (In) and "send this pair to one of two places" (Out).

Where this earns its keep: image-and-mask pairs, latent-and-conditioning pairs, image-and-caption pairs. You're A/B testing two variations - two img2img chains, two prompt setups, two upscale pipelines - each of which produces a matched pair of values. With a normal switch you'd need two of them driven by the same condition; this one flips both wires at once, so the pair can never get mismatched.

How it works

Like the pack's conditional routers, it uses lazy evaluation. check_lazy_status tells ComfyUI to only execute the inputs that will actually be used - the A pair when selector is true, the B pair when false. The unselected branch is pruned rather than executed-and-discarded, which is the meaningful difference from a naive "compute both, return one" switch: no wasted work and no side effects from the branch you didn't pick.

The selector is just a boolean widget, so you can drive it manually or wire it from another node's output for automation.

Inputs and outputs

  • selector - boolean, default true. True = A pair out, false = B pair out.
  • A1, A2 - first input pair.
  • B1, B2 - second input pair.

Outputs:

  • output1 - the first value of the selected pair.
  • output2 - the second value of the selected pair.

All inputs are wildcard (*). Nothing enforces that A1 and A2 are the same type - that pairing discipline is on you.

Installing it

Part of ComfyUI-nhknodes:

cd ComfyUI/custom_nodes && git clone https://github.com/Enashka/ComfyUI-nhknodes

restart, or "NHK Nodes" from ComfyUI Manager. No extra deps.

The honest read

This is a genuinely useful convenience, with two caveats. First, because it's lazy, the unselected pair's upstream chain doesn't execute at all - so if one of your A/B branches has a side effect you assumed would always run (a preview, a save), it won't fire when that branch loses. Second, the pair-switching saves you one switch node, not a category of problems - if you're switching a single value, the pack's plain Conditional Router or Cycling Switch is simpler. But for "swap my whole image+mask processing chain between two configurations," a two-wire switch like this is exactly the right tool, and the In/Out pairing means you can build the same discipline on both ends of your pipeline.

Categorynhk/utility

Inputs (5)

NameTypeDefaultDescription
selectorBOOLEANtrueTrue = output A inputs, False = output B inputs
A1*First input of A pair
A2*Second input of A pair
B1*First input of B pair
B2*Second input of B pair

Outputs (2)

NameTypeDescription
output1*β€”
output2*β€”