Nodes/ComfyUI-TJ_NODE/Smart Converter (TJ)
ComfyUI Node

Smart Converter (TJ)

Make the wire accept what the node demands

By designloves2·Created 4 months ago·Updated 3 days ago· 13
Smart Converter (TJ)
  • any
  • output
  • status
output_typeAUTO
get_name
setnode_name
strict_modefalse

The universal type-conversion glue node

Smart Converter (TJ) takes any input and converts it to the output type you ask for: AUTO, INT, FLOAT, STRING, BOOLEAN, TENSOR, LIST, DICT, or JSON. It's the node you reach for when a wire carries something and the node you're wiring it into demands something else - a string that needs to become a number, a tensor you want reduced to a scalar, metadata you want as JSON, a value you need as a clean boolean for workflow control.

Every ComfyUI user eventually hits this wall: ComfyUI is strict about types on sockets, and third-party nodes are loose about what they hand you. This is the bridge that makes those two meet, and it's smarter than a hard cast because of AUTO mode and the status output.

How it works

The conversion lives in a single _convert() step: try to coerce the input to the requested type, and report what happened. Two behaviors make it genuinely useful:

  • strict_mode OFF (default) - if conversion fails, it returns a sensible default for the requested type plus a WARN status, so your workflow keeps running instead of dying. This is the forgiving, "glue it in and move on" mode.
  • strict_mode ON - a failed conversion raises an error. Use this when you'd rather the workflow stop loudly than silently produce a wrong value (for example, feeding a sampler config you can't afford to have silently mangled).

There's a status output alongside output that tells you exactly what happened ("OK: ... -> FLOAT" or "WARN: conversion failed"). That status line is the thing that saves you from the silent-wrong-value failure mode - worth wiring into a Show Any or just reading in the node UI.

The inputs that matter

  • any - the input value.
  • output_type - the target type. AUTO tries to pick the most sensible type from the input; otherwise pick explicitly.
  • strict_mode - the fail-loud toggle above.
  • get_name / setnode_name - the pack's wireless receive/publish hooks, for converting values that arrive over the wireless layer.

Outputs: output (the converted value, * type) and status (STRING).

Install it

Standard pack install, no extra dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/designloves2/ComfyUI-TJ_NODE.git

Or ComfyUI Manager → search TJ_NODE, restart. Category: ✨ TJ_Node/Utility.

Where people get burned

The subtle failure is relying on AUTO for values where the intent is ambiguous - a numeric-looking string converting to a number is what you want 90% of the time, but "123" as a display label silently becoming an INT is the other 10%. If the type matters, set output_type explicitly. Second: don't treat the default's silent WARN as "everything's fine" - a failed conversion still returns a fallback value, and that fallback can flow into a node that then misbehaves in confusing ways. For anything where a wrong value would corrupt a result, flip strict_mode on so the workflow stops at the source of the problem instead of three nodes later. Also worth knowing: the pack's Show Any docs specifically recommend it as the way to verify what Smart Converter actually produced.

Category ✨ TJ_Node/Utility

Inputs (5)

NameTypeDefaultDescription
output_typeCOMBOAUTO9 options: AUTO, INT, FLOAT, STRING, BOOLEAN, TENSOR, +3
get_nameCOMBO1 options: (none)
setnode_nameSTRING
strict_modeBOOLEANfalse
anyopt*

Outputs (2)

NameTypeDescription
output*
statusSTRING