Skip to content

Commit 3ac2818

Browse files
pliablepixelsclaude
andcommitted
docs: clarify Path 1 vs Path 2 notification capabilities across all docs
Path 1 now supports direct FCM push notifications (ZM 1.39.2+), but the docs still described it as "detection only" with "no notifications" in multiple places. This updates all references to accurately reflect both paths: feature table, principles, install guides, hooks, and FAQ. Also adds push testing instructions to install_path1 Step 5 so users can find them when following the Path 1 setup flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d790632 commit 3ac2818

7 files changed

Lines changed: 74 additions & 27 deletions

File tree

docs/guides/_feature_table.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- |yes|
2222
- |yes|
2323
* - Push notifications (iOS/Android via FCM)
24-
- |no|
24+
- |opt| :sup:`1`
2525
- |yes|
2626
* - WebSocket notifications
2727
- |no|
@@ -43,4 +43,9 @@
4343
- |yes|
4444

4545
.. |yes| unicode:: U+2714 .. heavy checkmark
46+
.. |opt| unicode:: U+2714 .. heavy checkmark
4647
.. |no| unicode:: U+2014 .. em dash
48+
49+
:sup:`1` Path 1 push requires ZM 1.39.2+ and ``push.enabled: "yes"`` in ``objectconfig.yml``.
50+
Devices register tokens via the ZM Notifications REST API (not ``tokens.txt``).
51+
See :ref:`push_config` for setup.

docs/guides/hooks.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Machine Learning Hooks
44
.. note::
55

66
This page covers the ML detection pipeline, which is required for **both**
7-
Path 1 (detection only) and Path 2 (full ES).
7+
Path 1 (detection + optional push) and Path 2 (full ES).
88
For installation instructions, see :doc:`installation`.
99
The hooks use `pyzm <https://pyzmv2.readthedocs.io/en/latest/>`__ v2
1010
for detection. Make sure you have ``pyzm`` installed before proceeding.
@@ -48,10 +48,10 @@ connects to ZoneMinder, downloads event frames, runs the ML detection pipeline
4848

4949
.. _path1_setup:
5050

51-
Path 1: Detection only (no ES)
52-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51+
Path 1: Detection + optional push (no ES)
52+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5353

54-
**Requires ZM 1.37+.** ZoneMinder can call ``zm_detect.py`` directly via its
54+
**Requires ZM 1.38.1+.** ZoneMinder can call ``zm_detect.py`` directly via its
5555
Event Start Command feature — no Event Server needed.
5656

5757
Configure per monitor in ZM: go to the monitor's **Config -> Recording** tab and set:

docs/guides/hooks_faq.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ Machine Learning Hooks FAQ
44
How do the hooks actually invoke object detection?
55
-----------------------------------------------------
66

7-
* When the Event Notification Server detects an event, it invokes the script specified in ``event_start_hook`` in your ``zmeventnotification.yml``. This is typically ``/var/lib/zmeventnotification/bin/zm_event_start.sh``
7+
There are two paths:
88

9-
* ``zm_event_start.sh`` in turn invokes ``zm_detect.py`` that does the actual machine learning. Upon exit, it returns ``0`` (success) meaning an object was found, or ``1`` (failure) meaning nothing was detected. Based on how you have configured your settings, this information is then stored in ZM and/or pushed to your mobile device as a notification.
9+
**Path 1 (no ES):** ZoneMinder calls ``zm_detect.py`` directly via ``EventStartCommand``. The script runs ML detection and writes results back to the event. If ``push.enabled`` is ``yes`` in ``objectconfig.yml`` (requires ZM 1.39.2+), it also sends FCM push notifications directly to registered devices.
10+
11+
**Path 2 (full ES):** The Event Notification Server detects an event and invokes the script specified in ``event_start_hook`` in ``zmeventnotification.yml`` (typically ``/var/lib/zmeventnotification/bin/zm_event_start.sh``). That script in turn invokes ``zm_detect.py`` for the actual machine learning. Upon exit, it returns ``0`` (success) meaning an object was found, or ``1`` (failure) meaning nothing was detected. The ES then decides whether to send notifications based on your channel configuration.
1012

1113

1214
Necessary Reading - Sample Config Files

docs/guides/install_path1.rst

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
Path 1: Detection Only (no ES)
2-
==============================
1+
Path 1: Detection + Optional Push (no ES)
2+
==========================================
33

44
Use ZoneMinder's ``EventStartCommand`` to run ML detection directly — no Event Server needed.
55
Requires **ZM 1.38.1 or above**.
66

