A voice-activated label printer utilizing Google Assistant, a Raspberry Pi, and a Dymo LabelWriter.
OK Google, print a label called "Awesome"
This is a client that runs on a Raspberry Pi connected to a Dymo LabelWriter. The Pi should have CUPS installed, along with the appropriate Dymo drivers. Technically, this doesn't have to run on a Pi. It can run on any computer that has access to a CUPS print queue. However, I've only tested it on a Raspberry Pi.
There is also a server (of sorts), in the form of Firebase Cloud Functions.
Finally, an IFTTT applet listens for commands from Google Assistant and dispatches requests to the Cloud Function endpoint (via a Webhook action).
This project is only compatible with Python 3. It will work with Python 3.7+ at least, and may work with older versions of Python 3, but these haven't been tested. It is not compatible with Python 2.
Ensure you have a Dymo LabelWriter connected to a Unix-like system running CUPS, and that the computer can print to the Dymo.
Setting that up is outside the scope of this document, but this guide is pretty helpful.
Ensure texlive
is installed on your system. If on a Raspberry Pi, it may be already installed.
Run pdflatex
on the command line to find out. If not, it's fairly easy to install.
On the command line run:
sudo apt update
sudo apt install texlive
- Create a Firebase project.
- Create a Firebase Realtime Database.
- Register a Web App.
- Make note of (e.g. save somewhere) several values on the last screen of the previous step. You'll
need these later:
apiKey
databaseURL
projectId
- Generate a new private key for your project:
- In the Firebase console, open Settings > Service Accounts.
- Click Generate New Private Key, then confirm by clicking Generate Key.
- Copy the downloaded file to the machine you will run this program on (i.e. the Raspberry Pi).
- Make note of the path to the file.
- Clone this repo onto your Raspberry Pi (or other Linux system).
cd
into the cloned directory. - Copy
env.example.sh
toenv.sh
. e.g.cp env.example.sh env.sh
. - Open
env.sh
and edit several values:- Set
LC_FIREBASE_APP_NAME
to the value ofprojectId
. - Set
LC_FIREBASE_KEY_PATH
to the absolute path of the location where you copied the private key file. - Set
LC_FIREBASE_API_KEY
to the value ofapiKey
. - Set
LC_FIREBASE_DATABASE_URL
to the value ofdatabaseURL
. - Set
LC_CUPS_PRINTER_NAME
to the name of the CUPS printer queue of your LabelWriter. This value will get turned into the command:Ensure you can print to your Dymo this way from the command-line before proceeding.lp -d LC_CUPS_PRINTER_NAME filename
- Save and close the file.
- Set
make setup
to get your virtual environment bootstrapped.make run
to start the client.- If all is well, you should have a running client connected to your Firebase Realtime Database.
- To have the client run automatically on boot:
sudo make install
. - To undo the previous step:
sudo make uninstall
.
Now, head over to Label Commander Server and follow the instructions there to get the cloud functions running and configure an IFTTT applet to interface with them.
The templates
directory contains a LaTeX template (label.tex) that defines the format of
the printed label. You can change this template to customize the size and content of the label.