This article is more than 1 year old

Dev rigs up receipt printer to spit out GitHub issues

Not the first time the letters POS have been associated with someone's repo

Sometimes the best things are the most simple. A case in point: sending GitHub issues to an old thermal POS printer via a Raspberry Pi.

Developer Andrew Schmelyun was faced with the thorny problem of keeping track of issues posted on his various GitHub projects. A problem familiar to many: emails tended to get lost in the mailbox or issues were simply forgotten in the face of a growing to-do list.

What to do? Schmelyun spied a receipt printer spitting out orders while he was collecting a take-away meal and pondered if the same might be implemented for GitHub issues.

One dusty Pi Zero W, a second-hand Epson thermal printer, some USB connectors, a bit of PHP, and ta-da – when an issue comes in, out pops a print-out. Except rather than an order for pizza and beer, it is instead a neatly formatted bit of text from GitHub.

It took Schmelyun about eight hours to make the magic happen. "The longest part was trying to get the printer connected to the Raspberry Pi and getting data sent to it," he told The Register. "Originally I was using CUPS in Linux, but it didn't give the results I was looking for."

The Pi Zero W was used simply because Schmelyun had one lying around (we imagine there are a fair few gathering dust in drawers). We reckon the RP2040-based Pi Pico could probably do the job as well. "I've also thought about using the ESP8266 dev board (like NodeMCU) because I'm a bit familiar with them," said Schmelyun.

PHP was selected since Schmelyun is a developer using the language (Node or Python would be other options), and the presence of a decent library for the ESC/POS commands understood by the printer was another plus. Listening for events on repos was achieved via GitHub's webhooks.

GitHub has form when it comes to throttling webhooks although Schmelyun didn't reckon he'd have much of a problem. "Most of the issues that come through for my projects aren't massive breaking bugs," he explained, "and at most I get a few issues a day."

"Worst case I'd probably migrate it to use the GitHub API instead."

Going forwards, Schmelyun is pondering adding a QR code that links directly to the issue: "The library has native QR code printing built in so adding that would be trivial."

More information on the receipt would be handy, as would new PRs, successful merges or ticket closure notifications. "Someone also suggested adding a light or small notification before the printing started, since it could be a little jarring," he said, "and that would honestly be pretty useful."

It certainly is a fun project. However, this writer can neither confirm nor deny that a substantial part of last weekend was spent considering how to spit out comments from The Register articles to an old Epson TM-T88IV printer picked up from a local second-hand office supplies store. ®

More about

TIP US OFF

Send us news


Other stories you might like