7-
Push notifications are supported directly via ``zm_detect`` (see the ``push`` section
8-
in ``objectconfig.yml`` and :ref:`push_config`). If you also want WebSockets or MQTT,
9-
see :doc:`install_path2`.
7+
**Push notifications** are supported directly from ``zm_detect`` — no ES required.
8+
Configure the ``push`` section in ``objectconfig.yml`` (see :ref:`push_config`).
9+
Requires **ZM 1.39.2+** (which adds the Notifications REST API for token storage).
10+
11+
If you also want WebSocket notifications, MQTT, notification rules/muting, or the
12+
ES control interface, see :doc:`install_path2`.
1013

1114
.. important::
1215

@@ -180,6 +183,25 @@ Then test detection (``--config`` defaults to ``/etc/zm/objectconfig.yml``):
180183
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py \
181184
--file /tmp/bird.jpg --debug
182185
186+
**Testing push notifications (Path 1 direct push):**
187+
188+
If you have ``push.enabled: "yes"`` in ``objectconfig.yml`` and devices have registered
189+
tokens via the ZM Notifications API, you can test push delivery from the command line.
190+
Use ``--file`` with ``--eventid`` and ``--monitorid`` to trigger push without a live event.
191+
The ``--fakeit`` flag overrides detection results so you don't need an image that actually
192+
matches your detection pattern:
193+
194+
.. code:: bash
195+
196+
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py \
197+
--file /path/to/any/image.jpg --eventid <eid> --monitorid <mid> \
198+
--debug --fakeit "person"
199+
200+
Replace ``<eid>`` with a real event ID (so the notification links to a viewable event)
201+
and ``<mid>`` with the monitor ID. Registered devices should receive a push notification
202+
within a few seconds. Check the debug output for ``push:`` log lines to verify delivery.
203+
See :ref:`push_config` for push configuration details.
204+
183205
Optional: Face recognition
184206
~~~~~~~~~~~~~~~~~~~~~~~~~~
185207

docs/guides/installation.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Installation
33

44
There are two ways to use ML-powered object detection with ZoneMinder:
55

6-
.. topic:: Path 1: Detection only (no ES)
6+
.. topic:: Path 1: Detection + optional push (no ES)
77

88
Wire ``zm_detect.py`` directly to ZoneMinder using ``EventStartCommand``
99
(requires ZM 1.38.1+). ZM calls the detection script automatically when
10-
an event starts. No daemon needed — simpler to set up.
10+
an event starts. No daemon needed — simpler to set up. Can optionally
11+
send FCM push notifications directly (requires ZM 1.39.2+).
1112
See :doc:`install_path1` for setup instructions.
1213

1314
.. topic:: Path 2: Full Event Server
@@ -19,8 +20,10 @@ There are two ways to use ML-powered object detection with ZoneMinder:
1920

2021
.. include:: _feature_table.rst
2122

22-
If you only need detection results written to your ZM events, Path 1 is simpler to set up.
23-
If you need real-time notifications on your phone or other clients, you need Path 2.
23+
If you only need detection results written to your ZM events (with optional push
24+
notifications), Path 1 is simpler to set up.
25+
If you need WebSocket notifications, MQTT, notification rules, or the ES control
26+
interface, you need Path 2.
2427

2528
.. toctree::
2629

docs/guides/principles.rst

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Summary
55
+++++++++
66
This guide explains the detection and notification flow for ZoneMinder's ML ecosystem. There are two paths:
77

8-
* **Path 1 (Detection + optional push)** — ZoneMinder calls ``zm_detect.py`` directly via ``EventStartCommand``. No daemon needed. Optionally sends FCM push notifications directly (requires ZM 1.39.2+).
9-
* **Path 2 (Full Event Server)** — The Event Notification Server (ES) monitors shared memory for new events, invokes ML hooks, and sends notifications via FCM push, WebSockets, MQTT, and 3rd-party APIs.
8+
* **Path 1 (Detection + optional push)** — ZoneMinder calls ``zm_detect.py`` directly via ``EventStartCommand``. No daemon needed. Optionally sends FCM push notifications directly to registered devices (requires ZM 1.39.2+). See :ref:`push_config` for push setup.
9+
* **Path 2 (Full Event Server)** — The Event Notification Server (ES) monitors shared memory for new events, invokes ML hooks, and sends notifications via FCM push, WebSockets, MQTT, and 3rd-party APIs. Also provides notification rules, per-device monitor filtering, and a dynamic control interface.
1010

