Unifi
@mgreten/unifiv2026.05.18.1
01README
Manage a Ubiquiti UniFi Dream Machine (UDM / UDM Pro / UDM SE) via the legacy Network firewall API: firewall groups, firewall rules, clients, 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, and toggle rule state.
02Models
@mgreten/unifi/clientv2026.05.18.1client.ts
fn sync(activeOnly: boolean)
List all known clients (active + configured) and store one data per client.
| Argument | Type | Description |
|---|---|---|
| activeOnly | boolean | If true, only fetch currently-connected clients (/stat/sta). |
Resources
client(infinite)— A client (device) known to the UniFi controller.
@mgreten/unifi/firewall-groupv2026.05.18.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.05.18.3firewall_rule.ts
fn sync(ruleset?: string)
List all firewall rules on the controller and store one data per rule (factory).
| Argument | Type | Description |
|---|---|---|
| ruleset? | string | Filter 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.
| Argument | Type | Description |
|---|---|---|
| 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 |
fn delete(id: string)
Delete a firewall rule by id on the UDM. Local data for the rule is not removed
| Argument | Type | Description |
|---|---|---|
| id | string |
Resources
rule(infinite)— A UniFi legacy firewall rule.
@mgreten/unifi/networkv2026.05.18.1network.ts
fn sync()
List all configured networks and store one data per network (factory).
Resources
network(infinite)— A configured UniFi network (VLAN/subnet).
03Stats
A
100 / 100
Downloads
1
Archive size
15.1 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types1/1earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
04Platforms