Skip to content

Remove PTZ buttons for cameras that no longer report PTZ - #8

Open
jpettitt wants to merge 1 commit into
JoshADC:masterfrom
jpettitt:ptz-button-cleanup
Open

jpettitt wants to merge 1 commit into
JoshADC:masterfrom
jpettitt:ptz-button-cleanup

Conversation

@jpettitt

Copy link
Copy Markdown

The problem

Fixed cameras get a full set of PTZ buttons. SecuritySpy reports ptzcapabilities from the camera's driver profile, not a probe, so every Reolink or Dahua profile claims pan/tilt/zoom (61) whether or not the camera can move.

Cause

The integration already creates buttons only for a non-zero capability, and the right fix is at the source: ticking Disable PTZ in the camera's Device settings makes SecuritySpy report 0 (verified on 6.21). But buttons created earlier then linger in the entity registry as unavailable, and nothing removes them.

Fix

The button platform now removes registry entries for buttons an online camera no longer reports, at setup. Offline or vanished cameras keep theirs, so an outage can't delete entities and their customisations. Pure decision helper with tests, a README note on the SecuritySpy setting, and a changelog entry under an unreleased 1.4.3.

Tested on a live SecuritySpy 6.21 with HA 2026.9.0: 42 stale buttons removed across six cameras, the four still reporting PTZ untouched.

🤖 Generated with Claude Code

SecuritySpy reports ptzcapabilities from the driver profile, so fixed cameras
claim PTZ until "Disable PTZ" is ticked in their Device settings. Once it is,
the buttons stopped being created but lingered in the registry as unavailable.
Offline or vanished cameras keep theirs so an outage can't delete them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant