Skip to content

0.5.0

Choose a tag to compare

@mezz64 mezz64 released this 17 Nov 03:02
· 13 commits to master since this release

The main addition in 0.5.0 is support for reading and changing camera image settings over ISAPI, on cameras and on NVR-attached cameras. It also fixes several alert stream and event problems and needs Python 3.10 or newer.

Breaking changes

  • Python 3.10 or newer is required. Python 3.9 support is dropped. (#146)
  • xmltodict is now a required dependency. The new ISAPI code needs it, and it was previously missing from install_requires. (#156)
  • HikCamera.fetch_namespace() and HikCamera.namespace are removed. XML elements are now matched in any namespace, so there is nothing left to detect. element_query() and element_text() still accept their context argument, but they ignore it. (#144)

New: image settings over ISAPI

Developed in #140 by @baylanger.

  • Discovery. ISAPIClient.get_image_settings() lists each adjustable image setting on a channel: shutter, gain, WDR, BLC, day/night, white balance and others. Each one has its type (switch, select or number), its current value and its allowed options or range. The list is built from what each model reports, so it differs from device to device. (#142)

  • Writes with conflict resolution. These methods each return an ImageWriteResult:

    • set_image_setting(): changes one setting.
    • set_image_linked_setting(): changes a mode tied to an enabled flag, such as BLC or HLC.
    • put_image_settings(): sends several values in one request.

    When the camera refuses a change because another setting is in the way (for example, WDR and HLC exclude each other), pyhik switches that setting off and retries. It lists what it changed in also_changed. (#143)

  • NVR-attached cameras. get_image_channels() lists the image channels a device accepts. All image methods take proxy=True to reach a camera behind an NVR through /ISAPI/ContentMgmt/ImageProxy. (#151)

  • Raw requests. ISAPIClient.request_raw() sends a body exactly as given and returns the status, raw bytes and headers without raising on HTTP errors. Some endpoints reject re-serialized XML, so the new image writes need this. (#141)

Event stream and devices

  • Alert, trigger, device info and motion detection XML is now matched in any namespace. This ends a long run of devices whose events went missing because they used an XML namespace pyhik didn't expect. (#144)
  • The watchdog no longer resets a healthy stream 300 s after the device ends it normally. A timer from the previous connection was left running. (#150, fixes #149)
  • When /ISAPI/Event/triggers fails, pyhik falls back to /ISAPI/Event/triggersCap. This fixes cameras without storage that answer the triggers endpoint with HTTP 500 and so got no event sensors. (#145, @ptarjan)
  • The alert stream is skipped on the DS-KV8113-WME1(B) door station on firmware V2.2.53 (build 230918). That firmware returns an empty stream and closes it, which caused endless reconnects. (#136, @pgrudzin)
  • With debug logging on, an alert packet that carries no event type is now logged raw, once per root tag and capped at 1000 characters, to help diagnose devices that send packets pyhik can't match. (#139, @ptarjan)

Other fixes

  • HikCamera.auth_failed is True when the device rejected the credentials, so callers can tell a wrong password apart from an unreachable device. (#153, @baylanger)
  • Motion detection is no longer reported as changed when the camera refused the change. (#147, @baylanger)
  • get_video_channels() accepts verify_ssl, so NVRs that use a self-signed HTTPS certificate can list their channels. (#155, @baylanger)

Thanks to @baylanger, @ptarjan and @pgrudzin for their contributions to this release.

Full changelog: 0.4.8...0.5.0