90 lines
1.9 KiB
Markdown
90 lines
1.9 KiB
Markdown
|
|
# UniFi Utility Scripts
|
||
|
|
|
||
|
|
Utility scripts for common UniFi Controller operations.
|
||
|
|
|
||
|
|
## Available Scripts
|
||
|
|
|
||
|
|
### `list-sites.sh`
|
||
|
|
List all sites in the UniFi Controller.
|
||
|
|
|
||
|
|
**Usage:**
|
||
|
|
```bash
|
||
|
|
./scripts/unifi/list-sites.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
### `check-health.sh`
|
||
|
|
Check UniFi controller health and connectivity.
|
||
|
|
|
||
|
|
**Usage:**
|
||
|
|
```bash
|
||
|
|
./scripts/unifi/check-health.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
This script:
|
||
|
|
- Verifies configuration in `~/.env`
|
||
|
|
- Tests controller connectivity
|
||
|
|
- Tests API connection
|
||
|
|
- Displays site information
|
||
|
|
|
||
|
|
### `list-devices.sh`
|
||
|
|
Placeholder script for listing devices (currently not available in Official API).
|
||
|
|
|
||
|
|
**Usage:**
|
||
|
|
```bash
|
||
|
|
./scripts/unifi/list-devices.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
### `test-integration.sh`
|
||
|
|
Test suite to verify UniFi integration components are properly set up.
|
||
|
|
|
||
|
|
**Usage:**
|
||
|
|
```bash
|
||
|
|
./scripts/unifi/test-integration.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
This script verifies:
|
||
|
|
- Package builds
|
||
|
|
- Configuration
|
||
|
|
- Script executability
|
||
|
|
- Documentation
|
||
|
|
- API connection (if configured)
|
||
|
|
|
||
|
|
### `check-networks.sh`
|
||
|
|
Check UniFi networks/VLANs configuration (requires Private API mode).
|
||
|
|
|
||
|
|
**Usage:**
|
||
|
|
```bash
|
||
|
|
./scripts/unifi/check-networks.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
**Note:** Requires Private API mode and a non-2FA account. If your account has 2FA/SSO enabled, this script will not work. Use the web interface instead.
|
||
|
|
|
||
|
|
**Requirements:**
|
||
|
|
- `UNIFI_API_MODE=private` in `~/.env`
|
||
|
|
- `UNIFI_USERNAME` and `UNIFI_PASSWORD` set
|
||
|
|
- Account must NOT have 2FA/SSO enabled
|
||
|
|
|
||
|
|
## Requirements
|
||
|
|
|
||
|
|
- UniFi configuration in `~/.env`
|
||
|
|
- Node.js and pnpm installed
|
||
|
|
- Python3 (for JSON formatting, optional)
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
Ensure your `~/.env` file contains:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
UNIFI_UDM_URL=https://your-udm-ip
|
||
|
|
UNIFI_API_MODE=official
|
||
|
|
UNIFI_API_KEY=your-api-key
|
||
|
|
UNIFI_SITE_ID=default
|
||
|
|
UNIFI_VERIFY_SSL=false
|
||
|
|
```
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
|
||
|
|
- Scripts use `NODE_TLS_REJECT_UNAUTHORIZED=0` for self-signed certificates
|
||
|
|
- For production, install proper SSL certificates and remove this workaround
|
||
|
|
- Some endpoints may only be available in Private API mode
|