Skip to content

Turn detections on and off without rewriting their settings - #162

Open
baylanger wants to merge 1 commit into
mezz64:masterfrom
baylanger:detections
Open

baylanger wants to merge 1 commit into
mezz64:masterfrom
baylanger:detections

Conversation

@baylanger

Copy link
Copy Markdown
Contributor

get_event_states() and set_event_enabled() went through request(), which turns the document into a dict and back: a write could change the regions and lines of a detection. They also took any error as "not there", a rejected password included, so a caller kept sending it for every detection; and a 403 notSupport, what cameras answer for the detections they lack, read as an authentication error.

  • ISAPIClient.get_detection_enabled(detection, channel=1) and set_detection_enabled(detection, enabled, channel=1) read and write only the enabled flag below the document's root, as text: the rest is sent back as read, and nothing is sent when it is already so.
  • A detection the device does not have raises ISAPINotSupportedError (404, 501, notSupport, invalidOperation, also with a 403). 401 and any other 403 raise ISAPIAuthError.
  • DETECTIONS lists the eight of a video channel; videoLoss is added to EVENT_ENDPOINTS.
  • get_event_states() and set_event_enabled() use them. get_event_states() stops on rejected credentials; set_event_enabled() raises when the device refuses the change.

Claude AI tool was used to help write this change.

get_event_states() and set_event_enabled() went through request(), which
turns the document into a dict and back: a write could change the regions
and lines of a detection. They also took any error as "not there", a rejected
password included, so a caller kept sending it for every detection; and a
403 notSupport, what cameras answer for the detections they lack, read as an
authentication error.

- ISAPIClient.get_detection_enabled(detection, channel=1) and
  set_detection_enabled(detection, enabled, channel=1) read and write only
  the enabled flag below the document's root, as text: the rest is sent back
  as read, and nothing is sent when it is already so.
- A detection the device does not have raises ISAPINotSupportedError (404,
  501, notSupport, invalidOperation, also with a 403). 401 and any other 403
  raise ISAPIAuthError.
- DETECTIONS lists the eight of a video channel; videoLoss is added to
  EVENT_ENDPOINTS.
- get_event_states() and set_event_enabled() use them. get_event_states()
  stops on rejected credentials; set_event_enabled() raises when the device
  refuses the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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