A highly customizable Lovelace card to display photo snapshots in a dynamic carousel, supporting local files, external JSON descriptions, and various styling options
-
📁 Flexible Photo Sources
- Inline
photosin the card config. - JSON file (
description_file.json) with image paths and captions.
- Inline
-
🔄 Carousel Features
- Autoplay with adjustable delay.
- Swipe support for mobile.
- Pagination dots and arrow navigation.
-
🧠 Smart Filtering
max_items_to_show: Limit number of photos shown.max_days_to_show: Filter photos based on age.
-
🎨 Styling & Customization
- Show/hide timestamp.
- Customize title, timestamp, and caption colors and fonts.
-
🖱️ Intuitive Controls
- Arrows, dots, touch, and mouse dragging.
-
🔔 Doorbell Image Analysis Integration
- Perfectly suited for displaying doorbell camera snapshots and AI-generated descriptions, especially when paired with the Doorbell image analysis Blueprints repository.
- Go to HACS > Frontend > "+ Explore & Download Repositories"
- Paste this repository URL:
https://github.com/hammadbinarif/photo-carousel-card - Choose Lovelace as category.
- Install and refresh your browser.
- Add it as a resource if not auto-added:
resources:
- url: /local/photo-carousel-card/photo-carousel-card.js
type: module- Download the latest
photo-carousel-card.jsfrom the Releases. - Place it in
/config/www/photo-carousel-card/on your Home Assistant instance. - Add the resource to your Lovelace configuration:
resources:
- url: /hacsfiles/photo-carousel-card/photo-carousel-card.js
type: moduleThe Photo Carousel Card can be configured using the visual editor in Lovelace, or directly in YAML.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
type |
string |
Yes | custom:photo-carousel-card |
The card type. |
title |
string |
No | Photo Carousel |
The main title of the card. |
description_file_path |
string |
No | Path to a .txt or .json file with photo details (e.g., /local/events.json). |
|
photos |
list |
No | [] |
A list of photo objects if defining them inline. (See example below). |
autoplay |
number |
No | 5000 |
Delay in milliseconds between slides (0 or false to disable). |
reload_interval_minutes |
number |
No | 0 |
How often to reload the description file in minutes (0 to disable). |
max_items_to_show |
number |
No | 30 |
Maximum number of photos to display (0 for no limit). |
max_days_to_show |
number |
No | 0 |
Only show photos from the last X days based on timestamp (0 for no limit). |
Each style option (title_style, timestamp_style, description_style) is an object with the following sub-properties:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
show_title |
boolean |
No | true |
Display the text (title, timestamp, or description). |
font_color |
string |
No | null |
CSS color value (e.g., red, #FF0000, var(--primary-color)). |
font_size |
string |
No | null |
CSS font size (e.g., 24px, 1.5em, large). |
You can provide photo data in two ways:
-
External JSON File (Recommended for large or dynamic data):
description_file_path: /local/photos/events.jsonThe JSON file should be an array of objects:[ { "img": "/local/photos/image1.jpg", "desc": "This is a description for image 1.", "time_stamp": "2024-05-28T10:30:00Z" }, { "img": "https://example.com/image2.png", "desc": "Another photo.", "time_stamp": "2024-05-27T15:00:00Z" } ] -
Inline
photosArray (For a few static photos):photos: - img: /local/my_static_photos/first_photo.jpg desc: "A beautiful static shot." time_stamp: "2024-01-01T12:00:00Z" - img: /local/my_static_photos/second_photo.png desc: "Another view." time_stamp: "2024-01-02T13:00:00Z"
type: custom:photo-carousel-card
title: Trip to Europe
photos:
- img: >-
https://images.freeimages.com/images/large-previews/52b/pyramid-at-the-louvre-1226736.jpg
desc: Louvre Pyramid in Paris
- img: >-
https://www.sprayedout.com/wp-content/uploads/2024/12/montjuic-national-palace-barcelona-web.jpg
desc: Montjuic National Palace type: custom:photo-carousel-card
title: Doorbell Events
description_file_path: /local/doorbell/doorbell_events.json
autoplay: 10000
reload_interval_minutes: 1
max_items_to_show: 15
max_days_to_show: 7
title_style:
show_title: true
font_color: orange
font_size: 24px
timestamp_style:
show_timestamp: true
font_color: "#3498db"
font_size: 16px
description_style:
show_description: true
font_color: var(--text-color)
font_size: 24px- Card not showing /
Custom element doesn't exist:- Ensure the resource is correctly added in Lovelace resources (
/local/photo-carousel-card/photo-carousel-card.jswith typeJavaScript Module). - Clear your browser cache.
- Restart Home Assistant after installation.
- Ensure the resource is correctly added in Lovelace resources (
- No photos appearing:
- When using JSON file, Check your
description_file_pathfor correctness. Ensure the files actually exist inconfig/www/(which maps to/local/). - Verify the content of your
.txtor.jsonfile matches the expected format. - Check
max_items_to_showandmax_days_to_showfilters - they might be too restrictive. - Open your browser's developer console (F12) and look for errors related to fetching files or JavaScript.
- When using JSON file, Check your
PRs, issues, and suggestions welcome! Before submitting a PR, ensure you run the build command to compile the card for deployment.
- Requires Home Assistant 2023.3 or newer.
- Ensure photo paths are accessible under
/local/.
MIT License © Hammad Arif

