set_device_port
Set a UniFi switch port's native VLAN, PoE mode, name, or enabled state. Requires confirmation before applying to avoid disrupting connected devices.
Instructions
Configure a single switch port: native VLAN, PoE mode, name, or enable state.
Mutating operation: applied immediately and persisted on the console, changing untagged VLAN traffic, PoE delivery, or link state on that port. Only the fields you provide change. Requires confirm=true because a port change can disrupt connectivity for the attached device or downstream network. Use get_device_ports first to find the port_idx and current values.
Args: mac: Device MAC address (case-insensitive; aa:bb:cc:dd:ee:ff or aabbccddeeff). port_idx: Port number to configure (1-based; e.g. 1-24 or SFP 25/26). name: Optional custom port name (e.g. "Cameras"). native_network: Optional network or VLAN name (or its ID) to set as the port's native/untagged VLAN. poe_mode: Optional PoE mode - "auto", "on", "off", or "passv24". forward: Optional VLAN forwarding - "all" (every VLAN) or "customize". enabled: Optional port enable state; True connects, False disables. site: Site to operate on. Defaults to "default". device: Optional device name to target a specific console; omit for default. confirm: Must be True to apply the port change. Defaults to False.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mac | Yes | Device MAC address (case-insensitive; aa:bb:cc:dd:ee:ff or aabbccddeeff). | |
| name | No | Optional custom port name (e.g. "Cameras"). | |
| site | No | Site to operate on. Defaults to "default". | default |
| device | No | Optional device name to target a specific console; omit for default. | |
| confirm | No | Must be True to apply the port change. Defaults to False. | |
| enabled | No | Optional port enable state; True connects, False disables. | |
| forward | No | Optional VLAN forwarding - "all" (every VLAN) or "customize". | |
| poe_mode | No | Optional PoE mode - "auto", "on", "off", or "passv24". | |
| port_idx | Yes | Port number to configure (1-based; e.g. 1-24 or SFP 25/26). | |
| native_network | No | Optional network or VLAN name (or its ID) to set as the port's native/untagged VLAN. |