Skip to content

Commit d77bbf5

Browse files
committed
Update README to reflect added firmware update information and new service for removing stale clients
1 parent 870559e commit d77bbf5

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ Home Assistant custom integration for UniFi Network that uses UniFi's official I
99
- Automatic device and client discovery with pagination support
1010
- Selective feature enabling (devices and/or clients)
1111
- Entity categories appropriately marked as Diagnostic or Config
12-
- Three platforms:
13-
- **device_tracker** - Presence detection
14-
- **sensor** - Monitoring and diagnostics
15-
- **button** - Device controls
12+
- Service for cleaning up stale client devices from device registry
13+
- Four platforms:
14+
- **device_tracker** - Presence detection for clients
15+
- **sensor** - Monitoring and diagnostics for devices
16+
- **button** - Device and port controls
17+
- **update** - Firmware update information
1618

1719
### Entities created
1820

1921
#### Device Trackers
2022

21-
- **UniFi Client Tracker**: Reports `home` when client is currently connected, `not_home` otherwise. Attributes include IP address, MAC address, last seen timestamp, connected at timestamp (when available), and `source_type=router`.
23+
- **UniFi Client Tracker**: Reports `home` when client is currently connected, `not_home` otherwise. Attributes include IP address, MAC address, last seen timestamp, connected at timestamp (when available), and `source_type=router`. Automatically created for all discovered clients when client tracking is enabled.
2224

2325
#### Device Sensors
2426

@@ -47,6 +49,14 @@ Home Assistant custom integration for UniFi Network that uses UniFi's official I
4749
- **PoE Port Power Cycle** (per device, per PoE-capable port): Triggers power cycle action on PoE ports. Button is automatically available only for ports with PoE capability.
4850
- **Restart Device** (per device): Triggers a restart action on the device. Button is only available when device is online.
4951

52+
#### Update Entities
53+
54+
- **Firmware Update** (per device): Shows current firmware version and indicates if firmware updates are available. Displays "Unknown" for latest version when an update is available (UniFi API doesn't provide specific version information). Note: Firmware installation through Home Assistant is not supported - use the UniFi Network Application for updates.
55+
56+
#### Services
57+
58+
- **Remove Stale Clients** (`unifi_network.remove_stale_clients`): Removes devices from the Home Assistant device registry that are no longer in the known clients or devices list. Useful for cleaning up devices that were previously tracked but are no longer present in the UniFi network. Can target specific config entries or process all UniFi Network integrations.
59+
5060
**Update interval**: 30 seconds by default.
5161

5262
### Future Capabilities
@@ -93,11 +103,11 @@ Manual install:
93103
3. **Site Selection**: Choose which UniFi site to monitor from the automatically discovered list.
94104

95105
4. **Feature Selection**: Choose which features to enable:
96-
- **Track Devices**: Monitor UniFi network infrastructure devices (switches, access points, gateways, etc.)
97-
- **Track Clients**: Monitor connected client devices (computers, phones, IoT devices, etc.)
106+
- **Unifi Devices sensors and actions**: Monitor UniFi network infrastructure devices (switches, access points, gateways, etc.) with comprehensive sensors, buttons, and firmware update information
107+
- **Track Clients**: Monitor connected client devices (computers, phones, IoT devices, etc.) with device tracker entities
98108
- You can enable one or both features based on your monitoring needs
99109

100-
The integration will automatically discover all devices and clients using API pagination to ensure complete coverage. Entities are created dynamically based on device capabilities (e.g., PoE sensors and buttons only appear for ports with PoE support).
110+
The integration will automatically discover all devices and clients using API pagination to ensure complete coverage. Entities are created dynamically based on device capabilities (e.g., PoE sensors and buttons only appear for ports with PoE support, radio sensors only for devices with wireless radios).
101111

102112
## Notes and troubleshooting
103113

@@ -106,27 +116,30 @@ The integration will automatically discover all devices and clients using API pa
106116
- **Presence Detection Logic**:
107117
- **Clients**: Present in connected clients list → `home`, otherwise → `not_home`
108118
- **Dynamic Entity Creation**:
109-
- Radio sensors only appear for devices that expose radio interface statistics
110-
- Port sensors are created for all physical ports on devices with port interfaces
119+
- Radio sensors only appear for devices that expose radio interface statistics (Access Points, Gateways with Wi-Fi)
120+
- Port sensors are created for all physical ports on devices with port interfaces (Switches, Gateways)
111121
- PoE sensors and buttons only appear for ports with PoE capability
112-
- Client trackers are created for all connected clients
122+
- Client trackers are created for all connected clients and automatically updated as new clients connect
123+
- Update entities show firmware information for all devices with available firmware data
113124
- **Device Capabilities**: Different UniFi devices expose different sensor sets based on their hardware capabilities (e.g., switches vs access points vs gateways).
114125
- **Entity Organization**:
115126
- Device entities are grouped under their respective UniFi device in the Device Registry
116127
- Client entities are grouped under their respective client device
117128
- All entities use the device/client name as the device name with specific sensor names
118129
- Entity categories are set appropriately (Diagnostic for monitoring, Config for controls)
130+
- **Service Usage**: Use the `unifi_network.remove_stale_clients` service to clean up the device registry when clients are no longer present in your network
119131

120132
## Development
121133

122134
### Project Structure
123135

124136
- **`unifi_network/`**: Main integration code
125137
- Core integration logic, coordinators, and entity platforms
126-
- Entity platforms: `device_tracker.py`, `sensor.py`, `button.py`
138+
- Entity platforms: `device_tracker.py`, `sensor.py`, `button.py`, `update.py`
127139
- Configuration flow: `config_flow.py`
128140
- Data coordinators: `coordinator.py`
129141
- Device/client wrappers: `unifi_device.py`, `unifi_client.py`
142+
- Services: `services.py` (stale client cleanup)
130143

131144
- **`unifi_network/api_client/`**: Generated API client (excluded from linting/formatting)
132145
- Auto-generated from UniFi Network Integration API OpenAPI specification
@@ -140,8 +153,9 @@ The integration will automatically discover all devices and clients using API pa
140153
### Configuration
141154

142155
- **Update interval**: Controlled by `DEFAULT_UPDATE_INTERVAL` in `const.py` (30 seconds)
143-
- **Platforms**: Defined in `PLATFORMS` in `const.py` (sensor, device_tracker, button)
156+
- **Platforms**: Defined in `PLATFORMS` in `const.py` (sensor, device_tracker, button, update)
144157
- **Domain**: `unifi_network`
158+
- **Services**: `remove_stale_clients` for device registry cleanup
145159

146160
### Local Development
147161

0 commit comments

Comments
 (0)