Skip to content

Add per-call image queue expiry#64

Open
LordMike wants to merge 1 commit into
OpenDisplay:feat/clean-portfrom
LordMike:feat/custom-image-expiry
Open

Add per-call image queue expiry#64
LordMike wants to merge 1 commit into
OpenDisplay:feat/clean-portfrom
LordMike:feat/custom-image-expiry

Conversation

@LordMike

@LordMike LordMike commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Why

Queued image delivery currently uses one integration-wide expiry timeout. That works as a default, but not every image has the same useful lifetime. In my experience, the lifetime / expiry for a drawcustom was 24 hours. Seems arbitrary. A notification-style drawcustom image may only be relevant for a few minutes. A dashboard/status frame may be fine to deliver much later. Some "set this display to this state eventually" updates may not need a time-based expiry at all.

This PR lets the service caller express that intent per image, while keeping the existing integration option as the default when no override is provided.

What Changed

  • Added optional expire to opendisplay.drawcustom and opendisplay.upload_image.
  • expire accepts Home Assistant duration values.
  • Omitted expire keeps the existing default queue timeout.
  • expire: 0 means no time-based expiry.
  • The service layer normalizes expiry early to seconds, so the delivery manager receives only expire_seconds or None.
  • Queued uploads with finite expiry schedule the existing expiry timer.
  • Queued uploads with no time-based expiry skip timer scheduling and return expires_at: null.
  • The existing update-pending entity continues to expose expires_at; no time-based expiry is represented as null.

Example

action: opendisplay.drawcustom
target:
  device_id: (device)
data:
  background: white
  rotate: 0
  expire:
    minutes: 10
  dither: none
  refresh_type: full
  measured_palette: false
  dry-run: false
  payload:
    - type: text
      visible: true
      value: Hello World
      x: 31
      "y": 18
      size: 20
      color: black
      font: ppb.ttf

Validation

  • PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/mnt/n/Personal/opendisplay-work/Home_Assistant_Integration /home/mike/.venvs/hass-dev/bin/python -m pytest -q tests -p no:cacheprovider
  • Result: 52 passed
  • Manually verified drawcustom with a short custom expiry returns an expires_at matching the requested lifetime.

@LordMike
LordMike requested a review from g4bri3lDev as a code owner July 16, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant