iobroker.agent-dvr 0.5.5 → 0.7.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,113 @@ 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. `<cam>.events.webhookParams` enthält alle Parameter des letzten Aufrufs als JSON (plus `ts`), geschrieben vor dem Puls und auch während der Sperrzeit — beliebige AgentDVR-Tags an die URL hängen (z. B. `&ai={AI}&zone={ZONE}&name={NAME}`) und im eigenen Skript auswerten.
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.url1` … `url3` | http(s)-Link über die Web-Instanz, z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` — für TV-, Kiosk- oder andere Apps, die nur Web-Links annehmen |
425
+ | `<cam>.alertPhotos.uri1` … `uri3` | ioBroker-Datei-URI, z. B. `iobfile://agent-dvr.0/cam_8_Reolink/grab1.jpg` |
426
+ | `<cam>.alertPhotos.ts1` … `ts3` | Zeitpunkt des Fotos |
427
+
428
+ 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.
429
+
403
430
  ### Übersicht *(erfordert „Übersichts-Widget")*
404
431
 
405
432
  | Datenpunkt | Typ | R/W | Beschreibung |
406
433
  |-----------|-----|-----|-------------|
407
434
  | `widget_live_overview` | string | R | HTML-Kachelraster aller Kameras — Standbilder werden bei jedem Adapter-Poll aktualisiert |
408
435
 
