Skip to content

UniFi Network: extend telemetry-gap preservation to other sensor types after controller updates or restarts #185638

Description

@jimstrang

The problem

@Kane610, this appears to be the broader telemetry-dependent sensor problem we discussed in #184231.

In that discussion, I suggested keeping the UPS fix focused and addressing recovery for other telemetry-based sensors separately. I now have a reproducible case affecting PDU aggregate power and device CPU/memory sensors.

A controller update or Network application restart creates an offline window during which HA logs HTTP 502/503 errors and WebSocket reconnection failures. After reconnection, previously discovered sensors are deleted from both HA's state machine and entity registry. The controller subsequently resumes reporting their telemetry, but the entities do not recover automatically.

I observed this during a controller update and reproduced it by stopping the Network application for approximately one minute, then starting it again. Neither case involved a gateway or device reboot.

The original incident deleted 30 sensors within approximately 100 milliseconds:

Models Deleted sensors Count
USP-PDU-Pro Aggregate power consumption, power budget, CPU and memory utilization 4
UPS-2U-Pro CPU and memory utilization 2
U7-Pro x3, U7-Outdoor x2 CPU and memory utilization 10
USW-Aggregation, USW-Pro-24-PoE, USW-Flex CPU and memory utilization 6
US-8 x3 CPU and memory utilization 6
U5G Backup CPU and memory utilization 2

What version of Home Assistant Core has the issue?

core-2026.10.0

What was the last working version of Home Assistant Core?

Unknown.

What type of installation are you running?

Home Assistant OS

Integration causing the issue

UniFi Network

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifi/

Diagnostics information

The exact triggering controller payload was not captured. The controller outage and subsequent deletions are confirmed, but whether the triggering device data arrived through polling or a WebSocket update remains unverified.

Anything in the logs that might be useful for us?

During the offline window, HA logged these errors (controller address omitted):

Server handshake error connecting to UniFi websocket:
502, message='Invalid response status'

Server handshake error connecting to UniFi websocket:
503, message='Invalid response status'

Websocket setup failed

aiounifi.errors.BadGateway:
.../proxy/network/v2/api/site/default/firewall-policies received 502 bad gateway

aiounifi.errors.ServiceUnavailable:
.../proxy/network/v2/api/site/default/firewall-policies received 503 service unavailable

Additional information

UniFi Network version: 11.0.83, running on a UCG-Fiber.

Relationship to the UPS fix

#184231 worked as intended: the UPS battery-pool sensors remained registered through the same incident. UPS-2U-Pro output power briefly reported unknown, then recovered automatically when telemetry returned.

The sensors deleted here use other support checks:

  • PDU aggregate-power support depends on the current outlet_ac_power_budget value being non-null.
  • CPU/memory support depends on the current system-stats fields being present.
  • The shared entity update path removes the entity and its registry entry when a support check becomes false.
  • Discovery listens for device-added events, so ordinary updates containing restored telemetry do not recreate the deleted entities.

This appears to conflate temporarily absent telemetry with permanent loss of sensor capability.

Proposed direction

I will take a stab at implementing a shared fix and submit a PR, extending the preservation principle from #184231 to all telemetry-dependent UniFi sensor types rather than adding separate preservation logic for each type.

Once a sensor has been discovered, a temporary missing/null field should not delete it or its registry entry. It should report unknown or unavailable as appropriate and recover when telemetry returns, while preserving entity IDs and customizations.

Genuine device removal should still remove entities. Initial discovery should continue to require evidence that the device supports the sensor; this should not create unsupported sensors on every device.

Activity

  1. home-assistant commented on Oct 10, 2026

    @home-assistant
    Contributor

    Hey there @Kane610, mind taking a look at this issue as it has been labeled with an integration (unifi) you are listed as a code owner for? Thanks!

    Code owner commands

    Code owners of unifi can trigger bot actions by commenting:

    • @home-assistant close Closes the issue.
    • @home-assistant rename Awesome new title Renames the issue.
    • @home-assistant reopen Reopen the issue.
    • @home-assistant unassign unifi Removes the current integration label and assignees on the issue, add the integration domain after the command.
    • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the issue.
    • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the issue.

    (message by CodeOwnersMention)


    @jimstrang Thanks for reporting this issue!

    Before we dive in, please make sure this isn't a duplicate by searching through existing issues. Also check recently closed issues, as your problem might already be fixed but not yet released.

    https://github.com/home-assistant/core/issues?q=%20label%3A%22integration%3A%20unifi%22%20
    (message by IssueContext)


    unifi documentation
    unifi source
    (message by IssueLinks)

  2. jimstrang commented on Oct 10, 2026

    @jimstrang
    ContributorAuthor

    I think I can largely fix this gap on the HA side (PR forthcoming) but there is a separate aiounifi limitation: missing or empty port/outlet tables retain old subdevice objects and readings, while null tables are not safely handled. I plan to keep that out of this PR and address it in a library follow-up. This fix can stand independently without an aiounifi dependency bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions