Send content to Little Printer Direct Print API

This flow demonstrates how to send content to your Little Printer using the Direct Print API.

Little Printer is a "delightful web-connected printer that lives in your home", created by the folk at Berg.

Normally you subscribe to daily publications that arrive at a time you schedule. The Direct Print API allows you to send HTML content for immediate printing.

Configuring the flow

After importing the flow, you must edit the Direct Print Code node with your print code, which you can find on the Direct Print API page if you're logged in.

The Template node contains the HTML to send to the printer. Using a template node makes it easy to customise with dynamic content.

Using the flow

This example flow sends a simple Hello World page to the printer, including the time-stamp received from the Inject node.

[{"id":"56a424ab.a95bdc","type":"http request","name":"","method":"POST","url":"http://remote.bergcloud.com/playground/direct_print/{{direct_print_code}}","x":670,"y":160,"z":"8df1dfb9.720e2","wires":[["c4f48cec.3b0b7"]]},{"id":"c4f48cec.3b0b7","type":"debug","name":"","active":true,"console":false,"complete":false,"x":801,"y":180,"z":"8df1dfb9.720e2","wires":[]},{"id":"4b658595.b49a7c","type":"template","name":"Template","template":"<html><head><meta charset=\"utf-8\"></head>\n<body>\n<h1>Hello World!</h1>\n<p>This is a paragraph tag.</p>\n<p>{{payload}}</p>\n</body></html>","x":211,"y":100,"z":"8df1dfb9.720e2","wires":[["3959234b.c6a6dc"]]},{"id":"b0338ac0.4fcc78","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":90,"y":80,"z":"8df1dfb9.720e2","wires":[["4b658595.b49a7c"]]},{"id":"6413cc0c.9bec34","type":"function","name":"Format request","func":"msg.payload = \"html=\"+msg.payload;\nmsg.headers = {\n \"content-length\": msg.payload.length,\n \"content-type\": \"application/x-www-form-urlencoded\"\n};\n\nreturn msg;","outputs":1,"x":520,"y":140,"z":"8df1dfb9.720e2","wires":[["56a424ab.a95bdc"]]},{"id":"3959234b.c6a6dc","type":"change","action":"replace","property":"direct_print_code","from":"","to":"YOUR_CODE_HERE","reg":false,"name":"Direct Print Code","x":355,"y":120,"z":"8df1dfb9.720e2","wires":[["6413cc0c.9bec34"]]}]

Flow Info

Created 10 years, 9 months ago
Updated 9 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • debug (x1)
  • function (x1)
  • http request (x1)
  • inject (x1)
  • template (x1)

Tags

  • littleprinter
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option