Skip to main content

Unifi

@mgreten/unifiv2026.08.03.1· 19d agoMODELS
01README

Manage a Ubiquiti UniFi Dream Machine (UDM / UDM Pro / UDM SE) via the legacy Network API: firewall groups, firewall rules, clients, PoE device restarts, IDS/IPS event investigation, and networks. Complements @stack72/ubiquity (which focuses on traffic collection) by enabling configuration-as-data workflows: sync existing groups/rules into the swamp data model, reconcile group membership, create or delete firewall rules, toggle rule state, safely power-cycle a wired client's resolved switch port, and retrieve the best available raw record for a security event.

02Release Notes

Add exact UniFi IDS/IPS event investigation across Network 10.x traffic flows and system logs plus the legacy IDS endpoint. Preserve matched raw records, paginate supported APIs, tolerate unsupported endpoints, and distinguish incomplete searches from definitive absence.

03Models4
@mgreten/unifi/clientv2026.08.03.1client.ts
fn sync(activeOnly: boolean)
List all known clients (active + configured) and store one data per client.
ArgumentTypeDescription
activeOnlybooleanIf true, only fetch currently-connected clients (/stat/sta).
fn investigateThreat(flowId: string, sourceIp?: string, destinationIp?: string)
Locate an IDS/IPS event by exact UniFi event, flow, or initiator reference and store the best available raw record.
ArgumentTypeDescription
flowIdstringExact UniFi event, flow, or initiator reference ID
sourceIp?stringOptional source IP used to narrow the traffic-flow query
destinationIp?stringOptional destination IP used to narrow the traffic-flow query

Resources

client(infinite)— A client (device) known to the UniFi controller.
power_cycle(infinite)— An accepted UniFi PoE power-cycle action and its resolved client/switch topology.
threat_event(infinite)— A matched UniFi IDS/IPS record, including its source endpoint and exact identifier field.
@mgreten/unifi/firewall-groupv2026.08.03.1firewall_group.ts
fn sync()
List all firewall groups on the controller and store one data per group (factory).

Resources

group(infinite)— A UniFi firewall group (address/port group).
@mgreten/unifi/firewall-rulev2026.08.03.1firewall_rule.ts
fn sync(ruleset?: string)
List all firewall rules on the controller and store one data per rule (factory).
ArgumentTypeDescription
ruleset?stringFilter by ruleset, e.g. LAN_IN, LAN_OUT, WAN_OUT, WAN_LOCAL
fn create(name: string, ruleset: enum, action: enum, protocol: string, enabled: boolean, logging: boolean, rule_index?: number, src_firewallgroup_ids: array, dst_firewallgroup_ids: array, src_address: string, dst_address: string, src_networkconf_id: string, dst_networkconf_id: string, src_port: string, dst_port: string, state_new: boolean, state_established: boolean, state_invalid: boolean, state_related: boolean)
Create a new firewall rule. rule_index is auto-assigned (next free index in the ruleset) when omitted.
ArgumentTypeDescription
namestring
rulesetenum
actionenum
protocolstring
enabledboolean
loggingboolean
rule_index?number
src_firewallgroup_idsarray
dst_firewallgroup_idsarray
src_addressstring
dst_addressstring
src_networkconf_idstring
dst_networkconf_idstring
src_portstring
dst_portstring
state_newboolean
state_establishedboolean
state_invalidboolean
state_relatedboolean
fn delete(id: string)
Delete a firewall rule by id on the UDM. Local data for the rule is not removed
ArgumentTypeDescription
idstring

Resources

rule(infinite)— A UniFi legacy firewall rule.
@mgreten/unifi/networkv2026.08.03.1network.ts
fn sync()
List all configured networks and store one data per network (factory).

Resources

network(infinite)— A configured UniFi network (VLAN/subnet).
04Previous Versions6
2026.07.27.1

Modified 1 models

2026.07.22.1

Add TOTP authentication support for MFA-enabled UniFi accounts.

2026.07.16.1

Rebuild against swamp CLI 20260716

2026.06.27.2
2026.06.27.1
2026.05.18.1
05Stats
A
100 / 100
Downloads
10
Archive size
32.4 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms