Custom server code for a Raspberry Pi Thermal Printer project.
- API: Web API to print stuff!
- Website: React web interface!
- Discord integration: print out all messages sent to a channel!
3D files for 3D-printed housing available in /CAD
directory
- Install modules:
npm install
- Copy secrets file and edit values:
cp config.template.js config.js
. - Make up at least one access token and put it in
API_ACCESS_TOKENS
so you can use the web interface. To set up integrations, read below. - Create a directory where temporary files created by the server go:
mkdir .temp-queue
- Set up React environment: inside the
/web
directory,npm install
andnpm run build
- Start the server: (from the root directory)
npm start
Generally, I followed this guide, but there are a few things that you should know:
- If you are using a USB connection and gibberish comes out (see this forum post), the baud rate is most likely incorrect. There is no easy way of fixing this if you use the
usb:
protocol as specified in the guide. However, if you use theserial:
protocol (even if you're not using the serial GPIO ports for communication!) you can specify the baud rate like so:
serial:/dev/usb/lp0?baud=9600
(This is the printer URI that worked for me, but your path and baud rate may vary)
- Create a Discord bot on the Discord Developer Portal.
- Copy the bot's token and paste it in
DISCORD_TOKEN
inconfig.js
. - Invite your bot to your server by navigating to this URL, inserting your bot's Client ID:
https://discord.com/oauth2/authorize?scope=bot&client_id=PASTE_YOUR_CLIENT_ID_HERE&permissions=8
- Copy the ID of any Discord channels you want messages to be printed out from, and paste them in the
ALLOWED_DISCORD_CHANNELS
array inconfig.js
.
- Follow the Create Desktop application credentials guide and save the JSON client secret file as
google_credentials.json
. - Make sure to enable the Google Calendar API in the Google Cloud API Library.
- Include the IDs of the calendars you want to include in the
CALENDAR_IDS
field ofconfig.js
. You can find your Calendars' IDs in the "Integrate calendar" section of Calendar settings. - Start up your server, navigate to the web dashboard, and click
Print agenda
to link your account! You will only have to complete the linking process once.