[dahuadoor] Restore snapshots and enforce retention - #20692
Merged
Conversation
Signed-off-by: Sven Schad <svnsssd@gmail.com>
Signed-off-by: Sven Schad <svnsssd@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds snapshot persistence and retention management to the DahuaDoor binding so door-image channels can be restored after restarts and disk usage is bounded via a new maxImages configuration parameter.
Changes:
- Persist the latest snapshot to a stable filename and restore it during handler initialization (VTO2202 and VTO3211, per-button for VTO3211).
- Add retention cleanup for timestamped snapshot files controlled by new
maxImagesthing configuration. - Update thing-type XML, i18n properties, and README to document/configure the new behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| bundles/org.openhab.binding.dahuadoor/src/main/resources/OH-INF/thing/vto3211.xml | Adds maxImages config parameter (per-button retention) for VTO3211. |
| bundles/org.openhab.binding.dahuadoor/src/main/resources/OH-INF/thing/vto2202.xml | Adds maxImages config parameter for VTO2202. |
| bundles/org.openhab.binding.dahuadoor/src/main/resources/OH-INF/i18n/dahuadoor.properties | Adds i18n label/description strings for maxImages. |
| bundles/org.openhab.binding.dahuadoor/src/main/java/org/openhab/binding/dahuadoor/internal/DahuaVto3211Handler.java | Restores latest snapshots for both buttons on startup; saves per-button snapshots. |
| bundles/org.openhab.binding.dahuadoor/src/main/java/org/openhab/binding/dahuadoor/internal/DahuaVto2202Handler.java | Restores latest snapshot on startup; uses shared image update helper. |
| bundles/org.openhab.binding.dahuadoor/src/main/java/org/openhab/binding/dahuadoor/internal/DahuaDoorConfiguration.java | Adds maxImages field with default of 20. |
| bundles/org.openhab.binding.dahuadoor/src/main/java/org/openhab/binding/dahuadoor/internal/DahuaDoorBaseHandler.java | Implements latest snapshot write/read, generalized image channel updates, and retention cleanup logic. |
| bundles/org.openhab.binding.dahuadoor/README.md | Documents maxImages and snapshot persistence behavior (but currently contains a filename mismatch). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sven Schad <svnsssd@gmail.com>
markus7017
pushed a commit
to markus7017/openhab-addons
that referenced
this pull request
May 19, 2026
* [dahuadoor] add door image persistence on startup Signed-off-by: Sven Schad <svnsssd@gmail.com>
markus7017
pushed a commit
to markus7017/openhab-addons
that referenced
this pull request
Jun 13, 2026
* [dahuadoor] add door image persistence on startup Signed-off-by: Sven Schad <svnsssd@gmail.com>
darkscout
pushed a commit
to darkscout/openhab-addons
that referenced
this pull request
Jul 5, 2026
* [dahuadoor] add door image persistence on startup Signed-off-by: Sven Schad <svnsssd@gmail.com>
olemr
pushed a commit
to olemr/openhab2-addons
that referenced
this pull request
Aug 8, 2026
* [dahuadoor] add door image persistence on startup Signed-off-by: Sven Schad <svnsssd@gmail.com> Signed-off-by: olemr <olemr@olemr.com>
cipianpascu
pushed a commit
to cipianpascu/openhab-addons
that referenced
this pull request
Aug 16, 2026
* [dahuadoor] add door image persistence on startup Signed-off-by: Sven Schad <svnsssd@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds snapshot persistence and retention handling for the DahuaDoor binding. The latest snapshot is written to Doorbell.jpg and restored on startup so door-image channels recover after restarts. Timestamped snapshots use the Doorbell_ prefix and are trimmed by the new maxImages parameter to limit disk usage while keeping the latest file intact.
Testing
Verified latest snapshot restoration after restart and maxImages cleanup with repeated doorbell presses.