The app is trying to use USB printer, but you have a BLUETOOTH printer.
# SSH to Pi
ssh [email protected]
# Go to app directory
cd /boot/firmware
# Edit app.py
sudo nano app.pyFind line 18 (around there):
PRINTER_TYPE = os.getenv('PRINTER_TYPE', 'usb')Change to:
PRINTER_TYPE = os.getenv('PRINTER_TYPE', 'bluetooth')Also check line 21 (SERIAL_PORT):
SERIAL_PORT = os.getenv('SERIAL_PORT', '/dev/rfcomm0')This should already be /dev/rfcomm0 which is correct for Bluetooth.
Save: Ctrl + X, Y, Enter
Make sure Bluetooth is paired and connected.
bluetoothctl
devices
# Should show your printer
exit# Enter bluetoothctl
bluetoothctl
# Scan for devices
scan on
# Wait to see your printer's MAC address
# Pair (replace MAC with your printer)
pair MAC:ADDRESS:OF:PRINTER
# Trust
trust MAC:ADDRESS:OF:PRINTER
# Exit
exit# Find your printer's MAC address
bluetoothctl devices
# Bind to rfcomm (replace MAC with your printer's MAC)
sudo rfcomm bind /dev/rfcomm0 MAC:ADDRESS:OF:PRINTER
# Verify it's bound
ls -la /dev/rfcomm0Should show:
crw-rw---- 1 root dialout 216, 0 Oct 27 12:00 /dev/rfcomm0
sudo chmod 666 /dev/rfcomm0
sudo usermod -a -G dialout piYou may need to log out and back in for group changes to take effect.
# Kill Flask
pkill -f app.py
# Start again
python3 app.pyFrom your Mac:
curl https://your-ngrok-url.ngrok-free.dev/health
- Replace with your actual ngrok URLShould return printer_connected: true
Then try submitting a ticket from Netlify!
Instead of editing the file, you can set environment variable:
# Stop Flask
pkill -f app.py
# Start with Bluetooth config
export PRINTER_TYPE=bluetooth
export SERIAL_PORT=/dev/rfcomm0
python3 app.py✅ Printer paired with Bluetooth
✅ rfcomm bound to /dev/rfcomm0
✅ Permission set (chmod 666 /dev/rfcomm0)
✅ User in dialout group
✅ app.py changed to 'bluetooth'
✅ Flask restarted
✅ Test from Netlify
# Bind the port
sudo rfcomm bind /dev/rfcomm0 YOUR_PRINTER_MACsudo chmod 666 /dev/rfcomm0
sudo usermod -a -G dialout pi
# Log out and back in# Unbind and rebind
sudo rfcomm unbind /dev/rfcomm0
sudo rfcomm bind /dev/rfcomm0 YOUR_PRINTER_MAC# Make sure Bluetooth is on
sudo systemctl status bluetooth
# Turn on if needed
sudo systemctl start bluetooth
sudo systemctl enable bluetooth