Skip to content

set_port_state

Override settings on a single switch port.

Side effects:

  • Modifies one port’s enable, poe_mode, and/or portconf_id on the named switch without touching the others.
  • Disabling a port immediately drops the link; powered devices on that port (PoE cameras, APs) will go offline.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
set_port_state(device_mac="aa:bb:cc:00:00:01", port_idx=5, enable=True, poe_mode="auto")
Parameter Type Required Default Description
device_mac string yes Switch MAC address (from list_devices).
port_idx integer yes 1-based port index.
enable `boolean null` no null
poe_mode string no “” "auto", "passive24v", "passthrough", "off", or empty to leave unchanged.
portconf_id string no “” _id of a port profile to apply, or empty to leave unchanged.
controller string no “default” Name of the UniFi controller to target. Defaults to "default".
dry_run boolean no false Preview the change without applying it. Returns the predicted change set.