All guides

Connecting printers

Print from Home Assistant

Print camera snapshots, PDF files and notification texts from Home Assistant automations through Sealed Print.

Home Assistant automations can print through Sealed Print: a camera snapshot when someone rings, a PDF report every morning, or a shopping list sent as a notification. The documents go to any destination of your organization, also to a printer in another building. There are two ways: an API endpoint for files, and an inbound email address for the texts of notifications.

Prerequisites

  • A destination to print on, for example a printer shared by the Sealed Print Relay app or by a relay client.
  • For files: an API endpoint, on every plan. Files must be PDF, JPEG or PNG.
  • For notification texts: an inbound email address (Team, Business, or Free with pay per use) and a notify service in Home Assistant that sends emails, for example the SMTP integration.

One-time setup

Files through an API endpoint

  1. In Sealed Print, go to Sources → API endpoints, select New API endpoint, name it "Home Assistant" and choose the printer under Target. Copy the Endpoint URL.
  2. Add a shell command to configuration.yaml that sends a file to this URL, then restart Home Assistant:
shell_command:
  print_snapshot: >-
    curl -sS --fail -X POST "https://www.sealedprint.com/api/print/sp_ep_…?name=Doorbell"
    -H "Content-Type: image/jpeg"
    --data-binary @/media/doorbell.jpg
  1. Call the shell command in an automation, for example after a camera snapshot:
triggers:
  - trigger: state
    entity_id: binary_sensor.doorbell
    to: "on"
actions:
  - action: camera.snapshot
    target:
      entity_id: camera.front_door
    data:
      filename: /media/doorbell.jpg
  - action: shell_command.print_snapshot

For a PDF, use Content-Type: application/pdf and the path of the PDF. Keep files that you print in /media rather than in /config/www: Home Assistant serves everything in www without signing in.

The endpoint URL works like a password: anyone who knows it can print. To keep it out of configuration.yaml, put the whole command into secrets.yaml and write print_snapshot: !secret print_snapshot.

Notification texts through email

  1. In Sealed Print, go to Sources → Email addresses, select New email address and choose the printer under Target. Add the sender address of your Home Assistant under Allowed senders and switch on Print the text of the email.
  2. In Home Assistant, set up a notify service that sends emails from that sender address, for example with the SMTP integration and your mail provider's server, and use the inbound address as recipient.
  3. Send the text in an automation, where printer_mail is the name of your notify service:
actions:
  - action: notify.printer_mail
    data:
      title: Shopping list
      message: Milk, eggs, coffee

The title becomes the subject. The text is printed with sender, date and subject.

Every time

  • The automations print without further steps. Every file and every email becomes a job in the Queue and goes to the target of the endpoint or the address.
  • Print options go along as query parameters of the endpoint URL, for example &copies=2.
  • To try a shell command without an automation, run it in Home Assistant under Developer tools → Actions.

Troubleshooting

  • The Home Assistant log shows "Error running command" with return code 22: Sealed Print answered with an error. Check the endpoint URL and that the file is a PDF, JPEG or PNG; the codes are explained under API endpoints.
  • The snapshot or file is not found: use the path that Home Assistant sees, for example /media/doorbell.jpg. Home Assistant only writes snapshots to allowed folders; /media is one of them.
  • An email is not printed: the address card shows the reason under Received emails. The sender must be an allowed sender with a confirmed address (SPF, DKIM or DMARC), which is the case when Home Assistant sends through your mail provider's server. See Email to printer.
  • Characters in the printed text appear as "?": the text print supports Western European characters only.

What's next