Collection image

The Collection image integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] creates an image entity based on one or more media source folders selected during integration setup. From the selected folders, a single image is randomly chosen and shown in the image entity. This image entity can be used to display a dynamic picture in a frontend picture card, or as a dynamic view background.

Configuration

To add the Collection image service to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select Collection image.

  • Follow the instructions on screen to complete the setup.

Media

The media folders from which images will be chosen.

List of actions

The Collection image integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following actions. Each link below opens a dedicated page with examples, parameters, and a step-by-step UI walkthrough.

  • Select first (collection_image.select_first) Update the image entity to the first image from the configured media.

  • Select image (collection_image.select_image) Update the image entity to the selected image.

  • Select last (collection_image.select_last) Update the image entity to the last image from the configured media.

  • Select next (collection_image.select_next) Update the image entity to the next image from the configured media.

  • Select previous (collection_image.select_previous) Update the image entity to the previous image from the configured media.

  • Shuffle (collection_image.shuffle) Update the image entity to a random image from the configured media.

For an overview of every action across all integrations, see the actions reference.

Example usage

When running the configuration flow, you are prompted to choose one or more media directories. The integration assumes you have already set up either a local media source or another integration providing a media source. In the pop-up media browser, go to the folder containing your desired images. To select a folder, at the top of the dialog, select the Pick option. To finish the configuration flow, select Create. For example, if you pick a folder called Family Pictures, this will create a new entity called image.family_pictures_collection. This entity can be used in one of two ways:

  • A card like a picture card can use the image entity directly. Create a new card on the frontend and in the entity browser, find your new image entity. Click it and select a picture card, and it will be placed on your dashboard, showing a random picture from the collection. Anytime you call the shuffle service targeting this entity, a new image will be chosen and automatically update the dashboard. You can even set the picture card with a tap action to shuffle on click, so a new image will be cycled anytime you click on the card (example):
type: picture
image_entity: image.family_pictures_collection
tap_action:
  action: perform-action
  perform_action: collection_image.shuffle
  target:
    entity_id: image.family_pictures_collection
  • Another option is using this image entity as a dashboard background. In this case you will not target the image entity directly, but pick its corresponding element in the media browser. In the view background options, click “Select from media” to launch the media browser again. In this case choose the top level “Image” folder, and inside this there will be an item called ‘Family Pictures Collection’. This can also be dynamically shuffled based on any automation or UI button of your choice.

Removing the integration

This integration follows standard integration removal. No extra steps are required.

To remove an integration instance from Home Assistant

  1. Go to Settings > Devices & services and select the integration card.
  2. From the list of devices, select the integration instance you want to remove.
  3. Next to the entry, select the three dots menu. Then, select Delete.