iobroker.agent-dvr 0.5.5 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.de.md CHANGED
@@ -400,18 +400,107 @@ Diese URL als **Action** in AgentDVR eintragen (Kamera → Bearbeiten → Alarme
400
400
 
401
401
  Gibt `{"ok":true}` bei Erfolg zurück.
402
402
 
403
+ ### Schneller Alarm pro Kamera
404
+
405
+ Kamera-ID anhängen, damit der Adapter weiß, welche Kamera ausgelöst hat:
406
+
407
+ ```
408
+ GET http://<iobroker>:<webport>/agent-dvr.0/webhook?oid={ID}&ot={OT}
409
+ ```
410
+
411
+ `{ID}` und `{OT}` sind AgentDVR-Tags und werden von AgentDVR ersetzt. Der Adapter setzt dann **sofort** `<cam>.events.webhook` kurz auf `true` — noch bevor Daten abgeholt werden — und fragt danach alles ab. Die Action auf *Bewegung erkannt* legen. Mit aktivierten Alarmfotos wird das Foto sofort gespeichert — den passenden Trigger zeigt [Bilder für VIS und Skripte](#bilder-für-vis-und-skripte). AgentDVR ruft die Action oft mehrfach pro Bewegung auf; weitere Aufrufe derselben Kamera innerhalb von 20 s aktualisieren nur die Daten und lösen nicht erneut aus.
412
+
413
+ Ohne `oid` löst der Webhook nur einen vollständigen Poll aus. URL-Parameter landen auf Debug-Ebene im Log der Web-Instanz.
414
+
415
+ Für die Web-Instanz, die die Action aufruft, `http` verwenden — selbst signierte Zertifikate lehnt AgentDVR ohne Meldung ab.
416
+
417
+ ### Alarmfotos
418
+
419
+ Mit **Alarmfotos speichern** (Standard: an) legt jeder Webhook-Aufruf mit `?oid={ID}` zusätzlich das aktuelle Foto in voller Auflösung (`photo.jpg`) im ioBroker-Dateispeicher ab. Pro Kamera bleiben die letzten 3 Fotos erhalten:
420
+
421
+ | Datenpunkt | Inhalt |
422
+ |---|---|
423
+ | `<cam>.alertPhotos.grab1` … `grab3` | Absoluter Dateipfad des Fotos (`grab1` = neuestes) |
424
+ | `<cam>.alertPhotos.uri1` … `uri3` | ioBroker-Datei-URI, z. B. `iobfile://agent-dvr.0/cam_8_Reolink/grab1.jpg` |
425
+ | `<cam>.alertPhotos.ts1` … `ts3` | Zeitpunkt des Fotos |
426
+
427
+ Dateien: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (z. B. `agent-dvr.0/cam_8_Reolink/grab1.jpg`). Bei jedem neuen Foto rotieren sie (grab1 → grab2 → grab3). `ts1` wird **zuletzt** geschrieben, wenn die Datei fertig ist — auf `ts1` triggern und das Foto per Telegram senden, ohne HTTP-Abfrage (siehe [Telegram](#telegram)). Der Dateipfad in `grab1`–`grab3` gilt nur, wenn der Dateispeicher auf der lokalen Platte liegt (Standard); `uri1`–`uri3` funktionieren mit jedem Speicher.
428
+
403
429
  ### Übersicht *(erfordert „Übersichts-Widget")*
404
430
 
405
431
  | Datenpunkt | Typ | R/W | Beschreibung |
406
432
  |-----------|-----|-----|-------------|
407
433
  | `widget_live_overview` | string | R | HTML-Kachelraster aller Kameras — Standbilder werden bei jedem Adapter-Poll aktualisiert |
408
434
 
435
+ ## Bilder für VIS und Skripte
436
+
437
+ ### Welches Bild woher
438
+
439
+ | Bild | Datenpunkt / URL | Größe | Zeitpunkt |
440
+ |---|---|---|---|
441
+ | Livebild klein | `<cam>.urls.snapshot` (`grab.jpg`) | Vorschau | jetzt |
442
+ | Livebild groß | `<cam>.urls.photo` (`photo.jpg`) | volle Auflösung, ca. 1 s Ladezeit | jetzt |
443
+ | Livestream | `<cam>.urls.mjpeg`, `<cam>.urls.mp4` | Video | live |
444
+ | Letzte Aufnahme – Vorschaubild | `<cam>.events.last.thumb` | max. 320×180 (Grenze von AgentDVR) | bester Moment der Aufnahme, zeigt das erkannte Objekt |
445
+ | Letzte Aufnahme – Video | `<cam>.events.last.video` | Video | nach der Aufnahme |
446
+ | Alarmfotos | `<cam>.alertPhotos.grab1` … `grab3` | volle Auflösung | Moment des Alarms (Webhook mit `oid`) |
447
+
448
+ Die URLs aus `urls.*` und `events.last.*` zeigen direkt auf AgentDVR. Sie funktionieren nur im lokalen Netz — die Telegram-Server kommen nicht daran. Entweder vorher per HTTP-Anfrage laden (Antworttyp `arraybuffer`) oder die Alarmfotos nehmen, die schon in ioBroker liegen.
449
+
450
+ ### Welcher Trigger wofür
451
+
452
+ | Trigger | Löst aus | Wofür |
453
+ |---|---|---|
454
+ | `<cam>.alertPhotos.ts1` | Foto gespeichert, ca. 1–2 s nach dem Alarm | **Alarmfoto senden** (empfohlen) |
455
+ | `<cam>.events.webhook` | sofort beim Webhook-Aufruf | Bild selbst holen |
456
+ | `<cam>.events.new` | neue Aufnahme gelistet | Vorschaubild der Aufnahme |
457
+ | `<cam>.events.detected_<tag>` | KI-Tag einer neuen Aufnahme, z. B. `detected_people` — auch wenn AgentDVR den Tag erst später ergänzt | nur bei Personen benachrichtigen |
458
+
459
+ Als Bedingung **„größer als letzter“** (Blockly) bzw. `change: 'gt'` verwenden. Der Adapter schreibt seine Datenpunkte bei jedem Poll neu, „wurde aktualisiert“ löst deshalb bei jedem Poll aus. `status.alerted` ist meist zu kurz, um von einem Poll gesehen zu werden, und taugt nicht als Trigger.
460
+
461
+ ### Telegram
462
+
463
+ Blockly: Trigger auf `<cam>.alertPhotos.ts1` mit „größer als letzter“, Telegram-Baustein mit *Wert von* `<cam>.alertPhotos.uri1` als Text.
464
+
465
+ - **Telegram 6 oder neuer:** `uri1` (`iobfile://…`) verwenden. Telegram liest das Foto direkt aus dem ioBroker-Dateispeicher und sendet es als Foto — funktioniert mit jeder Speicherart.
466
+ - **Ältere Telegram-Versionen:** `grab1` (lokaler Dateipfad) verwenden. Ein Text, der ein vorhandener lokaler `.jpg`-Pfad ist, wird als Foto gesendet.
467
+
468
+ Den Dateiinhalt selbst zu senden (z. B. *Datei lesen* → Telegram) funktioniert in Blockly **nicht**: Rohdaten werden nur mit ausdrücklichem `type: 'photo'` als Foto gesendet.
469
+
470
+ JavaScript:
471
+
472
+ ```js
473
+ on({ id: 'agent-dvr.0.cam_8_Reolink.alertPhotos.ts1', change: 'gt' }, () => {
474
+ sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.alertPhotos.uri1').val });
475
+ });
476
+ ```
477
+
478
+ Die Datei selbst im Skript lesen: `readFile('agent-dvr.0', 'cam_8_Reolink/grab1.jpg', (err, data) => { … })`.
479
+
480
+ ### VIS / Dashboards
481
+
482
+ Die Alarmfotos liefert die Web-Instanz aus:
483
+
484
+ ```
485
+ http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
486
+ ```
487
+
488
+ z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (ebenso `grab2.jpg`, `grab3.jpg`). In einem Bild-Widget verwenden und bei Änderung von `alertPhotos.ts1` neu laden. Für ein Livebild `urls.snapshot` oder `urls.photo` mit Aktualisierungsintervall nehmen.
489
+
409
490
  ## Changelog
410
491
 
411
492
  <!--
412
493
  Placeholder for the next version (at the beginning of the line):
413
494
  ### **WORK IN PROGRESS**
414
495
  -->
496
+ ### 0.6.0 (2026-10-29)
497
+ * (ipod86) fix: `events.detected_*` wird jetzt auch gesetzt, wenn AgentDVR den KI-Tag (z. B. `people`) erst nachträglich zur Aufnahme hinzufügt
498
+ * (ipod86) feat: Webhook mit `?oid={ID}&ot={OT}` setzt sofort `<cam>.events.webhook` (20 s Sperrzeit pro Kamera) für das schnellstmögliche Alarmfoto
499
+ * (ipod86) feat: Alarmfotos — bei Webhook-Aufruf mit `oid` wird das Foto in voller Auflösung im Dateispeicher abgelegt, letzte 3 pro Kamera (`alertPhotos.grab1–3`, `ts1–3`)
500
+ * (ipod86) feat: Alarmfotos für VIS unter `/agent-dvr.0/photos/<cam>/grab1.jpg`; neuer README-Abschnitt, wie man an Bilder für VIS und Skripte kommt
501
+ * (ipod86) feat: `alertPhotos.uri1–3` mit der `iobfile://`-Adresse jedes Fotos, direkt mit Telegram 6 sendbar
502
+
503
+ <!-- markdownlint-disable-next-line MD024 -->
415
504
  ### 0.5.5 (2026-10-08)
416
505
  * (ipod86) fix: Live-Vorschau-Video wird nicht mehr gestreckt/verzerrt angezeigt — AgentDVRs Live-Stream presst das komplette Bild in ein festes Containerformat, unabhängig vom echten Seitenverhältnis der Kamera; jetzt korrigiert (`object-fit:fill`) statt verzerrt gezeigt
417
506
  * (ipod86) feat: Einstellbares Aktualisierungsintervall für die Live-Kachel (`widgetLiveRefreshSec`) — Abwägung zwischen aktuellem Vorschaubild und einem dauerhaft offenen Video-Modal, da das Neuschreiben des Widget-States das Modal zurücksetzt
package/README.md CHANGED
@@ -405,13 +405,102 @@ Configure this URL as an **Action** in AgentDVR (Camera → Edit → Alerts →
405
405
 
406
406
  Returns `{"ok":true}` on success.
407
407
 
408
+ ### Fast alert per camera
409
+
410
+ Append the camera ID so the adapter knows which camera fired:
411
+
412
+ ```
413
+ GET http://<iobroker>:<webport>/agent-dvr.0/webhook?oid={ID}&ot={OT}
414
+ ```
415
+
416
+ `{ID}` and `{OT}` are AgentDVR tags and are filled in by AgentDVR. The adapter then pulses `<cam>.events.webhook` **immediately** — before any data is fetched — and polls afterwards. Use the action on *motion detected*. With alert photos enabled the photo is stored right away — see [Getting images for VIS and scripts](#getting-images-for-vis-and-scripts) for the right trigger. AgentDVR often calls the action several times per motion; further calls for the same camera within 20 s only refresh the data and do not pulse again.
417
+
418
+ Without `oid` the webhook only triggers a full poll. Query parameters are written to the web instance log at debug level.
419
+
420
+ Use plain `http` for the web instance the action calls — AgentDVR silently rejects self-signed certificates.
421
+
422
+ ### Alert photos
423
+
424
+ With **Save alert photos** enabled (default), every webhook call with `?oid={ID}` also stores the current full-resolution photo (`photo.jpg`) in the ioBroker file storage. The last 3 photos per camera are kept:
425
+
426
+ | Data point | Content |
427
+ |---|---|
428
+ | `<cam>.alertPhotos.grab1` … `grab3` | Absolute file path of the photo (`grab1` = newest) |
429
+ | `<cam>.alertPhotos.uri1` … `uri3` | ioBroker file URI, e.g. `iobfile://agent-dvr.0/cam_8_Reolink/grab1.jpg` |
430
+ | `<cam>.alertPhotos.ts1` … `ts3` | Time of the photo |
431
+
432
+ Files: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (e.g. `agent-dvr.0/cam_8_Reolink/grab1.jpg`). On each new photo they rotate (grab1 → grab2 → grab3). `ts1` is written **last**, after the file is complete — trigger on `ts1` and send the photo with Telegram, no HTTP request needed (see [Telegram](#telegram)). The file path in `grab1`–`grab3` is only valid when the file storage is on the local disk (default); `uri1`–`uri3` work with any storage.
433
+
408
434
  ### Overview *(requires "Overview widget")*
409
435
 
410
436
  | Data point | Type | R/W | Description |
411
437
  |-----------|------|-----|-------------|
412
438
  | `widget_live_overview` | string | R | HTML tile grid of all cameras — snapshot refreshes on each adapter poll |
413
439
 
440
+ ## Getting images for VIS and scripts
441
+
442
+ ### Which image from where
443
+
444
+ | Image | Data point / URL | Size | Time |
445
+ |---|---|---|---|
446
+ | Live image, small | `<cam>.urls.snapshot` (`grab.jpg`) | preview | now |
447
+ | Live image, full | `<cam>.urls.photo` (`photo.jpg`) | full resolution, ~1 s to load | now |
448
+ | Live stream | `<cam>.urls.mjpeg`, `<cam>.urls.mp4` | video | live |
449
+ | Last recording – thumbnail | `<cam>.events.last.thumb` | max. 320×180 (AgentDVR limit) | best moment of the recording, shows the detected object |
450
+ | Last recording – video | `<cam>.events.last.video` | video | after the recording |
451
+ | Alert photos | `<cam>.alertPhotos.grab1` … `grab3` | full resolution | moment of the alert (webhook with `oid`) |
452
+
453
+ The `urls.*` and `events.last.*` URLs point directly to AgentDVR. They work in the local network only — Telegram's servers cannot fetch them. Either load them with an HTTP request first (response type `arraybuffer`) or use the alert photos, which are already stored in ioBroker.
454
+
455
+ ### Which trigger for what
456
+
457
+ | Trigger | Fires | Use for |
458
+ |---|---|---|
459
+ | `<cam>.alertPhotos.ts1` | photo stored, ~1–2 s after the alert | **send the alert photo** (recommended) |
460
+ | `<cam>.events.webhook` | immediately on the webhook call | fetching an image yourself |
461
+ | `<cam>.events.new` | new recording listed | thumbnail of the recording |
462
+ | `<cam>.events.detected_<tag>` | AI tag of a new recording, e.g. `detected_people` — also when AgentDVR adds the tag later | notify on persons only |
463
+
464
+ Use **"greater than previous"** (Blockly) or `change: 'gt'` as condition. The adapter rewrites its states on every poll, so "was updated" fires every poll. `status.alerted` is usually too short to be seen by a poll and is not a reliable trigger.
465
+
466
+ ### Telegram
467
+
468
+ Blockly: trigger on `<cam>.alertPhotos.ts1` with "greater than previous", Telegram block with *value of* `<cam>.alertPhotos.uri1` as text.
469
+
470
+ - **Telegram 6 or newer:** use `uri1` (`iobfile://…`). Telegram reads the photo directly from the ioBroker file storage and sends it as photo — works with every storage type.
471
+ - **Older Telegram versions:** use `grab1` (local file path). A text that is an existing local `.jpg` path is sent as photo.
472
+
473
+ Sending the file content itself (e.g. *read file* → Telegram) does **not** work from Blockly: raw data is only sent as photo with an explicit `type: 'photo'`.
474
+
475
+ JavaScript:
476
+
477
+ ```js
478
+ on({ id: 'agent-dvr.0.cam_8_Reolink.alertPhotos.ts1', change: 'gt' }, () => {
479
+ sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.alertPhotos.uri1').val });
480
+ });
481
+ ```
482
+
483
+ Reading the file itself in a script: `readFile('agent-dvr.0', 'cam_8_Reolink/grab1.jpg', (err, data) => { … })`.
484
+
485
+ ### VIS / dashboards
486
+
487
+ The alert photos are served by the web instance:
488
+
489
+ ```
490
+ http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
491
+ ```
492
+
493
+ e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also `grab2.jpg`, `grab3.jpg`). Use it in an image widget and refresh it on changes of `alertPhotos.ts1`. For a live image use `urls.snapshot` or `urls.photo` with a refresh interval.
494
+
414
495
  ## Changelog
496
+ ### 0.6.0 (2026-10-29)
497
+ * (ipod86) chore: clearer adapter title ("Agent DVR – Cameras & Recordings") and keywords
498
+ * (ipod86) fix: `events.detected_*` now also fires when AgentDVR adds the AI tag (e.g. `people`) to a recording after it was first listed
499
+ * (ipod86) feat: webhook with `?oid={ID}&ot={OT}` pulses `<cam>.events.webhook` immediately (20 s cooldown per camera) for the fastest possible alert photo
500
+ * (ipod86) feat: alert photos — on a webhook call with `oid` the full-resolution photo is stored in the file storage, last 3 per camera (`alertPhotos.grab1–3`, `ts1–3`)
501
+ * (ipod86) feat: alert photos served for VIS at `/agent-dvr.0/photos/<cam>/grab1.jpg`; new README section on getting images for VIS and scripts
502
+ * (ipod86) feat: `alertPhotos.uri1–3` with the `iobfile://` URI of each photo, sendable directly with Telegram 6
503
+
415
504
  <!-- markdownlint-disable-next-line MD024 -->
416
505
  ### 0.5.5 (2026-10-08)
417
506
  * (ipod86) fix: live preview video no longer gets stretched/distorted — AgentDVR's live stream squishes the full picture into a fixed container format regardless of the camera's actual aspect ratio; now corrected (`object-fit:fill`) instead of shown distorted
@@ -435,10 +524,6 @@ Returns `{"ok":true}` on success.
435
524
  ### 0.5.2 (2026-08-05)
436
525
  * (ipod86) feat: rename `overview` DP to `widget_live_overview` for consistent naming
437
526
 
438
- ### 0.5.1 (2026-08-05)
439
- * (ipod86) feat: per-instance URL routing — each adapter instance uses its own URL namespace (`agent-dvr.0/`, `agent-dvr.1/`, …)
440
- * (ipod86) feat: rename per-camera recording widget DP from `widget` to `widget_recordings`; add new `widget_live` DP with a single-camera live tile
441
-
442
527
  [Older changelog entries in CHANGELOG_OLD.md](CHANGELOG_OLD.md)
443
528
 
444
529
  ## License