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 PictureFrame 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.
Tested with: Raspberry Pi OS March 2021 version; Raspberry Pi 2, 3, and 4; Pi3D 2.43; PictureFrame 2021.03.20; 1080p and 4K displays.
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 configuration.yaml
.
I am assuming that you have various subfolders in your “/home/pi/Pictures
” folder.
Open the file in a text editor.
This line
pic_dir: "~/Pictures" # default="~/Pictures", root folder for images
is typically set to “/home/pi/Pictures”.
The other line
subdirectory: "" # default="", subdir of pic_dir - can be changed by MQTT"
specifies the subdirectory within the “/home/pi/Pictures” folder.
If the default 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 remotely with your phone
The subdirectory value can be changed remotely with an MQTT message if you have enabled MQTT in your Pi3D configuration file and have set the IP address of your MQTT broker.
Once PictureFrame receives the change of directory command, it will look for those images and reshuffle the playlist.
The MQTT channel for the command is “picframe/directory
” 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 picframe/subdirectory -m "Nature"
To go back to your main Pictures directory, just send a message with no payload.
mosquitto_pub -h localhost -t picframe/subdirectory -m ""
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("picframe/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: picframe/subdirectory
service: mqtt.publish
Test the script in Home Assistant to see if Pi3D PictureFrame 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?
Related Articles
- How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame
- How to trigger a Home Assistant script through Alexa and make your Raspberry Pi picture frame do (just about) anything
- How to quickly troubleshoot MQTT problems on your Raspberry Pi
- How to pause, go back or delete an image on your Raspberry Pi digital picture frame with a simple Alexa voice command