How to pause, go back or delete an image on your digital picture frame with a simple Alexa voice command 2

How to pause, go back or delete an image on your digital picture frame with a simple Alexa voice command

Sometimes you see a photo on your digital picture frame which you don’t like anymore, and you make a mental note to remove it when you get to your computer next time.

But often you just forget about it and then it comes up again. Wouldn’t it be nice to just say “Alexa, delete this image” instead?

Or you want to pause playback to enjoy a photo for longer or go back to the previous one. Now you can.

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

Pi3D and MQTT

You can set Pi3D, my favorite image viewer, to listen to MQTT messages to change certain parameters like display or fading delay and to set up smart filters for specifying a date range.

But what many probably don’t know is that you can also send direct commands like pausing the playback and deleting the currently displayed image.

The basic requirement is that you have an MQTT broker installed or are using a cloud-based MQTT broker.

As the installation of an MQTT on your Raspberry Pi is a matter of one single command, I recommend installing Mosquitto. In my experience, it is also much more reliable than an external service.

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

parse.add_argument("-m", "--use_mqtt",      default=True)
parse.add_argument(      "--mqtt_server",   default="localhost")

Don’t forget to install paho so that Pi3D can connect to the MQTT broker with

sudo pip3 install paho-mqtt

Creating the scripts in Home Assistant

We are using Home Assistant 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 here.

One alternative is to use Node-Red, but there is currently an issue with the latest generation of the Amazon Echo devices. I expect to publish an update here soon, but for the moment, Home Assistant is the way to go.

Pausing the playback

Create a new script in Home Assistant, and call it “Frame Pause Playback”.

Under Sequence to the right, click on “Edit as YAML” (the button with the three dots) and paste this text in the box.

data:
  payload: ''
  topic: frame/paused
service: mqtt.publish

Note that this command does not need a payload. When anything arrives on this channel, Pi3D will act.

Going to the previous image

Create a new script in Home Assistant, and call it “Frame Previous Image”.

Under Sequence to the right, click on “Edit as YAML” (the button with the three dots) and paste this text in the box.

data:
  payload: ''
  topic: frame/back
service: mqtt.publish

Deleting the currently playing image

Create a new script in Home Assistant, and call it “Frame Delete Image”.

Under Sequence to the right, click on “Edit as YAML” (the button with the three dots) and paste this text in the box.

data:
  payload: ''
  topic: frame/delete
service: mqtt.publish

The “frame/delete” command doesn’t actually delete your image.

It just moves it outside of its current location to a folder called “/home/pi/DeletedPictures” and then moves to the next image in the playlist.

This way, you can always recover any accidentally deleted images.

Testing the script

Test the script by manually triggering the three scripts. Check if your “deleted” photos are showing up in the Pictures/Trash folder.

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:

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

How to pause, go back or delete an image on your digital picture frame with a simple Alexa voice command 3

Enter a routine name for your task, in this case, “Playback Pause”. Click on “When this happens” and choose “Voice”. Enter the Alexa trigger phrase in your language and click “Next” (The examples above are from another Routine, but you get how it works.)

How to pause, go back or delete an image on your digital picture frame with a simple Alexa voice command 4

Click on “Add action” and choose “Smart Home” and “Control Scene”. What Alexa calls “Scene” is what is called a “Script” in Home Assistant. Choose the Scene/Script from Home Assistant and tap on “Add”. Finally, save your routine.

How to pause, go back or delete an image on your digital picture frame with a simple Alexa voice command 5

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 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!

Was this article helpful?

Scroll to Top