How to effortlessly select different image folders in Pi3D via mobile phone or voice 2

How to effortlessly select different image folders in Pi3D via mobile phone or voice

You have all sorts of family or couple photos on your digital picture frame. But now you have guests for dinner that you don’t want to bore with family happiness but instead only show landscape or even art images.

This calls for a change in folder where the image viewer Pi3D pulls your images from.

In this short article, I will show you how to do it either manually, with your Apple or Android phone, or via voice command.

The manual approach

If you don’t need to change folders very often at all, you can do it by changing the directory setting in PictureFrame2020config.py.

I am assuming that you have various subfolders in your “/home/pi/Pictures” folder.

Open the file in a text editor.

This line

"-p", "--pic_dir",       default="/home/pi/Pictures")

is typically set to “/home/pi/Pictures”. If it is set to a subfolder, change it to the above.

The second line

"-y", "--subdirectory",  default=""

specifies the subdirectory within the “/home/pi/Pictures” folder.

If the value is empty, it will use all the images in the Pictures directory. However, if you add a subfolder, it will only use those.

Change it to “art/”, “nature/” or whatever your folder is called. Add a “/” at the end.

Change it remotely with your phone

The subdirectory value can be changed remotely with an MQTT message if you have enabled MQTT in your Pi3D config file and have set the IP address of your MQTT broker.

Once Pi3D receives the change of directory command, it will look for those images and reshuffle the playlist.

The MQTT channel for the command is “frame/subdirectory” and the payload your directory in this format “nature/”

Apple iOS devices

For iPhones, PiHelper is a useful app for this purpose and you should have a look at my article dedicated to this platform.

You need to create a custom command for each subfolder. The command syntax for a subdirectory “Nature” is

mosquitto_pub -h localhost -t frame/subdirectory -m "Nature/"

Android devices

For Android, there is DashMQTT which even allows you to design buttons and not just command shortcuts.

You need to create a custom command for each subfolder. The command syntax for a subdirectory “Nature” is

app.publish("frame/subdirectory", "Nature/", false, O);

Voice control your image folders

The most elegant approach is, of course, talking to your picture frame (a.k.a. Alexa) to make it change directory.

In my article “A step-by-step guide on how to use a voice-controlled date filter on your digital photo frame” I have described what is needed.

You can follow the exact same steps for a change of subdirectory.

Create a new script in Home Assistant called “Change to Nature Photos”.

Under Sequence to the right click on “Edit as YAML” and paste the following text in the box.

data:
  payload: 'Nature/'
  topic: frame/subdirectory
service: mqtt.publish

Test the script in Home Assistant to see if Pi3D changes the subdirectory.

When this works, add a routine in the Amazon Alexa app.

Conclusion

Changing image directories is a very useful feature to have to account for different guests, moods, or special events to celebrate. And it is very easy to set up.

As always, let me know what you think!

Was this post helpful?

Scroll to Top