EventDetector(), EventNotifier() and gotify

This is weird…

Updated in both devices, and lost completely the notification sending.

    notifier = degirum_tools.EventNotifier(
      "AI Detection Service - Object Detected",
      event_name,
      message="Object detected at: {time} . Download file: {url}",
      holdoff=holdoff_sec,
      notification_config=f"{notification_config}",
      clip_save=True,

Is there any way I can debug this, to know why after the update the eamils are not being sent?

I tested it with python -m aiosmtpd -n -l localhost:1025 running locally as mail server.

Yes. But it is backward compatible with plain text - if you do not use markdown formatting, it will look same way.

I had the same configuration as before when stopped sending notifications just after the update (same email server, same destination, same everything)… but now I have no notifications at all.

Tried with your ‘aiosmtpd’ idea ,with a slightly modification to log incoming connecions and I simply didn’t receive any connection, as if the notification event is never being triggered…

Do you know how can I debug this?

The inference is showing bounding boxes, but the notifications are not being sent

I kept doing tests, and not even the clip files are being created…

The last uploaded file to the minio server is from yesterday just before updating degirum_tools…

      "Key": "00004041.mp4",
      "LastModified": "2025-10-28T11:00:22.715000+00:00",

and confirmed that the only change I made in the script should have no effect on the script behaviour as it was only the message itself, I checked in the git to be sure no other changes were done, and this is the only change refleted to this script:

Please @vladk :folded_hands: now I’m begging you for help…

I understand the change you introduced in the last update is not the origin of the problem, but maybe some change from previous commit b805154

For whatever reason I’m not able to imagine the notification events are not being triggered at all

Hi @dario , does the problem exist when you use latest released version of degirum_tools package? This is 0.22.4

Hi, the problem started today after the upgrade.

the currently version is:

In the device running degirum service:

(degirum) pi@edgepi:~/DeGirum $ degirum version
0.19.1
(degirum) pi@edgepi:~/DeGirum $ python -c 'import degirum_tools as dg; print(dg._version.__version_info__)'
('0', '22', '4')

In the device runing the script:

livestream # degirum version
0.19.1
livestream # python3 -c 'import degirum_tools as dg; print(dg._version.__version_info__)'
('0', '22', '4')

Do you know if there is anything I can add to the script to print/log debug information, so we both now what is happening??

Hi @dario ,

can you do this:

pip uninstall -y degirum_tools
pip install -U degirum_tools

This will cleanly reinstall released version

Reinstall in both devices done!

Detections are being drawn in the output stream but still notification event not being triggered.

If helps the EventDetector is the same as in smart_nvr example

zone_detector = degirum_tools.EventDetector(
      f"""
      Trigger: {event_name}
      when: ObjectCount
      is greater than: 0
      during: [10, frames]
      for at least: [90, percent]
      """,
      show_overlay=False,
)

Hi @dario , I found and fixed the problem. You can try installing it from repo

pip uninstall -y degirum_tools && pip install -U git+https://github.com/degirum/degirum_tools.git

Soon we will do new release. Sorry for inconvenience.

With this fix I was able to send e-mails to local SMTP server.

In smart_nvr example I modified:notification_config="mailto://test@localhost:1025/?from=test@example.com&to=receiver@example.com",

Then I started SMTP server as python -m aiosmtpd -n -l localhost:1025

And was able to see e-mail:

---------- MESSAGE FOLLOWS ----------
Content-Type: multipart/alternative; boundary="===============8388140468357579329=="
MIME-Version: 1.0
X-Application: Apprise
Subject: object_detected
From: test@example.com
To: receiver@example.com
Message-ID: <176177685932.30404.10225104574558863824@localhost>
Date: Wed, 29 Oct 2025 22:27:39 +0000
X-Peer: ('::1', 54996, 0, 0)

--===============8388140468357579329==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Wed Oct 29 15:27:39 2025: person is detected in zone
--===============8388140468357579329==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

<p>Wed Oct 29 15:27:39 2025: person is detected in zone</p>
--===============8388140468357579329==--
------------ END MESSAGE ------------

Upgraded to 0.22.5 and I’m still without events being triggered nor emails sent…

I’m not using exactly smart_nvr, I’d mention that example because was the inspiration script where I got the EventDetector configuration from, but mine uses ObjectCount instead ZoneCount

Even tried to use and absurd trigger like:

Trigger {event_name} when: ObjectCount 
is greater than: 0 
during: [10, frames] 
for at least: [1, frame]

But no luck, no connection to the email server, not even clip saved, that is the first thing done before even sending the email, first it should upload the file to be able to get the download url, isn’t¿?

Seriously, there is no possible way to do any kind of debugging¿?

Try to use “json://console” as notification_config value. This will print notifications directly to stdout of your app. If you can see them there, it means the problem is with e-mails, not your pipeline. If you do not see them on console, then notifications are just not generated. Lets starts from this point and then see where to go.

There is no problem with the emails, as said nothing changed in my script from when it was working appart from removing a ‘\n’ from the email text. That definetively does not affect anything related to emails.

I tested the aiosmtp with the apprise and there is no problem conencting to it from terminal

From my tests is clear that the events, for some unknown reason, are not being triggered…

Using smart_nvr with json://console and no events in the console:

Hi @dario

Any chance you can share the script? If no events are triggered, we should be able to replicate with any model and any video.

yes @vladk that was the nvr.py:

import degirum as dg, degirum_tools
from degirum_tools import streams as dgstreams

hw_location = "10.0.0.2:8778"
model_zoo_url = "aiserver://home/pi/DeGirum/zoo"
model_name = "yolov8s_coco--640x640_quant_hailort_hailo8_1"
video_source = "rtmp://input.server/man/livestream"
zones = [
   [[0, 1920], [1920, 0], [1920, 1080], [0, 1080]],
]
holdoff_sec = 3.0
notification_config = "mailto://10.0.0.1:8025?user=pepe@pepe.pep&pass=p&from='AI notification <noreply@pepe.pep>'&to=pep@pepe.pep"  # just prints to console
clip_duration = 100
storage_config = degirum_tools.ObjectStorageConfig(
    endpoint="detections",  # Object storage endpoint URL or local path
    access_key="",  # Access key for the storage account
    secret_key="",  # Secret key for the storage account
    bucket="./temp_folder",  # Bucket name for S3 or local directory name
)

# load model
model = dg.load_model(
    model_name,
    hw_location,
    model_zoo_url,
    overlay_show_probabilities=True,
    overlay_line_width=1,
)

#
# create analyzers:
#

anchor = degirum_tools.AnchorPoint.CENTER
window_name = "Live Display (press 'q' to quit)"
event_name = "object_detected"

# object tracker
object_tracker = degirum_tools.ObjectTracker(
    track_thresh=0.35,
    track_buffer=100,
    match_thresh=0.9999,
    trail_depth=10,
    anchor_point=anchor,
)

# event detector: object in zone
zone_detector = degirum_tools.EventDetector(
    f"""
    Trigger: {event_name}
    when: ObjectCount
    is greater than: 0
    during: [10, frames]
    for at least: [90, percent]
    """,
    show_overlay=False,
)

# event notifier
notifier = degirum_tools.EventNotifier(
    event_name,
    event_name,
    message="{time}: person is detected in zone",
    holdoff=holdoff_sec,
    notification_config=notification_config,
    clip_save=True,
    clip_duration=clip_duration,
    clip_pre_trigger_delay=clip_duration // 2,
    storage_config=storage_config,
)

degirum_tools.attach_analyzers(
    model, [object_tracker, zone_counter, zone_detector, notifier]
)

#
# create gizmos
#

# video source gizmo
cam_source = dgstreams.VideoSourceGizmo(video_source)

# detection gizmo
detector = dgstreams.AiSimpleGizmo(model)

# local display gizmo (just for debugging)
display = dgstreams.VideoDisplayGizmo(window_name, show_ai_overlay=True)

# start composition
dgstreams.Composition(cam_source >> detector >> display).start()

@vladk keep doing tests, and today the notifications are shown in the console, but i wasnt unable to get the clip files being saved, not locally nor minio

also the error about the folder dissapear but no clip files being created neither if I change the storage config to:

storage_config = degirum_tools.ObjectStorageConfig(
    endpoint="temp_folder/detections",  # Object storage endpoint URL or local path
    access_key="",  # Access key for the storage account
    secret_key="",  # Secret key for the storage account
    bucket=".",  # Bucket name for S3 or local directory name
)

same if I wrote a valid s3 config

I see zone_counterattached but not defined in the code

Hi @shashi that was my fault…

I was deleting confidential data and copied from wrong edit. I do not use ZoneCount but ObjectCount

The current smart_nvr looks like this:

import degirum as dg, degirum_tools
from degirum_tools import streams as dgstreams

hw_location = "10.0.0.2:8778"
model_zoo_url = "aiserver://home/pi/DeGirum/zoo"
model_name = "yolov8s_coco--640x640_quant_hailort_hailo8_1"
video_source = "rtmp://input.server/man/livestream"


holdoff_sec = 3.0
notification_config = "json://console"  # just prints to console
# notification_config="mailto://10.0.0.1:8025?user=pepe@pepe.pep&pass=p&from='AI notification <noreply@pepe.pep>'&to=pep@pepe.pep"
clip_duration = 10
storage_config = degirum_tools.ObjectStorageConfig(
    endpoint="temp_folder/detections",  # Object storage endpoint URL or local path
    access_key="",  # Access key for the storage account
    secret_key="",  # Secret key for the storage account
    bucket=".",  # Bucket name for S3 or local directory name
)

"""
storage_config = degirum_tools.ObjectStorageConfig(
    endpoint="./temp_folder",  # Object storage endpoint URL or local path
    access_key="",  # Access key for the storage account
    secret_key="",  # Secret key for the storage account
    bucket="detections",  # Bucket name for S3 or local directory name
)
"""
# load model
model = dg.load_model(
    model_name,
    hw_location,
    model_zoo_url,
    overlay_show_probabilities=True,
    overlay_line_width=1,
)

#
# create analyzers:
#

anchor = degirum_tools.AnchorPoint.CENTER
window_name = "Live Display (press 'q' to quit)"
event_name = "object_detected"

# object tracker
object_tracker = degirum_tools.ObjectTracker(
    track_thresh=0.35,
    track_buffer=100,
    match_thresh=0.9999,
    trail_depth=10,
    anchor_point=anchor,
)

# zone counter

# event detector: object in zone
zone_detector = degirum_tools.EventDetector(
    f"""
    Trigger: {event_name}
    when: ObjectCount
    is greater than: 0
    during: [10, frames]
    for at least: [90, percent]
    """,
    show_overlay=False,
)

# event notifier
notifier = degirum_tools.EventNotifier(
    event_name,
    event_name,
    message="{time}: person is detected in zone",
    holdoff=holdoff_sec,
    notification_config=notification_config,
    clip_save=True,
    clip_duration=clip_duration,
    clip_pre_trigger_delay=clip_duration // 2,
    storage_config=storage_config,
)

degirum_tools.attach_analyzers(
    model, [object_tracker,  zone_detector, notifier]
)

#
# create gizmos
#

# video source gizmo
cam_source = dgstreams.VideoSourceGizmo(video_source)

# detection gizmo
detector = dgstreams.AiSimpleGizmo(model)

# local display gizmo (just for debugging)
display = dgstreams.VideoDisplayGizmo(window_name, show_ai_overlay=True)

# start composition
dgstreams.Composition(cam_source >> detector >> display).start()

as said, this shows the notification event (only one), but does not create the clip_file nor send the email to the aiosmtpd

just confirmed the problem is related to the clip saving.

If I remove completely the ‘saving’ clip section, the aiosmtpd receive the notification without problems