iobroker.agent-dvr 0.8.1 → 0.9.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
@@ -27,6 +27,12 @@ Aufnahmen-Galerie, Live-Kachel und Live-Übersicht gibt es auch als Web-Komponen
27
27
  - übernimmt auf Wunsch die Farben aus dem Theme der Visualisierung
28
28
  - braucht keine Zugangsdaten: Bilder und Videos nutzen dieselben AgentDVR-Links wie die HTML-Widgets; die Daten kommen aus `widget_config` und `<cam>.widget_data`
29
29
 
30
+ ### Aufnahmen im ioBroker-Dateispeicher und als Telegram-Video
31
+ - **Letzte Aufnahmen im ioBroker-Dateispeicher bereitstellen** (standardmäßig aus): jede neue Aufnahme einer Kamera wird von AgentDVR geladen und pro Kamera als `rec1` … `rec3` abgelegt – mit Dateipfad, `iobfile://`-URI und http-URL in `<cam>.recordings.*`, genau wie die Alarmfotos
32
+ - auf Wunsch als **MP4** (verlustfreies Umpacken mit ffmpeg, keine Neukodierung) – spielt überall, auch direkt in Telegram
33
+ - **`sendRecording`** schickt die letzte, eine gespeicherte oder eine beliebige Aufnahme direkt als Video an Telegram (oder eine andere Instanz); **`getRecording`** stellt sie als Datei für eigene Skripte bereit
34
+ - Details: [Aufnahmen im Dateispeicher](#aufnahmen-im-dateispeicher)
35
+
30
36
  ## Funktionen
31
37
 
32
38
  - Automatische Erkennung aller AgentDVR-Kameras beim Start (Mikrofone ausgenommen)
@@ -83,6 +89,20 @@ Aufnahmen-Galerie, Live-Kachel und Live-Übersicht gibt es auch als Web-Komponen
83
89
  | Einstellung | Beschreibung | Standard |
84
90
  |-------------|-------------|---------|
85
91
  | Ereignis-Datenpunkte | Aufnahme-Metadaten (neuestes Ereignis, Anzahl, Tags, …) pro Kamera spiegeln | `ja` |
92
+ | Alarmfotos speichern | Das Foto jedes Webhook-Alarms im Dateispeicher ablegen (siehe [Alarmfotos](#alarmfotos)) | `ja` |
93
+ | Web-Instanz für Foto-Links | Web-Instanz für die `url*`-Links von Alarmfotos und Aufnahmen | automatisch |
94
+
95
+ **Aufnahmen im Dateispeicher** — siehe [Aufnahmen im Dateispeicher](#aufnahmen-im-dateispeicher)
96
+
97
+ | Einstellung | Beschreibung | Standard |
98
+ |-------------|-------------|---------|
99
+ | Letzte Aufnahmen im ioBroker-Dateispeicher bereitstellen | Jede neue Aufnahme laden und pro Kamera vorhalten | `nein` |
100
+ | Kameras | Alle Kameras oder eine Auswahl (die Liste braucht eine laufende Instanz) | alle |
101
+ | Anzahl gespeicherter Aufnahmen pro Kamera | 1, 2 oder 3 (`rec1` = neueste) | `1` |
102
+ | Maximalgröße (MB) | Größere Aufnahmen werden mit Info-Log übersprungen; gilt auch für `sendRecording`/`getRecording` | `50` |
103
+ | Download-Timeout (s) | Download und Umwandlung einer Aufnahme (10–900) | `120` |
104
+ | Als MP4 bereitstellen | MKV mit ffmpeg in MP4 umpacken (ohne Neukodierung); ohne ffmpeg bleibt es MKV | `ja` |
105
+ | ffmpeg-Pfad | Leer = automatische Suche | — |
86
106
 
87
107
  **Anzeige**
88
108
 
@@ -394,6 +414,7 @@ Dieser Adapter speichert deine AgentDVR-Admin-Zugangsdaten und stellt `system.co
394
414
  | Datenpunkt | Typ | R/W | Beschreibung |
395
415
  |-----------|-----|-----|-------------|
396
416
  | `<cam>.events.*` | verschieden | R | Metadaten der letzten Aufnahme — erfordert „Ereignis-Datenpunkte" |
417
+ | `<cam>.recordings.*` | verschieden | R | Gespeicherte Aufnahmen (`file1`, `uri1`, `url1`, `name1`, `ts1`, …) — erfordert „Letzte Aufnahmen im ioBroker-Dateispeicher bereitstellen" |
397
418
  | `<cam>.widget_recordings` | string | R | HTML-Aufnahmegalerie — erfordert „Galerie-Widget" |
398
419
  | `<cam>.widget_live` | string | R | HTML-Live-Einzelkachel der Kamera — erfordert „Galerie-Widget"; Standbild wird bei jedem Adapter-Poll aktualisiert |
399
420
  | `<cam>.widget_data` | string | R | Aufnahmen als JSON für die Web-Komponenten (die letzten 500) — erfordert „Galerie-Widget" oder „Ereignis-Datenpunkte" |
@@ -446,6 +467,91 @@ Dateien: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (z. B. `agent-dvr.0/cam_8
446
467
  | `widget_live_overview` | string | R | HTML-Kachelraster aller Kameras — Standbilder werden bei jedem Adapter-Poll aktualisiert |
447
468
  | `widget_config` | string | R | Widget-Einstellungen, Kameras und Texte als JSON für die Web-Komponenten (immer geschrieben, ohne Zugangsdaten) |
448
469
 
470
+ ## Aufnahmen im Dateispeicher
471
+
472
+ Mit **Letzte Aufnahmen im ioBroker-Dateispeicher bereitstellen** (Tab *Funktionen*, standardmäßig aus) lädt der Adapter jede neue Aufnahme einer Kamera von AgentDVR, sobald sie in der Aufnahmeliste erscheint (in dem Moment, in dem `<cam>.events.new` pulst — *Ereignis-Datenpunkte* müssen also an sein), und legt sie im ioBroker-Dateispeicher ab. Der Download landet im Arbeitsspeicher, nie in einer temporären Datei. Wie bei den Alarmfotos bleiben pro Kamera die letzten 1, 2 oder 3 Aufnahmen erhalten (Einstellung *Anzahl gespeicherter Aufnahmen pro Kamera*, Standard 1):
473
+
474
+ | Datenpunkt | Inhalt |
475
+ |---|---|
476
+ | `<cam>.recordings.file1` … `file3` | Absoluter Dateipfad, z. B. `/opt/iobroker/iobroker-data/files/agent-dvr.0/cam_8_Reolink/rec1.mp4` (`1` = neueste) |
477
+ | `<cam>.recordings.uri1` … `uri3` | ioBroker-Datei-URI, z. B. `iobfile://agent-dvr.0/cam_8_Reolink/rec1.mp4` |
478
+ | `<cam>.recordings.url1` … `url3` | http(s)-URL über die Web-Instanz, z. B. `http://192.168.1.10:8082/agent-dvr.0/recordings/cam_8_Reolink/rec1.mp4` (Spulen möglich) |
479
+ | `<cam>.recordings.name1` … `name3` | Ursprünglicher AgentDVR-Dateiname, z. B. `8_2026-11-12_15-55-29_931.mkv` |
480
+ | `<cam>.recordings.ts1` … `ts3` | Zeitpunkt der Aufnahme |
481
+
482
+ Dateien: `<namespace>/<cam>/rec1.mp4` (bzw. `.mkv`) … `rec3`. Bei jeder neuen Aufnahme rücken sie nach (rec1 → rec2 → rec3), die älteste wird gelöscht. Wird die Anzahl verringert, werden die überzähligen Dateien und Datenpunkte beim nächsten Start entfernt. Der Speicherplatz bleibt fest: Anzahl × Maximalgröße pro Kamera. Aufnahmen über der *Maximalgröße* (Standard 50 MB) werden mit einem Info-Log übersprungen. `ts1` wird **zuletzt** geschrieben, wenn die Datei vollständig ist — als Trigger verwenden.
483
+
484
+ **Einschränkung Dateispeicher:** `file1`–`file3` enthalten nur dann einen Pfad, wenn der ioBroker-Dateispeicher auf der lokalen Platte liegt (Standard: Datei-/jsonl-Objekt-DB). Mit Redis oder einer anderen nicht dateibasierten Objekt-DB bleiben sie leer — dann `uri*` (Telegram ab 6, Skripte) oder `url*` verwenden, die mit jedem Speicher funktionieren.
485
+
486
+ ### Was passiert, wenn…
487
+
488
+ - **…die Option eingeschaltet wird:** beim nächsten Start (Speichern der Einstellungen startet die Instanz neu) bekommt jede ausgewählte Kamera ihre aktuelle letzte Aufnahme, wenn Platz 1 leer ist oder eine ältere enthält — eine Kamera nach der anderen, mit Größenlimit. Danach wird jede neue Aufnahme abgelegt, sobald sie erscheint.
489
+ - **…eine Kamera neu ausgewählt wird:** wie oben, sie bekommt sofort ihre aktuelle letzte Aufnahme.
490
+ - **…in AgentDVR eine Kamera hinzukommt:** sie erscheint beim nächsten Poll (die Kameraliste in den Einstellungen kommt live von der laufenden Instanz); mit *Alle Kameras* wird sie wie die anderen befüllt und gespeichert.
491
+ - **…eine Kamera abgewählt wird:** beim nächsten Start werden ihre `recordings`-Datenpunkte und ihre Dateien `rec1`–`rec3` und `send.*` gelöscht.
492
+ - **…die Option ausgeschaltet wird:** beim nächsten Start werden die `recordings`-Datenpunkte und die `rec*`/`send.*`-Dateien aller Kameras gelöscht.
493
+ - **…eine Kamera aus AgentDVR entfernt wird:** ihre Datenpunkte werden wie bisher entfernt, und ihr ganzer Ordner im Dateispeicher (`agent-dvr.0/<cam>/` — Aufnahmen, `send.*` und Alarmfotos) wird gelöscht. Meldet AgentDVR plötzlich gar keine Kamera, wird nichts gelöscht (vermutlich ein Aussetzer).
494
+ - **…eine ausgewählte Kamera nicht mehr existiert:** die Einstellungen zeigen sie als *„<cam> (nicht mehr in AgentDVR)“*, damit man sie abwählen kann; der Adapter ignoriert sie einfach.
495
+
496
+ `send.mp4|mkv` (von `sendRecording`/`getRecording` für Aufnahmen, die in keinem Platz liegen) bleibt bestehen, bis die Aufnahmen der Kamera aufgeräumt werden — eine Datei pro Kamera, wird jedes Mal überschrieben.
497
+
498
+ ### MP4 und ffmpeg
499
+
500
+ AgentDVR nimmt als MKV auf. Mit **Als MP4 bereitstellen** (Standard: an) packt der Adapter die MKV mit ffmpeg in MP4 um — nur der Container ändert sich, Video und Ton werden kopiert, das dauert deutlich unter einer Sekunde. HEVC-Videos (H.265) bekommen das `hvc1`-Tag, damit Apple-Geräte und Telegram sie abspielen. Passt der Audio-Codec nicht in MP4, wird ohne Ton umgepackt (einmal geloggt). Ohne ffmpeg wird die MKV unverändert bereitgestellt (ein Info-Log).
501
+
502
+ ffmpeg wird **nicht** mitgeliefert. Der Adapter sucht es beim Start und auf Anforderung: Einstellung *ffmpeg-Pfad* → `ffmpeg` über `PATH` → `/usr/bin/ffmpeg`, `/usr/local/bin/ffmpeg`, `/opt/homebrew/bin/ffmpeg`, `C:\ffmpeg\bin\ffmpeg.exe`, `%ProgramFiles%\ffmpeg\bin\ffmpeg.exe`. Das Ergebnis steht in `info.ffmpeg` (z. B. `6.1.1 (/usr/bin/ffmpeg)` oder `not found`) und in den Einstellungen neben der MP4-Option, mit einem Knopf **Erneut suchen**. ffmpeg mit dem Paketmanager des Systems installieren:
503
+
504
+ | System | Befehl |
505
+ |---|---|
506
+ | Debian, Ubuntu, Raspberry Pi OS | `apt install ffmpeg` |
507
+ | Alpine (Docker) | `apk add ffmpeg` |
508
+ | Fedora | `dnf install ffmpeg` |
509
+ | macOS (Homebrew) | `brew install ffmpeg` |
510
+ | Windows | `winget install ffmpeg` |
511
+
512
+ Den Befehl wie auf dem System üblich als Administrator/root ausführen. Danach in den Einstellungen *Erneut suchen* drücken (oder die Instanz neu starten).
513
+
514
+ ### Aufnahmen verschicken: `sendRecording` und `getRecording`
515
+
516
+ `sendRecording` stellt eine Aufnahme im Dateispeicher des Adapters bereit und schickt sie als Video an eine Messenger-Instanz. Eine bereits gespeicherte Aufnahme (`recordings.*`) wird direkt verwendet; jede andere wird in den Arbeitsspeicher geladen, auf Wunsch in MP4 umgewandelt und in eine feste Datei pro Kamera geschrieben, `agent-dvr.0/<cam>/send.mp4` (bzw. `.mkv`), die jedes Mal überschrieben wird — der Speicherplatz bleibt also fest:
517
+
518
+ ```js
519
+ sendTo('agent-dvr.0', 'sendRecording', {
520
+ camera: 'cam_8_Reolink', // Ordner-ID, AgentDVR-oid (8) oder Kameraname
521
+ recording: 'last', // 'last' (neueste in AgentDVR), 1-3 (gespeicherter Platz) oder ein AgentDVR-Dateiname
522
+ target: 'telegram.0', // Instanz, die das Video bekommt
523
+ caption: 'Bewegung an der Haustür',
524
+ // user: 'Max', chatId: 123, // optional, wird an Telegram durchgereicht
525
+ // mp4: true, // optional, übersteuert „Als MP4 bereitstellen"
526
+ }, res => {
527
+ if (!res.ok) log(res.error, 'warn'); // z. B. zu groß für Telegram
528
+ });
529
+ ```
530
+
531
+ Die Nachricht an das Ziel ist `{ text: 'iobfile://agent-dvr.0/<cam>/<datei>', type: 'video', fileName: '<name>.mp4', caption, user, chatId }` — Telegram ab Version 6 liest die Datei selbst aus dem Dateispeicher. Andere Ziele bekommen stattdessen den absoluten Dateipfad (bzw. die URI, wenn der Dateispeicher nicht auf der lokalen Platte liegt). Die Antwort ist `{ ok, error?, fileName, format, mime, size, uri, url, file }`. **Telegram-Bots können nur Dateien bis 50 MB senden**; größere Aufnahmen werden mit einer klaren Fehlermeldung abgelehnt — schon vor dem Download, wenn AgentDVR die Größe bereits listet.
532
+
533
+ > **Über den ioBroker-Nachrichtenbus gehen keine Videodaten.** Große Nachrichten (zig MB) können die States-DB und damit den ganzen ioBroker blockieren. Deshalb gibt der Adapter nur den Dateiverweis weiter und verweigert jede Nachricht oder Antwort mit Binärdaten.
534
+
535
+ Jede neue Aufnahme an Telegram schicken (ohne Blockly):
536
+
537
+ ```js
538
+ on({ id: 'agent-dvr.0.cam_8_Reolink.events.new', val: true }, () => {
539
+ sendTo('agent-dvr.0', 'sendRecording', { camera: 'cam_8_Reolink', recording: 'last', target: 'telegram.0', caption: 'Neue Aufnahme' });
540
+ });
541
+ ```
542
+
543
+ Ist der Dateispeicher eingeschaltet, stattdessen auf `recordings.ts1` triggern und die gespeicherte Kopie senden (`recording: 1`) — oder Telegram ab 6 liest sie selbst: `sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.recordings.uri1').val, type: 'video' })`.
544
+
545
+ `getRecording` nimmt dieselben `camera`, `recording` und `mp4`, stellt die Aufnahme genauso bereit und liefert nur, wo sie liegt: `{ ok, error?, fileName, mime, format, size, uri, url, file }`. Die Datei liest das Skript selbst, z. B.:
546
+
547
+ ```js
548
+ sendTo('agent-dvr.0', 'getRecording', { camera: 'cam_8_Reolink', recording: 'last' }, res => {
549
+ if (!res.ok) return log(res.error, 'warn');
550
+ // res.uri = 'iobfile://agent-dvr.0/cam_8_Reolink/send.mp4', res.url = http-Link, res.file = lokaler Pfad
551
+ readFile('agent-dvr.0', res.uri.replace('iobfile://agent-dvr.0/', ''), (err, data) => { /* … */ });
552
+ });
553
+ ```
554
+
449
555
  ## Bilder für VIS und Skripte
450
556
 
451
557
  ### Welches Bild woher
@@ -509,6 +615,13 @@ z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (ebe
509
615
  Placeholder for the next version (at the beginning of the line):
510
616
  ### **WORK IN PROGRESS**
511
617
  -->
618
+ ### 0.9.0 (2026-11-12)
619
+ * (ipod86) feat: die letzten 1–3 Aufnahmen pro Kamera im ioBroker-Dateispeicher (`recordings.file/uri/url/name/ts`), auf Wunsch als MP4 über ffmpeg
620
+ * (ipod86) feat: `sendRecording` / `getRecording` schicken eine Aufnahme als Video an Telegram oder stellen sie als Datei für Skripte bereit
621
+ * (ipod86) feat: Erstbefüllung beim Einschalten; Aufnahmen und Dateien werden beim Abschalten, Abwählen oder Entfernen der Kamera aufgeräumt
622
+ * (ipod86) feat: ffmpeg-Erkennung mit Status in den Einstellungen und `info.ffmpeg`
623
+ * (ipod86) fix: die Einstellungsseite nutzt alle 11 Sprachen
624
+
512
625
  ### 0.8.1 (2026-11-12)
513
626
  * (ipod86) fix: Live-Übersicht (Web-Komponente) passt ihre Kacheln an die Widget-Größe an (kein Scrollen, kein Leerraum); Option „An die Widget-Größe anpassen“
514
627
  * (ipod86) chore: Beschreibung und Suchbegriffe nennen die Widgets für vis-2 und AURA
package/README.md CHANGED
@@ -32,6 +32,12 @@ The recordings gallery, the live tile and the live overview are also available a
32
32
  - optionally takes the colors of the visualization's theme
33
33
  - needs no credentials: the images and videos use the same AgentDVR links as the HTML widgets; data comes from `widget_config` and `<cam>.widget_data`
34
34
 
35
+ ### Recordings in the ioBroker file storage and as Telegram video
36
+ - **Provide the last recordings in the ioBroker file storage** (off by default): every new recording of a camera is downloaded from AgentDVR and kept as `rec1` … `rec3` per camera — with file path, `iobfile://` URI and http URL in `<cam>.recordings.*`, just like the alert photos
37
+ - optionally as **MP4** (lossless remux with ffmpeg, no re-encoding) — plays everywhere, also inline in Telegram
38
+ - **`sendRecording`** sends the last, a stored or any recording straight to Telegram (or another instance) as video; **`getRecording`** makes it available as a file for your own scripts
39
+ - details: [Recordings in the file storage](#recordings-in-the-file-storage)
40
+
35
41
  ## Features
36
42
 
37
43
  - Auto-discovery of all AgentDVR cameras on startup (microphones excluded)
@@ -88,6 +94,20 @@ The recordings gallery, the live tile and the live overview are also available a
88
94
  | Setting | Description | Default |
89
95
  |---------|-------------|---------|
90
96
  | Event data points | Mirror recording metadata (latest event, count, tags, …) per camera | `true` |
97
+ | Save alert photos | Store the photo of every webhook alert in the file storage (see [Alert photos](#alert-photos)) | `true` |
98
+ | Web instance for photo links | Web instance used for the `url*` links of alert photos and recordings | automatic |
99
+
100
+ **Recordings in the file storage** — see [Recordings in the file storage](#recordings-in-the-file-storage)
101
+
102
+ | Setting | Description | Default |
103
+ |---------|-------------|---------|
104
+ | Provide the last recordings in the ioBroker file storage | Download every new recording and keep it per camera | `false` |
105
+ | Cameras | All cameras or a selection (the list needs a running instance) | all |
106
+ | Number of stored recordings per camera | 1, 2 or 3 (`rec1` = newest) | `1` |
107
+ | Maximum size (MB) | Larger recordings are skipped with an info log; also the limit for `sendRecording`/`getRecording` | `50` |
108
+ | Download timeout (s) | Download and conversion of one recording (10–900) | `120` |
109
+ | Provide as MP4 | Remux MKV to MP4 with ffmpeg (no re-encoding); without ffmpeg the MKV is kept | `true` |
110
+ | ffmpeg path | Empty = automatic search | — |
91
111
 
92
112
  **Display**
93
113
 
@@ -399,6 +419,7 @@ This adapter stores your AgentDVR admin credentials and exposes `system.control.
399
419
  | Data point | Type | R/W | Description |
400
420
  |-----------|------|-----|-------------|
401
421
  | `<cam>.events.*` | various | R | Latest recording metadata — requires "Event data points" |
422
+ | `<cam>.recordings.*` | various | R | Stored recordings (`file1`, `uri1`, `url1`, `name1`, `ts1`, …) — requires "Provide the last recordings in the ioBroker file storage" |
402
423
  | `<cam>.widget_recordings` | string | R | HTML recording gallery — requires "Gallery widget" |
403
424
  | `<cam>.widget_live` | string | R | HTML single-camera live tile — requires "Gallery widget"; snapshot refreshes on each adapter poll |
404
425
  | `<cam>.widget_data` | string | R | Recordings as JSON for the web components (latest 500) — requires "Gallery widget" or "Event data points" |
@@ -451,6 +472,91 @@ Files: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (e.g. `agent-dvr.0/cam_8_Re
451
472
  | `widget_live_overview` | string | R | HTML tile grid of all cameras — snapshot refreshes on each adapter poll |
452
473
  | `widget_config` | string | R | Widget settings, cameras and texts as JSON for the web components (always written, no credentials) |
453
474
 
475
+ ## Recordings in the file storage
476
+
477
+ With **Provide the last recordings in the ioBroker file storage** (*Features* tab, off by default) the adapter downloads every new recording of a camera from AgentDVR as soon as it shows up in the recording list (the moment `<cam>.events.new` pulses — so *Event data points* must be on) and stores it in the ioBroker file storage. The download goes into memory, never into a temporary file. Like the alert photos, the last 1, 2 or 3 recordings per camera are kept (setting *Number of stored recordings per camera*, default 1):
478
+
479
+ | Data point | Content |
480
+ |---|---|
481
+ | `<cam>.recordings.file1` … `file3` | Absolute file path, e.g. `/opt/iobroker/iobroker-data/files/agent-dvr.0/cam_8_Reolink/rec1.mp4` (`1` = newest) |
482
+ | `<cam>.recordings.uri1` … `uri3` | ioBroker file URI, e.g. `iobfile://agent-dvr.0/cam_8_Reolink/rec1.mp4` |
483
+ | `<cam>.recordings.url1` … `url3` | http(s) URL via the web instance, e.g. `http://192.168.1.10:8082/agent-dvr.0/recordings/cam_8_Reolink/rec1.mp4` (supports seeking) |
484
+ | `<cam>.recordings.name1` … `name3` | Original AgentDVR file name, e.g. `8_2026-11-12_15-55-29_931.mkv` |
485
+ | `<cam>.recordings.ts1` … `ts3` | Time of the recording |
486
+
487
+ Files: `<namespace>/<cam>/rec1.mp4` (or `.mkv`) … `rec3`. On each new recording they rotate (rec1 → rec2 → rec3), the oldest one is deleted. When you lower the number, the surplus files and data points are removed at the next start. The disk space stays fixed: number × maximum size per camera. Recordings larger than *Maximum size* (default 50 MB) are skipped with an info log. `ts1` is written **last**, after the file is complete — use it as trigger.
488
+
489
+ **Storage limitation:** `file1`–`file3` only contain a path when the ioBroker file storage is on the local disk (default file/jsonl objects DB). With Redis or another non-file objects DB they stay empty — use `uri*` (Telegram 6+, scripts) or `url*` instead, which work with every storage.
490
+
491
+ ### What happens when…
492
+
493
+ - **…the option is switched on:** at the next start (saving the settings restarts the instance) every selected camera gets its current last recording, if slot 1 is empty or holds an older one — one camera after the other, with the size limit. After that each new recording is stored as it appears.
494
+ - **…a camera is newly selected:** same as above, it gets its current last recording right away.
495
+ - **…a new camera is added in AgentDVR:** it shows up at the next poll (the camera list in the settings is read live from the running instance); with *All cameras* it is filled and stored like the others.
496
+ - **…a camera is deselected:** at the next start its `recordings` data points and its files `rec1`–`rec3` and `send.*` are deleted.
497
+ - **…the option is switched off:** at the next start the `recordings` data points and the `rec*`/`send.*` files of all cameras are deleted.
498
+ - **…a camera is removed from AgentDVR:** its data points are removed as before, and its whole folder in the file storage (`agent-dvr.0/<cam>/` — recordings, `send.*` and alert photos) is deleted. If AgentDVR suddenly reports no camera at all, nothing is deleted (assumed to be a hiccup).
499
+ - **…a selected camera no longer exists:** the settings list it as *"<cam> (no longer in AgentDVR)"* so you can uncheck it; the adapter simply ignores it.
500
+
501
+ `send.mp4|mkv` (used by `sendRecording`/`getRecording` for recordings that are not in a slot) stays until the camera's recordings are cleaned up — one file per camera, overwritten each time.
502
+
503
+ ### MP4 and ffmpeg
504
+
505
+ AgentDVR records MKV. With **Provide as MP4** (default on) the adapter remuxes the MKV to MP4 with ffmpeg — only the container changes, video and audio are copied, so it takes well under a second. HEVC (H.265) videos get the `hvc1` tag so Apple devices and Telegram play them. If the audio codec does not fit into MP4, the video is remuxed without audio (logged once). Without ffmpeg the MKV is provided unchanged (one info log).
506
+
507
+ ffmpeg is **not** bundled. The adapter looks for it at start and on demand: the *ffmpeg path* setting → `ffmpeg` via `PATH` → `/usr/bin/ffmpeg`, `/usr/local/bin/ffmpeg`, `/opt/homebrew/bin/ffmpeg`, `C:\ffmpeg\bin\ffmpeg.exe`, `%ProgramFiles%\ffmpeg\bin\ffmpeg.exe`. The result is in `info.ffmpeg` (e.g. `6.1.1 (/usr/bin/ffmpeg)` or `not found`) and in the settings next to the MP4 option, with a **Search again** button. Install ffmpeg with the package manager of your system:
508
+
509
+ | System | Command |
510
+ |---|---|
511
+ | Debian, Ubuntu, Raspberry Pi OS | `apt install ffmpeg` |
512
+ | Alpine (Docker) | `apk add ffmpeg` |
513
+ | Fedora | `dnf install ffmpeg` |
514
+ | macOS (Homebrew) | `brew install ffmpeg` |
515
+ | Windows | `winget install ffmpeg` |
516
+
517
+ Run the command as administrator/root as usual on your system. Afterwards press *Search again* in the settings (or restart the instance).
518
+
519
+ ### Sending recordings: `sendRecording` and `getRecording`
520
+
521
+ `sendRecording` makes a recording available in the adapter's file storage and sends it to a messenger instance as video. A recording that is already stored (`recordings.*`) is used directly; any other one is downloaded into memory, converted to MP4 if wanted and written to a fixed file per camera, `agent-dvr.0/<cam>/send.mp4` (or `.mkv`), which is overwritten each time — so the space stays fixed:
522
+
523
+ ```js
524
+ sendTo('agent-dvr.0', 'sendRecording', {
525
+ camera: 'cam_8_Reolink', // folder id, AgentDVR oid (8) or camera name
526
+ recording: 'last', // 'last' (newest in AgentDVR), 1-3 (stored slot) or an AgentDVR file name
527
+ target: 'telegram.0', // instance that gets the video
528
+ caption: 'Motion at the front door',
529
+ // user: 'Max', chatId: 123, // optional, passed through to Telegram
530
+ // mp4: true, // optional, overrides "Provide as MP4"
531
+ }, res => {
532
+ if (!res.ok) log(res.error, 'warn'); // e.g. too large for Telegram
533
+ });
534
+ ```
535
+
536
+ The message to the target is `{ text: 'iobfile://agent-dvr.0/<cam>/<file>', type: 'video', fileName: '<name>.mp4', caption, user, chatId }` — Telegram 6 and newer reads the file itself from the file storage. Other targets get the absolute file path instead (or the URI if the file storage is not on the local disk). The answer is `{ ok, error?, fileName, format, mime, size, uri, url, file }`. **Telegram bots can only send files up to 50 MB**; larger recordings are rejected with a clear error — before downloading when AgentDVR already lists the size.
537
+
538
+ > **No video data goes over the ioBroker message bus.** Large messages (tens of MB) can block the states DB and with it the whole ioBroker. That is why the adapter passes only the file reference and refuses to send or answer anything that contains binary data.
539
+
540
+ Send every new recording to Telegram (no Blockly needed):
541
+
542
+ ```js
543
+ on({ id: 'agent-dvr.0.cam_8_Reolink.events.new', val: true }, () => {
544
+ sendTo('agent-dvr.0', 'sendRecording', { camera: 'cam_8_Reolink', recording: 'last', target: 'telegram.0', caption: 'New recording' });
545
+ });
546
+ ```
547
+
548
+ With the file storage feature enabled, trigger on `recordings.ts1` and send the stored copy instead (`recording: 1`) — or let Telegram 6+ read it itself: `sendTo('telegram.0', { text: getState('agent-dvr.0.cam_8_Reolink.recordings.uri1').val, type: 'video' })`.
549
+
550
+ `getRecording` takes the same `camera`, `recording` and `mp4`, makes the recording available the same way and returns only where it is: `{ ok, error?, fileName, mime, format, size, uri, url, file }`. Read the file in your script yourself, e.g.:
551
+
552
+ ```js
553
+ sendTo('agent-dvr.0', 'getRecording', { camera: 'cam_8_Reolink', recording: 'last' }, res => {
554
+ if (!res.ok) return log(res.error, 'warn');
555
+ // res.uri = 'iobfile://agent-dvr.0/cam_8_Reolink/send.mp4', res.url = http link, res.file = local path
556
+ readFile('agent-dvr.0', res.uri.replace('iobfile://agent-dvr.0/', ''), (err, data) => { /* … */ });
557
+ });
558
+ ```
559
+
454
560
  ## Getting images for VIS and scripts
455
561
 
456
562
  ### Which image from where
@@ -509,6 +615,13 @@ http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
509
615
  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`. The same applies when you push the link to a TV or another app: send it on `alertPhotos.ts1`, not on `events.webhook` — otherwise the app loads the previous photo. For a live image use `urls.snapshot` or `urls.photo` with a refresh interval.
510
616
 
511
617
  ## Changelog
618
+ ### 0.9.0 (2026-11-12)
619
+ * (ipod86) feat: keep the last 1–3 recordings per camera in the ioBroker file storage (`recordings.file/uri/url/name/ts`), optionally as MP4 via ffmpeg
620
+ * (ipod86) feat: `sendRecording` / `getRecording` send a recording to Telegram as video or provide it as a file for scripts
621
+ * (ipod86) feat: initial fill on enabling; recordings and files are cleaned up when switched off, deselected or the camera is removed
622
+ * (ipod86) feat: ffmpeg detection with status in the settings and `info.ffmpeg`
623
+ * (ipod86) fix: the settings page uses all 11 languages
624
+
512
625
  ### 0.8.1 (2026-11-12)
513
626
  * (ipod86) fix: live overview web component fits its tiles to the widget size (no scrolling, no empty space); option "Fit to the widget size"
514
627
  * (ipod86) chore: description and keywords mention the widgets for vis-2 and AURA
@@ -532,15 +645,6 @@ e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also
532
645
 
533
646
  <!-- markdownlint-disable-next-line MD024 -->
534
647
 
535
- ### 0.5.5 (2026-10-08)
536
- * (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
537
- * (ipod86) feat: configurable live-tile refresh interval (`widgetLiveRefreshSec`) — trade thumbnail freshness against keeping an open video modal open, since rewriting the widget's HTML state resets it
538
- * (ipod86) feat: optional full-JS live-tile refresh mode (`widgetLiveMode`) — refreshes only the snapshot image via a small embedded script, so an open video modal never closes regardless of refresh frequency (requires script execution, same tradeoff as the existing gallery JS mode)
539
- * (ipod86) feat: live widgets now share the gallery's theme colors, thumbnail size and compact setting, which previously only applied to the recordings widget
540
- * (ipod86) refactor: reorganized the Widget settings panel into clearly scoped General / Recordings Widget / Live Widget / Theme sections with a proper two-level heading hierarchy, instead of one long section whose subsections looked like independent categories
541
-
542
- <!-- markdownlint-disable-next-line MD024 -->
543
-
544
648
  [Older changelog entries in CHANGELOG_OLD.md](CHANGELOG_OLD.md)
545
649
 
546
650
  ## License