You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Revised the README.md to enhance clarity on integration features and usage, including a new section on advanced automations.
- Updated the features list to provide a more detailed overview of supported rules and configurations.
- Removed the `reset_rate_limit` service from services.yaml and its implementation in system_services.py to streamline functionality.
- Added examples for using services in Home Assistant to improve user guidance.
Copy file name to clipboardExpand all lines: README.md
+30-26Lines changed: 30 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,24 +10,27 @@
10
10
11
11
[](https://www.buymeacoffee.com/sirkirby)
12
12
13
-
UniFi Network Rules is a custom integration for Home Assistant that integrates with your UniFi Dream Machine/Router to both provide and help you create useful interactions and automations for your Home Lab. The goal of this integration is to simplify policy and rule management for real world use cases. I built this because I wanted to enable things like screen time controls for my kids, game server access controls, and more with the push of a button in Home Assistant. Functionality that can be shared with anyone in your home.
13
+
UniFi Network Rules is a custom integration for Home Assistant that integrates with your UniFi Dream Machine/Router to both provide and help you create useful interactions and automations for your Home Lab. The goal of this integration is to simplify policy and rule management for real world use cases. I built this because I wanted to unlock the power of my UniFi firewall. From simple things like screen time and game server access controls for my kids, to more advanced like getting notified when a critical rule is changed. And most importantly, make all of this easy to use and share with anyone in your home or home lab. I hope you find it useful!
14
14
15
-
## Features
15
+
## What this integration provides
16
16
17
-
- Switch entities for all rules, including firewall policies (zone-based firewall), traffic/firewall rules (non-zone-based firewall), forwarding rules, traffic routes.
18
-
- VPN management including both client and server configurations for OpenVPN and WireGuard.
19
-
- Service actions for full backup and restore of all rules that are managed by this integration.
20
-
- Service actions for batch enabling and disabling rules by pattern matching rule names or IDs.
21
-
- Service actions for deleting rules by ID.
22
-
- LED toggle switch for UniFi access points and other LED capable devices to control LED on/off.
17
+
### Switches for enabling and disabling rules and configuration
23
18
24
-
Request a feature [here](https://github.com/sirkirby/unifi-network-rules/issues).
### Advanced automations powered by [Custom Triggers](#real-time-triggers-) and [Custom Services](#services)
27
30
28
-
- A UniFi device running network application 9.0.92 or later.
29
-
- A local account with Admin privileges to the network application. Must not be a UniFi Cloud account.
30
-
- Home Assistant 2025.2 or later with network access to the UniFi device.
31
+
The included [Triggers](#real-time-triggers-) and [Services](#services) provide a framework for building custom UDM automations to cover a wide range of use cases. For example, you can [backup](#3-backup-trigger---save-config-on-important-changes) and [restore](#full-and-selective-restore) all rules when a change is detected, ensure game server port [forwarding rules get disabled](#2-game-server-management---auto-disable-after-hours) at bedtime, [create and maintain an audit log](#1-security-monitoring---alert-on-unexpected-rule-changes) of all UDM configuration changes, and so much more. Get inspired by the many examples below.
32
+
33
+
> Questions, ideas, help, or feedback? [Discussions](https://github.com/sirkirby/unifi-network-rules/discussions). Errors or bugs? [Issues](https://github.com/sirkirby/unifi-network-rules/issues).
31
34
32
35
## Installation
33
36
@@ -49,35 +52,35 @@ THEN
49
52
4. Search for "UniFi Network Rule Manager" and select it.
50
53
5. Enter credentials of a local admin user on your UDM and click on the "Submit" button.
51
54
55
+
### Requirements
56
+
57
+
- A UniFi device running network application 9.0.92 or later.
58
+
- A local account with Admin privileges to the network application. Must not be a UniFi Cloud account.
59
+
- Home Assistant 2025.2 or later with network access to the UniFi device.
60
+
52
61
## Configuration
53
62
54
-
**Host**: The IP address or hostname of your UniFi Device.
63
+
**Host**: The IP address or hostname of your UniFi Device. ex. `192.168.1.1` or `udm.mydomain.com`
55
64
56
-
**Username**: The local admin account on the UDM.
65
+
**Username**: The local admin account on the UDM. ex. `admin`
57
66
58
-
**Password**: The password for the UDM account.
67
+
**Password**: The password for the UDM account. ex. `password`
59
68
60
69
**Site**: The UniFi site name to connect to (defaults to "default" if not specified).
61
70
62
71
**Update Interval**: The automatic refresh interval in minutes. Can be longer since updates real-time.
63
72
64
73
**Verify SSL**: Enable SSL certificate verification (defaults to disabled for self-signed certificates).
65
74
66
-
## Usage
67
-
68
-
Once you have configured the integration, you will be able to see the policies, rules, and routes configured on your UniFi Network as switches in Home Assistant. Add the switch to a custom dashboard or use it in automations just like any other Home Assistant switch.
69
-
70
75
## Services
71
76
72
77
The integration provides several services focused on managing and automating existing UniFi Network rules:
73
78
74
79
### Getting Started with Services
75
80
76
-
There are two main ways to use these services in Home Assistant:
77
-
78
-
#### Method 1: Using an Input Button Helper with Automation
81
+
Here are some examples of how to get started with services in Home Assistant:
79
82
80
-
This is the simplest method:
83
+
#### Example 1: Using an Input Button Helper with Automation
81
84
82
85
1. Go to Settings → Devices & Services → Helpers
83
86
2. Add a Button helper (e.g., "Refresh UniFi Rules")
#### Method 2: Using Scripts with a Lovelace Button Card (More Customizable)
112
+
#### Example 2: Using Scripts with a Lovelace Button Card (More Customizable)
110
113
111
114
First, create a script in your Settings → Automations & Scenes → Scripts:
112
115
@@ -135,6 +138,8 @@ name: Backup my Network Rules
135
138
icon: mdi:cloud-upload
136
139
```
137
140
141
+
See below for more automation examples using [Services with Triggers](#service-automation-examples).
142
+
138
143
### Services Reference
139
144
140
145
| Service | Description | Parameters |
@@ -145,7 +150,6 @@ icon: mdi:cloud-upload
145
150
| `unifi_network_rules.bulk_update_rules` | Enable or disable multiple rules by name pattern | `state`: true (enable) or false (disable)<br>`name_filter`: String to match in rule names |
146
151
| `unifi_network_rules.delete_rule` | Delete an existing firewall policy by ID | `rule_id`: ID of the rule to delete |
147
152
| `unifi_network_rules.refresh_data` | Refresh data for a specific integration instance or all | `entry_id`: (Optional) Specific integration instance ID |
148
-
| `unifi_network_rules.reset_rate_limit` | Reset API rate limiting if you hit request limits | None |
149
153
| `unifi_network_rules.websocket_diagnostics` | Run diagnostics on WebSocket connections and try to repair if needed | None |
150
154
| `unifi_network_rules.force_cleanup` | Force cleanup of all entities in the integration | None |
151
155
| `unifi_network_rules.force_remove_stale` | Force removal of stale or broken entities | `remove_all`: (Optional) Remove all entities instead of just stale ones |
0 commit comments