11-
Both paths use the same ML pipeline (``zm_detect.py`` + ``objectconfig.yml``). The difference is what triggers detection and what happens with the results.
11+
Both paths use the same ML pipeline (``zm_detect.py`` + ``objectconfig.yml``). The difference is what triggers detection and what notification channels are available.
1212

13-
Path 1: From Event to Detection
14-
+++++++++++++++++++++++++++++++++
13+
Path 1: From Event to Detection (+ Optional Push)
14+
+++++++++++++++++++++++++++++++++++++++++++++++++++
1515

1616
.. note::
1717

@@ -47,7 +47,19 @@ When detection finishes, ``zm_detect.py`` produces the following:
4747
* **Detection metadata** — An ``objects.json`` file with labels, boxes, confidences, and frame info is saved alongside the image.
4848
* **Event tags** — When ``tag_detected_objects: yes`` (requires ZM >= 1.37.44), detected labels are tagged in ZoneMinder.
4949

50-
That is the complete Path 1 flow. There is no daemon running, no shared memory polling, and no notifications — ZoneMinder calls the script, the script runs detection, and results are written back to the event.
50+
That is the core Path 1 detection flow. There is no daemon running and no shared memory polling — ZoneMinder calls the script, the script runs detection, and results are written back to the event.
51+
52+
4: Optional — Direct Push Notifications
53+
-----------------------------------------
54+
Starting with ZM 1.39.2+, ``zm_detect.py`` can also send **FCM push notifications directly** to registered mobile devices — no Event Server needed. This is configured via the ``push`` section in ``objectconfig.yml`` (see :ref:`push_config`).
55+
56+
When ``push.enabled`` is set to ``yes``, after detection completes ``zm_detect`` reads registered device tokens from ZoneMinder's ``Notifications`` database table (devices register via the ZM REST API) and sends push notifications through an FCM cloud function proxy. It respects per-token monitor filtering, throttle intervals, and push state, and automatically cleans up invalid tokens.
57+
58+
**What Path 1 push gives you:** FCM push notifications to registered iOS/Android devices after detection, with optional event images.
59+
60+
**What Path 1 push does NOT give you:** WebSocket notifications, MQTT, notification rules/time-based muting, the ``tokens.txt`` per-device control file, or the ES control interface. For those, you need :ref:`Path 2 <from-detection-to-notification>`.
61+
62+
See :ref:`push_config` in the configuration guide and the "Testing push notifications" section in :doc:`hooks` for how to test.
5163

5264
.. _from-detection-to-notification:
5365

@@ -56,7 +68,7 @@ Path 2: From Event Detection to Notification
5668

5769
.. note::
5870

59-
This section covers the full Event Notification Server (ES) flow. If you are using Path 1 (detection only via ``EventStartCommand``), you can skip this section.
71+
This section covers the full Event Notification Server (ES) flow. If you are using Path 1 (detection + optional push via ``EventStartCommand``), you can skip this section.
6072

6173
1: How it starts
6274
----------------------

docs/index.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ Choose your setup
6060

6161
There are two ways to use ML-powered object detection with ZoneMinder:
6262

63-
.. topic:: Path 1: Detection only (no ES)
63+
.. topic:: Path 1: Detection + optional push (no ES)
6464

6565
Wire ``zm_detect.py`` directly to ZoneMinder using ``EventStartCommand``
6666
(requires ZM 1.38.1+). ZM calls the detection script automatically when
67-
an event starts. No daemon needed — simpler to set up.
67+
an event starts. No daemon needed — simpler to set up. Can optionally
68+
send FCM push notifications directly (requires ZM 1.39.2+).
6869
See :doc:`guides/install_path1` for setup instructions.
6970

7071
.. topic:: Path 2: Full Event Server
@@ -76,8 +77,10 @@ There are two ways to use ML-powered object detection with ZoneMinder:
7677

7778
.. include:: guides/_feature_table.rst
7879

79-
If you only need detection results written to your ZM events, Path 1 is simpler to set up.
80-
If you need real-time notifications on your phone or other clients, you need Path 2.
80+
If you only need detection results written to your ZM events (with optional push
81+
notifications), Path 1 is simpler to set up.
82+
If you need WebSocket notifications, MQTT, notification rules, or the ES control
83+
interface, you need Path 2.
8184

8285
See the :doc:`guides/installation` page for step-by-step setup instructions for either path.
8386

0 commit comments

Comments
 (0)