Skip to content

[dahuadoor] Restore snapshots and enforce retention - #20692

Merged
lsiepel merged 3 commits into
openhab:mainfrom
svnsssd:dahua-image-persistence
May 13, 2026
Merged

[dahuadoor] Restore snapshots and enforce retention#20692
lsiepel merged 3 commits into
openhab:mainfrom
svnsssd:dahua-image-persistence

Conversation

@svnsssd

@svnsssd svnsssd commented May 9, 2026

Copy link
Copy Markdown
Contributor

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.

svnsssd added 2 commits May 9, 2026 09:51
Signed-off-by: Sven Schad <svnsssd@gmail.com>
Signed-off-by: Sven Schad <svnsssd@gmail.com>
@lsiepel
lsiepel requested a review from Copilot May 11, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 maxImages thing 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.

Comment thread bundles/org.openhab.binding.dahuadoor/README.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sven Schad <svnsssd@gmail.com>
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label May 13, 2026

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@lsiepel
lsiepel merged commit 2280431 into openhab:main May 13, 2026
3 of 4 checks passed
@lsiepel lsiepel added this to the 5.2 milestone May 13, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants