Skip to main content

A loose python wrapper around the ZoneMinder REST API.

Project description

zm-py

image

Python package

image

license

A lightweight Python API client for ZoneMinder, built specifically for the Home Assistant ZoneMinder integration.

The official Home Assistant ZoneMinder component depends on zm-py==0.5.4. Active development of the integration has moved to nabbi/ha-zoneminder; it is unknown if or when those changes will be submitted back to HA core.

Project Status

This project is in maintenance mode. zm-py provides the limited set of ZoneMinder API interactions that Home Assistant needs (monitors, camera streaming, events, sensors, and switches). Bug fixes and compatibility updates are accepted; new feature development is not planned.

Not pyzm / pyzm2

zm-py is not a general-purpose ZoneMinder Python library. For full-featured ZoneMinder API access, see pyzm or its fork pyzm2. zm-py covers only the subset of the ZoneMinder API required by Home Assistant and carries no heavy dependencies. Replacing zm-py with pyzm or pyzm2 would require significant refactoring of the HA integration due to dependency conflicts and functional differences.

Origins

zm-py is based on code that was originally part of Home Assistant. Historical sources and authorship information is available as part of the Home Assistant project:

Documentation

Installation

PyPI

pip install zm-py

Usage

from zoneminder.zm import ZoneMinder

SERVER_HOST = "{{host}}:{{port}}"
USER = "{{user}}"
PASS = "{{pass}}"
SERVER_PATH = "{{path}}"

zm_client = ZoneMinder(
    server_host=SERVER_HOST,
    server_path=SERVER_PATH,
    username=USER,
    password=PASS,
    verify_ssl=False,
    stream_scale=50,       # optional: scale streams to 50%
    stream_maxfps=5.0,     # optional: cap MJPEG at 5 FPS
)

# Zoneminder authentication
zm_client.login()


# Get all monitors
monitors = zm_client.get_monitors()

for monitor in monitors:
    print(monitor)

>>> Monitor(id='monitor_id', name='monitor_name', controllable='is_controllable')


# Move camera down
controllable_monitors = [m for m in monitors if m.controllable]

for monitor in controllable_monitors:
    zm_client.move_monitor(monitor, "right")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zm_py-0.5.6.dev1.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zm_py-0.5.6.dev1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file zm_py-0.5.6.dev1.tar.gz.

File metadata

  • Download URL: zm_py-0.5.6.dev1.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.0 Linux/6.12.58-gentoo-x86_64

File hashes

Hashes for zm_py-0.5.6.dev1.tar.gz
Algorithm Hash digest
SHA256 c350331e5b2dbe2f30801da7f97fbc189a71091e8f62f0c65b38a9df52fe4100
MD5 365306843b9ba5d32e9376af73ef3cad
BLAKE2b-256 27166d842de35760823ba9e11977fe1a541eb404c0f53ebb901079ff68aaed2a

See more details on using hashes here.

File details

Details for the file zm_py-0.5.6.dev1-py3-none-any.whl.

File metadata

  • Download URL: zm_py-0.5.6.dev1-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.0 Linux/6.12.58-gentoo-x86_64

File hashes

Hashes for zm_py-0.5.6.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 9610256ff14746271bf8a5192495726d5f9e7a0b2f00245b48f8747a70786179
MD5 95755d7bb8360b5479c9512443b467fd
BLAKE2b-256 b228529a52c1324a52d0cdee47a03ca7a0e65e6b2a10fdb88c6ba18db36d40fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page