The image viewer Pi3D PictureFrame, Home Assistant, and Amazon Alexa is a match made in heaven when it comes to magically control your images on the wall.

Almost whatever you want to your digital photo frame to do, you can do by simple voice commands of your choosing.

In this article, I will show you how to do it with Pi3D PictureFrame as the image viewer software and Amazon Alexa combined with Home Assistant as your humble voice servant.

Which frame software are you running?

This article is the pi3d PictureFrame MQTT reference. If you are running picframe3, the topics below are all wrong for you — it has its own set, and in most cases you will not need them at all, because picframe3 announces itself to Home Assistant over MQTT auto-discovery. The frame arrives as a device with a pause switch, next and previous buttons, a display light, an interval, a transition selector, the filters and a Show the caption button already there, so the Home Assistant script you write calls an entity rather than publishing a raw MQTT message.

If you do want to publish directly, picframe3's topics are <topic_prefix>/<device_id>/<thing>/set, which by default means picframe/picframe/…:

- display on/off:   picframe/picframe/display/set, on|off
- pause on/off:     picframe/picframe/pause/set, on|off
- next / previous:  picframe/picframe/next/set, picframe/picframe/previous/set, any payload
- captions on/off:  picframe/picframe/captions/set, on|off
- show the caption: picframe/picframe/info_show/set, any payload (reveals it briefly, then hides it again)
- brightness:       picframe/picframe/brightness/set, 0 to 255
- interval:         picframe/picframe/interval/set, seconds
- transition:       picframe/picframe/transition/set, a transition name
- date_from/to:     picframe/picframe/date_from/set, picframe/picframe/date_to/set, YYYY-MM-DD
- rolling dates:    picframe/picframe/dates_7d/set, dates_30d, dates_1y, dates_on_this_day, …
- tags_filter:      picframe/picframe/tags_filter/set, e.g. "holiday, france"
- location_filter:  picframe/picframe/location_filter/set, any part of a place name
- folder_filter:    picframe/picframe/folder_filter/set, a folder name or (all)
- clear filters:    picframe/picframe/clear_filters/set, any payload

Two differences worth spotting: dates are YYYY-MM-DD rather than pi3d's YYYY/MM/DD, and brightness is 0–255 rather than a float. The full list is in the project's docs/API.md.

The rest of this article — the pi3d commands, the Home Assistant scripts, the Alexa routine — is unchanged.

Pi3D PictureFrame and MQTT

Pi3D PictureFrame, from its 2021 version onwards, can change many different parameters with a simple MQTT message. You can also find these commands in the PictureFrame wiki — note that this is the original pi3d-based project, not picframe3.

Provided that your picture frame is called “picframe” in configuration.yaml, these are the MQTT commands and the possible payloads.

- display on/off: homeassistant/switch/picframe_display/set, ON,OFF
- paused on/off: homeassistant/switch/picframe_paused/set, ON,OFF
- shuffle on/off: homeassistant/switch/picframe_shuffle/set, ON,OFF
- back: homeassistant/switch/picframe_back/set, ON
- next: homeassistant/switch/picframe_next/set, ON
- name text on/off: homeassistant/switch/picframe_name_toggle/set, ON,OFF
- date text on/off: homeassistant/switch/picframe_date_toggle/set, ON,OFF
- location text on/off: homeassistant/switch/picframe_location_toggle/set, ON,OFF
- directory text on/off: homeassistant/switch/picframe_directory_toggle/set, ON,OFF
- title text on/off: homeassistant/switch/picframe_title_toggle/set, ON,OFF
- caption text on/off: homeassistant/switch/picframe_caption_toggle/set, ON,OFF
- all text off: homeassistant/switch/picframe_text_off/set, ON # yes that is confusing!
- text refresh: homeassistant/switch/picframe_text_refresh/set, ON
- delete: homeassistant/switch/picframe_delete/set, ON
- directory: picframe/directory, string matching directory name
- date_from: picframe/date_from, string YYYY/MM/DD or number representing unix timestamp or zero length string to remove constraint
- date_to: picframe/date_to, string YYYY/MM/DD or number as above
- fade_time: picframe/fade_time, number
- time_delay: picframe/time_delay, number
- brightness: picframe/brightness, float 0.0 to 1.0
- location_filter: picframe/location_filter, string matching any part of geolocation description
- tags_filter: picframe/tags_filter, string matching tags
- stop: picframe/stop, message not used - just stops

Among the latest additions is the ability to show a text overlay with information on the image’s date and location. Especially if you don’t want to permanently show the information, being able to trigger it with a simple voice command is most convenient.

The basic requirement is that you have an MQTT broker installed. If you followed my instructions in the original Pi3D article, you will have installed the MQTT broker Mosquitto already.

In configuration.yaml, you just need to enable MQTT and specify the IP of your MQTT broker, which, with Mosquitto installed, is simply “localhost”.

  use_mqtt: True
  server: "localhost"

Creating the scripts in Home Assistant

Home Assistant is used as the bridge between Alexa and Pi3D. Unfortunately, it is not (yet) possible to send MQTT messages through Alexa directly, so we need this interface through Home Assistant and Nabu Casa. You can read all about it here.

I will show you two examples for scripts. Once you have understood the logic, you can create your own custom scripts for any other commands.

Show the date and location of an image

Create a new script in Home Assistant, and call it “Pi3D Show Date and Location ON”.

Note: Insert the right mqtt topics and payloads as shown above. The screenshots below are from an older version. Everything else if still the same.

Under Sequence to the right, fill in the information as shown here.

The reason why I introduced a one second wait period is to avoid any hick-up by sending MQTT messages too fast in a row.

The above script will show the date and location information for 60 seconds every time an image comes up.

Turning off the information overlay

Create a new script in Home Assistant, and call it “Pi3D Turn Text OFF”.

Under Sequence to the right, fill in the information as shown here.

The above script will turn off the display of any photo information.

Testing the script

Test the scripts by manually triggering the two scripts in Home Assistant by clicking on the Play Button to the left of the script name.

Connecting the Home Assistant scripts to Alexa

For a more detailed article on this subject, I recommend reading “Voice control your digital photo frame with Amazon Echo and Home Assistant“.

I assume that you have the Alexa app installed on your mobile phone. Let’s go through the steps — and a warning that the screenshots below are from 2020. The Alexa app has been redesigned since, so the buttons will be in different places, but the sequence (routine, voice trigger, Smart Home action, pick your Home Assistant script) is still the shape of it.

In the Alexa app, tap on the lower top-right icon “More”. Choose “Routines”. Tap on the “+” sign in the upper right to create a new routine.

Enter a name for your routine (this is not the voice command yet). Tap on “When this happens”, select “Voice”.

Enter the Alexa voice command. Add “Action” and choose “Smart Home”. Tap on “Control scene” (Scenes in Alexa are the scripts in Home Assistant).

Choose the script/scene that you created in Home Assistant. Hit “Save”, and “Next”.

Wait a few seconds until the Amazon servers have digested your settings and test the routine by tapping on the “Play” sign on the right of your routine. Your command is now sent to Pi3D PictureFrame on your picture frame. If that works, the voice command will equally work.

Conclusion

Three simple commands that help you to operate your digital picture frame in the most convenient way possible – your voice.

Especially deleting images by voice as you see them has become a feature that we like to use frequently at home to cull those images that may have been nice at the time but are no longer. This way, you have nothing but beautiful memories, nature, or friends & family on your frame.

Is there another command that you would like to see? Let me know!