Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Brother QL Grocy Label Printer Service

License

NotificationsYou must be signed in to change notification settings

sam159/brotherql_grocylabels

Repository files navigation

Example Label

This project is intended to be a webhook target forGrocy to print labels to a brother QL label printer.

Datamatrix or QR codes can be used with Datamatrix being the default. Datamatrix will fit better in smaller labels but I've found aren't as easily read by the Grocybarcode reader or by theAndroid App.

Only die-cut labels are supported as I don't have any endless rolls to test with.

Connecting Grocy

Once you have this running somewhere update your config atapp/data/config.php to match the following. Presuming that you have this running on localhost at port 8000.

    // Label printer settings    Setting('LABEL_PRINTER_WEBHOOK', 'http://127.0.0.1:8000/print');    Setting('LABEL_PRINTER_RUN_SERVER', true);    Setting('LABEL_PRINTER_PARAMS', []);    Setting('LABEL_PRINTER_HOOK_JSON', false);    Setting('FEATURE_FLAG_LABEL_PRINTER', true);

Environment Variables

The label size and printer are configured via environmental variables. You can also create a.env file instead.

VariableDefaultDescription
LABEL_SIZE62x29See thebrother_ql readme for the names of the labels
PRINTER_MODELQL-500The printer model. One of the values accepted by brother_ql
PRINTER_PATHfile:///dev/usb/lp1Where the printer is found on the system. For network printers usetcp://printer.address
BARCODE_FORMATDatamatrixDatamatrix orQRCode
NAME_FONTNotoSerif-Regular.ttfThe file name of the font in the fonts directory
NAME_FONT_SIZE48The size of that font
NAME_MAX_LINES4The maximum number of lines to use for the name
DUE_DATE_FONTNotoSerif-Regular.ttfThe file name of the font in the fonts directory
DUE_DATE_FONT_SIZE30The size of that font
ENDLESS_MARGIN10The top & bottom margin to add when using endless labels

Included fonts areNotoSans-Regular.ttf andNotoSerif-Regular.ttf

Endless Labels

These are supported, for example the62 label size. The length of the label will be big enough to accommodate the max number of lines including a margin.You may want to experiment with font sizes and line count to get the most out of it.

Endpoints

Two endpoints are available/print and/image both accept the same parameters./image will return the rendered image as a PNG instead of sending to the printer.

Parameters

POST or GET accepted.

NameUse
productname
batteryname
chorename
recipename
grocycodethe barcode
due_datethe text at the bottom of the label

The name will use whichever parameter is given.

Running

Note: Theres no security on this web service, so don't make it publicly available.

This has been tested with python 3.10, newer may work fine.

You will need to install thelibdmtx library for the barcodes to generate, seepylibdmtx documentation on pypi.

Its advisable to run and install in avenv. For example:

    # Create and enter the venv    python -m venv .venv    source ./.venv/bin/activate    # Install packages    python -m pip install -U -r requirements.txt    # exit with ./.venv/bin/deactivate

For development you can useflask run --debug to run the service on port 5000. Alternatively usegunicorn -c gunicorn_conf.py app:app to run the service on port 8000.

TODO

  • Some more formatting options

Docker

A Dockerfile is included based on a python 3.10 alpine image. The default port is 8000.

Published to Dockerhub assam159/brotherql_grocylabels for architectures amd64, arm64, and armv7.

As an example, you can launch this withdocker run -d -p 8000:8000 -e PRINTER_MODEL=QL-500 -e PRINTER_PATH=file:///dev/usb/lp1 sam159/brotherql_grocylabels:latest.

An exampledocker-compose.yml file can be foundhere.

Contributing

I'll try to keep on top of bugs but feature requests may go unfulfilled. Please use the issue tracking in Github.

PRs are welcome!

About

Brother QL Grocy Label Printer Service

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp