How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 2

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame

Wolfgang has written about the iOS app PiHelper before and I would like to recommend a similar app for Android users. It’s called DashMQTT and is a five star rated app to create dashboards for your MQTT enabled IoT Smart Home devices, applications, and Home automation.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 3

Since the image viewer Pi3D also listens to MQTT commands, DashMQTT is a great companion if you are looking for a no-cost remote control of your picture frame.

In this article, I’d like to show you how to use the DashMQTT app to trigger example commands for the Pi3D image viewer. You will quickly figure out for yourself, how to add any kind of MQTT/Pi3D commands that may be useful in your home.

All you need is the free DashMQTT app from the Google Play Store, an MQTT broker installed on your Raspberry Pi, and the great image viewer Pi3D.

This is a great alternative if you are not using Home Assistant or Amazon Alexa to control your digital picture frame for things like image smart lists, play/pause/back commands, and other useful Pi3D commands.

It’s free and doesn’t contain any advertisements. If you like it, the author would appreciate some positive feedback in the store.

This tutorial is based on the May 2020 release of Pi3D.

About DashMQTT

“Warning: This app is for nerds only! If you don’t know what MQTT is, this app is likely not for you.” reads the greeting in the Google Play Store. But fear not, this is just a blunt attempt to appease the MQTT community for delivering a tool that helps to demystify this little message protocol and to make it available for a larger audience.

I will walk you through what it takes to use the MQTT protocol to send commands to your photo frame.

As the image viewer Pi3D, which runs the digital picture frame of many homebrewers, has plenty of options that can be remotely controlled, DashMQTT is great as an efficient remote control.

The remote control logic

DashMQTT will connect to the Mosquitto MQTT broker of your local digital picture frame and publish MQTT messages. These messages will then be received and interpreted by Pi3D.

This is similar to what is described in the article about using voice commands to apply smart filters to show only certain images based on the Exif date of the photos. Only this time, I won’t be using Home Assistant scripts os Amazon’s Alexa.

I will walk through through each step so that you should be done in a few minutes.

Installing the Mosquitto MQTT broker

I assume that you have installed your Raspberry Pi system and are using Pi3D as your image viewer.

First, we need to install the MQTT broker on your Raspberry Pi. You will find the full walk through on this topic here.

Here is the quick and easy version:

Copy this line and paste it in a Terminal window connected to your Pi.

sudo apt update && sudo apt upgrade -y && sudo apt install -y mosquitto mosquitto-clients

If you don’t want to install an MQTT broker on your frame, or you want to communicate with your IoT remotely, you can use a provider like mqtt.eclipse.org, which is already set up. Eclipse is a public test MQTT broker service, so whatever you send and receive can be seen by everybody using this service. This might not sound too confidence-inspiring, but for testing purposes, it does its job.

Connecting Pi3D to MQTT

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

sudo pip3 install paho-mqtt

The next step is to enter the MQTT broker settings in Pi3D.

Open Pictureframe2020config.py in the “pi3d_demos” directory with a code editor.

Looks for these lines

parse.add_argument("-m", "--use_mqtt",      default=False)
parse.add_argument(      "--mqtt_server",   default="mqtt.eclipse.org")
parse.add_argument(      "--mqtt_port",     default=1883, type=int)
parse.add_argument(      "--mqtt_login",    default="")
parse.add_argument(      "--mqtt_password", default="")

Set “use_mqtt” to “True” to make Pi3D listen to any MQTT messages.

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

Enter the IP of your digital picture frame here

parse.add_argument(      "--mqtt_server", default="192.168.178.222")

or, alternatively, the Bonjour hostname with “.local”

parse.add_argument(      "--mqtt_server", default="pictureframe.local")

You can leave the default values for port, login and password as they are.

Save and close the editor.

The DashMQTT setup

When you install and open MQTT Dash, there is a blank screen with little indication of what to do. I guess this is intentional by the app author to make sure only the initiated can gain access to the holy grail of MQTT!

This first page will hold a list of different MQTT brokers – you could have one to control the picture frame, one for the garage door, one for watering the greenhouse, etc. Once you’ve added a broker for the picture frame it will look like this:

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 4

Click on the + and you will get a screen for setting up the broker details. There are lots of options but just set the name and address.

If you have the Mosquitto MQTT broker installed on your Raspberry Pi, just enter its IP number under “Address”. The default port is already correctly filled with “1883”.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 5

There are several choices but I just used ‘text’ where I was sending a date or subdirectory name, or ‘switch/button’ for paused, delete, shuffle etc.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 6

The info to fill in for each button is reasonably straightforward though with the switch buttons you can make the button style change, relevant for paused/not paused, for instance.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 7

Once you’ve got a button of the right type set up you can ‘long press’ it to get a menu for cloning or editing which makes creating all the relevant buttons very quick.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 8

It is possible to set up buttons to do multiple publish actions. For instance, if you wanted to show images from a specific date range you could clone one of the switch buttons then edit it using a topic that doesn’t do anything.

Then go to the bottom of the screen and select ON TAP and enter lines specifying the date_from and date_to.

How to use the DashMQTT Android app to remote control your Raspberry Pi photo frame 9

If you want to change the order of the buttons on your menu, you need to press the padlock symbol at the top, which allows the buttons to be dragged to new positions. Toggle the padlock to return to normal behavior.

Examples of remote commands

Pi3D can receive the following commands via MQTT:

client.subscribe("frame/date_from", qos=0)
client.subscribe("frame/date_to", qos=0)
client.subscribe("frame/time_delay", qos=0)
client.subscribe("frame/fade_time", qos=0)
client.subscribe("frame/shuffle", qos=0)
client.subscribe("frame/quit", qos=0)
client.subscribe("frame/paused", qos=0)
client.subscribe("frame/back", qos=0)
client.subscribe("frame/subdirectory", qos=0)
client.subscribe("frame/delete", qos=0)

The date needs to be received in the format “yyyy.mm.dd” but a “/” as separator is also understood. The channels are the ones listed above.

You can also have a look at the PictureFrame2020config.py file to understand the syntax of the various commands.

Smart filter on vacation photos

The example in the screenshot above is a custom command which instructs Pi3D to only show images that have been taken during a winter vacation in Lapland. Just specify both “date_from” and “date_to” and add two publishing commands:

app.publish("frame/date_from", "2019/12/15", false, O);
app.publish("frame/date_to", "2020/1/3", false, O);

The same is valid for your own buttons to only show images from today or other special events.

To reset the date enter “None” instead of the date. Just remember to send it to both “to” and “from”.

Jump to the previous photo

To instruct the picture frame to jump to the previous photo, enter

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

The last one is most useful when you want to show your household members a photo that you just see on the frame, but they take ages to run to you and so the photo has moved on. In that case, you can now go back!

Pause the picture frame

And to pause the picture frame:

app.publish("frame/paused", "pause", false, O);

This is a toggle command, so to restart, just press this button again.

Conclusion

DashMQTT for Android provides a simple way to remote control the Pi3D image viewer that powers your digital picture frame.

Thanks to the anonymous author “czr”!

Was this article helpful?

Scroll to Top