436
+ ## Bilder für VIS und Skripte
437
+
438
+ ### Welches Bild woher
439
+
440
+ | Bild | Datenpunkt / URL | Größe | Zeitpunkt |
441
+ |---|---|---|---|
442
+ | Livebild klein | `<cam>.urls.snapshot` (`grab.jpg`) | Vorschau | jetzt |
443
+ | Livebild groß | `<cam>.urls.photo` (`photo.jpg`) | volle Auflösung, ca. 1 s Ladezeit | jetzt |
444
+ | Livestream | `<cam>.urls.mjpeg`, `<cam>.urls.mp4` | Video | live |
445
+ | Letzte Aufnahme – Vorschaubild | `<cam>.events.last.thumb` | max. 320×180 (Grenze von AgentDVR) | bester Moment der Aufnahme, zeigt das erkannte Objekt |
446
+ | Letzte Aufnahme – Video | `<cam>.events.last.video` | Video | nach der Aufnahme |
447
+ | Alarmfotos | `<cam>.alertPhotos.grab1` … `grab3` | volle Auflösung | Moment des Alarms (Webhook mit `oid`) |
448
+
449
+ 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.
450
+
451
+ ### Welcher Trigger wofür
452
+
453
+ | Trigger | Löst aus | Wofür |
454
+ |---|---|---|
455
+ | `<cam>.alertPhotos.ts1` | Foto gespeichert, ca. 1–2 s nach dem Alarm | **Alarmfoto senden** (empfohlen) |
456
+ | `<cam>.events.webhook` | sofort beim Webhook-Aufruf | Bild selbst holen |
457
+ | `<cam>.events.new` | neue Aufnahme gelistet | Vorschaubild der Aufnahme |
458
+ | `<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 |
459
+
460
+ 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.
461
+
462
+ ### Telegram
463
+
464
+ Blockly: Trigger auf `<cam>.alertPhotos.ts1` mit „größer als letzter“, Telegram-Baustein mit *Wert von* `<cam>.alertPhotos.uri1` als Text.
465
+
466
+ - **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.
467
+ - **Ältere Telegram-Versionen:** `grab1` (lokaler Dateipfad) verwenden. Ein Text, der ein vorhandener lokaler `.jpg`-Pfad ist, wird als Foto gesendet.
468
+
469
+ 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.
470
+
471
+ JavaScript:
472
+
473
+ ```js
474
+ on({ id: 'agent-dvr.0.cam_8_Reolink.alertPhotos.ts1', change: 'gt' }, () => {
475
+ sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.alertPhotos.uri1').val });
476
+ });
477
+ ```
478
+
479
+ Die Datei selbst im Skript lesen: `readFile('agent-dvr.0', 'cam_8_Reolink/grab1.jpg', (err, data) => { … })`.
480
+
481
+ ### VIS / Dashboards
482
+
483
+ Die Alarmfotos liefert die Web-Instanz aus — der fertige Link steht in `<cam>.alertPhotos.url1` … `url3`. Der Adapter nimmt eine aktive Web-Instanz (bevorzugt `http`, weil TV-Apps selbst signierte Zertifikate oft ablehnen) und die IPv4-Adresse des Hosts. Die Web-Instanz lässt sich in den Einstellungen auch fest wählen (*Funktionen → Web-Instanz für Foto-Links*). Ändert sich eine Web-Instanz (Port, https, Bind-Adresse, aktiviert) oder die Host-Adresse, werden die Links automatisch neu geschrieben. Die Links bleiben bei jedem neuen Foto gleich und können einmal in einer App eingetragen werden:
484
+
485
+ ```
486
+ http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
487
+ ```
488
+
489
+ 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.
490
+
409
491
  ## Changelog
410
492
 
411
493
  <!--
412
494
  Placeholder for the next version (at the beginning of the line):
413
495
  ### **WORK IN PROGRESS**
414
496
  -->
497
+ ### 0.7.0 (2026-10-29)
498
+ * (ipod86) feat: `alertPhotos.url1–3` mit festem http(s)-Link zu jedem Foto, für TV-/Kiosk-Apps, die nur Web-Links annehmen; Web-Instanz wählbar, Links folgen Änderungen an den Web-Instanzen
499
+ * (ipod86) feat: `<cam>.events.webhookParams` mit allen Parametern des letzten Webhook-Aufrufs als JSON
500
+
501
+ <!-- markdownlint-disable-next-line MD024 -->
502
+ ### 0.6.0 (2026-10-29)
503
+ * (ipod86) fix: `events.detected_*` wird jetzt auch gesetzt, wenn AgentDVR den KI-Tag (z. B. `people`) erst nachträglich zur Aufnahme hinzufügt
504
+ * (ipod86) feat: Webhook mit `?oid={ID}&ot={OT}` setzt sofort `<cam>.events.webhook` (20 s Sperrzeit pro Kamera) für das schnellstmögliche Alarmfoto
505
+ * (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`)
506
+ * (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
507
+ * (ipod86) feat: `alertPhotos.uri1–3` mit der `iobfile://`-Adresse jedes Fotos, direkt mit Telegram 6 sendbar
508
+
509
+ <!-- markdownlint-disable-next-line MD024 -->
415
510
  ### 0.5.5 (2026-10-08)
416
511
  * (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
512
  * (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,108 @@ 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. `<cam>.events.webhookParams` holds all parameters of the latest call as JSON (plus `ts`), written before the pulse and also during the cooldown — add any AgentDVR tags you need to the URL (e.g. `&ai={AI}&zone={ZONE}&name={NAME}`) and evaluate them in your own script.
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.url1` … `url3` | http(s) URL via the web instance, e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` — for TV, kiosk or other apps that only accept web links |
430
+ | `<cam>.alertPhotos.uri1` … `uri3` | ioBroker file URI, e.g. `iobfile://agent-dvr.0/cam_8_Reolink/grab1.jpg` |
431
+ | `<cam>.alertPhotos.ts1` … `ts3` | Time of the photo |
432
+
433
+ 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.
434
+
408
435
  ### Overview *(requires "Overview widget")*
409
436
 
410
437
  | Data point | Type | R/W | Description |
411
438
  |-----------|------|-----|-------------|
412
439
  | `widget_live_overview` | string | R | HTML tile grid of all cameras — snapshot refreshes on each adapter poll |
413
440
 
441
+ ## Getting images for VIS and scripts
442
+
443
+ ### Which image from where
444
+
445
+ | Image | Data point / URL | Size | Time |
446
+ |---|---|---|---|
447
+ | Live image, small | `<cam>.urls.snapshot` (`grab.jpg`) | preview | now |
448
+ | Live image, full | `<cam>.urls.photo` (`photo.jpg`) | full resolution, ~1 s to load | now |
449
+ | Live stream | `<cam>.urls.mjpeg`, `<cam>.urls.mp4` | video | live |
450
+ | Last recording – thumbnail | `<cam>.events.last.thumb` | max. 320×180 (AgentDVR limit) | best moment of the recording, shows the detected object |
451
+ | Last recording – video | `<cam>.events.last.video` | video | after the recording |
452
+ | Alert photos | `<cam>.alertPhotos.grab1` … `grab3` | full resolution | moment of the alert (webhook with `oid`) |
453
+
454
+ 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.
455
+
456
+ ### Which trigger for what
457
+
458
+ | Trigger | Fires | Use for |
459
+ |---|---|---|
460
+ | `<cam>.alertPhotos.ts1` | photo stored, ~1–2 s after the alert | **send the alert photo** (recommended) |
461
+ | `<cam>.events.webhook` | immediately on the webhook call | fetching an image yourself |
462
+ | `<cam>.events.new` | new recording listed | thumbnail of the recording |
463
+ | `<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 |
464
+
465
+ 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.
466
+
467
+ ### Telegram
468
+
469
+ Blockly: trigger on `<cam>.alertPhotos.ts1` with "greater than previous", Telegram block with *value of* `<cam>.alertPhotos.uri1` as text.
470
+
471
+ - **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.
472
+ - **Older Telegram versions:** use `grab1` (local file path). A text that is an existing local `.jpg` path is sent as photo.
473
+
474
+ 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'`.
475
+
476
+ JavaScript:
477
+
478
+ ```js
479
+ on({ id: 'agent-dvr.0.cam_8_Reolink.alertPhotos.ts1', change: 'gt' }, () => {
480
+ sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.alertPhotos.uri1').val });
481
+ });
482
+ ```
483
+
484
+ Reading the file itself in a script: `readFile('agent-dvr.0', 'cam_8_Reolink/grab1.jpg', (err, data) => { … })`.
485
+
486
+ ### VIS / dashboards
487
+
488
+ The alert photos are served by the web instance — the ready-made link is in `<cam>.alertPhotos.url1` … `url3`. The adapter picks an enabled web instance (plain `http` preferred, since TV apps often reject self-signed certificates) and the host's IPv4 address. The web instance can also be chosen in the settings (*Features → Web instance for photo links*). When a web instance changes (port, https, bind address, enabled) or the host address changes, the links are rewritten automatically. The links stay the same for every new photo, so you can enter them once in an app:
489
+
490
+ ```
491
+ http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
492
+ ```
493
+
494
+ 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.
495
+
414
496
  ## Changelog
497
+ ### 0.7.0 (2026-10-29)
498
+ * (ipod86) feat: `alertPhotos.url1–3` with a fixed http(s) link to each photo, for TV/kiosk apps that only accept web links; web instance selectable, links follow changes of the web instances
499
+ * (ipod86) feat: `<cam>.events.webhookParams` with all parameters of the latest webhook call as JSON
500
+
501
+ <!-- markdownlint-disable-next-line MD024 -->
502
+ ### 0.6.0 (2026-10-29)
503
+ * (ipod86) chore: clearer adapter title ("Agent DVR – Cameras & Recordings") and keywords
504
+ * (ipod86) fix: `events.detected_*` now also fires when AgentDVR adds the AI tag (e.g. `people`) to a recording after it was first listed
505
+ * (ipod86) feat: webhook with `?oid={ID}&ot={OT}` pulses `<cam>.events.webhook` immediately (20 s cooldown per camera) for the fastest possible alert photo
506
+ * (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`)
507
+ * (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
508
+ * (ipod86) feat: `alertPhotos.uri1–3` with the `iobfile://` URI of each photo, sendable directly with Telegram 6
509
+
415
510
  <!-- markdownlint-disable-next-line MD024 -->
416
511
  ### 0.5.5 (2026-10-08)
417
512
  * (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
@@ -432,13 +527,6 @@ Returns `{"ok":true}` on success.
432
527
  ### 0.5.3 (2026-10-04)
433
528
  * (ipod86) fix: clear ensuredFolders cache on object deletion to prevent stale "no existing object" warnings for rediscovered drives/cameras
434
529
 
435
- ### 0.5.2 (2026-08-05)
436
- * (ipod86) feat: rename `overview` DP to `widget_live_overview` for consistent naming
437
-
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
530
  [Older changelog entries in CHANGELOG_OLD.md](CHANGELOG_OLD.md)
443
531
 
444
532
  ## License