Repository navigation
Remove PTZ buttons for cameras that no longer report PTZ - #8
Conversation
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>
|
Sorry for the slow reply on this one — it sat longer than it should have. Merged, and I like that it only removes buttons for cameras that are online right now. That's the line I care about. One question before it goes into a release: have you ever seen SecuritySpy briefly report a PTZ capability of 0 for an online camera, for example just after a SecuritySpy restart? Back in April I decided against automatically removing cameras that drop out of SecuritySpy, because a glitch could wipe out people's renamed entities. If PTZ capability only comes from the driver profile, I think we're fine. If it can blip, I'd want a guard before 1.4.3. I'll tidy the extra changelog blank line myself. And thanks for the heads-up on the Validate topics back on #7. I added them the next day and it's been green since; I just never said so. |
|
I have seen it but only for camera where I hadn't gone into the advanced setting and turned off PTZ on my Reolink Duo cameras that don't PTZ. That's what prompted this - auto clean if the user turns off PTZ in SecuritySpy. |
The problem
Fixed cameras get a full set of PTZ buttons. SecuritySpy reports
ptzcapabilitiesfrom 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