Skip to content

feat: add optional OCI image version to container state attributes#2

Open
RF1705 wants to merge 1 commit into
finder39:mainfrom
RF1705:version
Open

feat: add optional OCI image version to container state attributes#2
RF1705 wants to merge 1 commit into
finder39:mainfrom
RF1705:version

Conversation

@RF1705

@RF1705 RF1705 commented May 22, 2026

Copy link
Copy Markdown
Title: Add optional OCI image version attribute to container sensors

## Summary

This PR exposes the optional OCI image version from Dockge service data as a Home Assistant container sensor attribute.

When Dockge provides a service-level `imageVersion` value, the integration now publishes it as:

```yaml
image_version: 2026.5.4

Why

Many container images use stable or generic tags, while the real application version is stored in the OCI image label:

org.opencontainers.image.version

For example:

image: ghcr.io/home-assistant/home-assistant:stable
image_tag: stable
image_version: 2026.5.4

This gives Home Assistant users a more useful version value without losing the existing image tag.

Changes

  • Adds image_version to DockgeContainerSensor attributes.
  • Reads the value from Dockge’s optional imageVersion service field.
  • Updates the README container sensor description.
  • Keeps existing behavior unchanged when imageVersion is not present.

Compatibility

This is backward-compatible with older Dockge API versions.

If Dockge does not provide imageVersion, the attribute is simply null, while existing attributes such as image, image_name, and image_tag continue to work as before.

Example

Before:

image: ghcr.io/home-assistant/home-assistant:stable
image_name: ghcr.io/home-assistant/home-assistant
image_tag: stable

After:

image: ghcr.io/home-assistant/home-assistant:stable
image_name: ghcr.io/home-assistant/home-assistant
image_tag: stable
image_version: 2026.5.4

Testing

Validated Python syntax with:

PYTHONPYCACHEPREFIX=/private/tmp/dockge-ha-pycache python3 -m compileall custom_components/dockge

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