I thought it would be nice to have shortcut buttons in Home Assistant for the date filtering functionality of PictureFrame.
Often, after holidays, I want to focus on the latest photos to relive a good time. I could, of course, use the date filter field, but it’s so much more convenient with a one-click button.
So, I asked the master of Home Assistant integration, Helge, for help, and it turned out that he had already implemented it. He was kind enough to share his approach with me.
As this may also be of interest to others, I have outlined the steps below.
Shortcuts
This is the idea: Instead of entering “Date from” and “Date to” manually, you can simply tap a preset button to define a time.
Besides dates, you can of course also create as many preset buttons as you like for tags, locations, or directories. Like “wedding”, “France”, “biking”, or whatever Exif data you have created.
In my case, I created four time filters and one reset button.

The following instructions assume that you have read Helge’s article on How to integrate PictureFrame into Home Assistant. If you haven’t, start there first.
Helpers
Start by considering which date presets you prefer. Then, go to Settings in Home Assistant, and navigate to “Devices & services > helpers”.
Create a new helper for every preset, choose “button”.

Give it a name and choose a suitable icon.

Repeat this process for every preset you want to create.
These are the five that I use:

Automations
Next, you’ll need to create automations in “Automations & scenes” in Settings.
Helge elegantly combined three buttons in one automation, but for the sake of simplicity, you can create a separate automation for each button.
Create a new automation

and the click on the three dots top-right and choose “Edit in YAML”.

You should see

Here are the automations that I use. This one is to clear the date fields and reset the filter:
alias: Picframe Date Clear
description: ""
triggers:
- entity_id:
- input_button.picframe_date_clear
id: clear
trigger: state
conditions: []
actions:
- if:
- condition: trigger
id:
- clear
then:
- data:
topic: picframe/date_from
payload: 1901/12/15
action: mqtt.publish
- data:
topic: picframe/date_to
payload: 2038/01/01
action: mqtt.publish
mode: single
This one sets the date filter to the past 30 days. You must use the same name that you use in Automations.
alias: Picframe Date Last 365 days
description: ""
triggers:
- entity_id:
- input_button.picframe_date_last_365days
id: 365days
trigger: state
conditions: []
actions:
- if:
- condition: trigger
id:
- 365days
then:
- data:
topic: picframe/date_from
payload: "{{ (now() - timedelta(days=365)).strftime(\"%Y/%m/%d\") }}"
action: mqtt.publish
- data:
topic: picframe/date_to
payload: 2038/01/01
action: mqtt.publish
mode: single
For “last seven days”, just replace the “days=365” with “7” and so forth.
Cards
Lastly, to show the buttons, I created a vertically stacked card with the five buttons with
type: vertical-stack
cards:
- type: entities
title: Fnatenrahmen
entities:
- entity: sensor.picframe_image_counter
name: Selected Images
- entity: switch.bilderrahmen
- entity: select.picframe_directory
name: Directory
- entity: input_text.picframe_tags_filter
name: Tags
- entity: input_text.picframe_location_filter
name: Location
- entity: input_text.picframe_date_from
name: Bilder ab dem
- entity: input_text.picframe_date_to
name: Bilder bis zum
- type: glance
show_name: true
show_icon: true
show_state: false
entities:
- entity: input_button.picframe_date_last_week
name: 7d
tap_action:
action: toggle
- entity: input_button.picframe_date_last_month
name: 30d
tap_action:
action: toggle
- entity: input_button.picframe_date_last_365days
name: 1y
tap_action:
action: toggle
- entity: input_button.picframe_date_last_1000days
name: 3y
tap_action:
action: toggle
- entity: input_button.picframe_date_clear
name: Reset
tap_action:
action: toggle
state_color: true
which is placed below the other filters.

Conclusion
Thank you to Helge for sharing his knowledge on how to have preset buttons.
It’s not limited to dates but opens great possibilities to pre-define photo collections for all kinds of occasions.
Was this article helpful?
Thank you for your support and motivation.
Related Articles
- Date filtering doesn’t work? Check your photos for valid Exif date information
- How to fully integrate your Raspberry Pi digital picture frame into Home Assistant even showing the current image
- How to trigger a Home Assistant script through Alexa and make your Raspberry Pi picture frame do (just about) anything
- Show the CPU temperature of your Raspberry Pi digital picture frame in Home Assistant via MQTT