2026-02-12 08:14:45 +00:00
2026-02-06 16:30:50 +00:00
2026-02-12 08:14:45 +00:00
2026-02-06 17:35:31 +00:00
2026-02-06 17:35:31 +00:00
2026-02-07 14:39:06 +00:00
2026-02-06 16:30:50 +00:00
2026-02-09 20:23:11 +00:00

Vet Label Printer Client

This is a Docker-based MQTT client that listens for print requests, generates vet drug prescription labels, and prints them using a Brother QL printer.

Setup

  1. Configure the environment variables in .env:

    • MQTT_HOST: MQTT broker hostname
    • MQTT_PORT: MQTT broker port
    • MQTT_TOPIC_SUB: Topic to subscribe for print requests
    • MQTT_TOPIC_PUB_STATUS: Topic to publish status messages (success and errors)
    • PRINTER_DEVICE: Printer device path (e.g., /dev/usb/lp0)
    • PRINTER_MODEL: Printer model (e.g., QL-800)
    • LABEL_SIZE_DEFAULT: Default label size (e.g., 29x90)
  2. Build and run with Docker Compose:

    docker-compose up --build
    

MQTT Message Format

The client subscribes to the configured topic and expects JSON messages like:

{
  "template_id": "vet_label",
  "label_size": "29x90",
  "variables": {
    "practice_name": "Many Tears Animal Rescue",
    "animal_name": "Rosie 468837",
    "drug_name": "Amoxicillin 50mg",
    "dosage": "1 tablet twice daily with food",
    "quantity": "14 tablets",
    "vet_initials": "Frank Molina"
  },
  "test": false
}
  • template_id: Identifier for the label template (currently only "vet_label" supported)
  • label_size: Size of the label (passed to brother-ql)
  • variables: Key-value pairs for label content
  • test: If true, saves PNG to /app/output/ instead of printing

Error Handling

Any errors during processing are published to the error topic as JSON:

{
  "error": "Error message",
  "original_payload": "{original message}"
}

Adding New Templates

To add new label templates, edit templates.py and add to the TEMPLATES dict.

Description
No description provided
Readme 57 KiB
Languages
Python 97.9%
Dockerfile 2.1%