Getting Alerts in Home Assistant for Paperless-ngx Inbox Items

Getting Alerts in Home Assistant for Paperless-ngx Inbox Items

I heavily use the inbox feature in Paperless-ngx. What this does is ensure that all new documents, no matter how they get into the system—either through the consume folder or via email—first stop in the Paperless-ngx inbox. Various rules are in place (set up in multiple places in the system) to try to find the proper tag and document type, etc. However, I find it really important to keep those new documents in the inbox until I verify that the classification is correct, see what document it is, and then save it (after saving, the inbox tag gets removed automatically).

To set up the inbox, all you need to do is create a new tag, call it whatever you want, but when setting it up, select the checkbox for “inbox tag”. I called mine “.inbox” with a dot in the beginning so it’ll be first in the list of tags.

While Paperless-ngx doesn’t have a built-in feature to alert you when there are documents waiting for you in the inbox, I set up a cool little automation that sends me a notification in Home Assistant when the inbox has documents in it.

Here’s how you can set up this automation in Home Assistant:

Home Assistant Automation:

alias: Alert when there are inbox items in Paperless-ngx
description: ""
trigger:
  - platform: time
    at: "08:00:00"
condition: []
action:
  - service: rest_command.get_paperless_ngx_inbox_count
    metadata: {}
    data: {}
    response_variable: data
  - if:
      - condition: template
        value_template: "{{data.content.document_count > 0}}"
    then:
      - service: notify.persistent_notification
        metadata: {}
        data:
          message: There are items waiting in the Paperless inbox
mode: single

This automation checks every day at 8:00 AM using the Paperless-ngx API to see if there are new documents. If there’s one or more, it sends an alert.

Configuration for the API Service:

To set up the service to call the API, add the following to your configuration.yaml in Home Assistant:

rest_command:
  get_paperless_ngx_inbox_count:
    url: "http://192.168.1.69:8000/api/tags/11/"

Replace the URL above with your own IP address and port number for your Paperless-ngx. Also, replace the “11” above with the ID of your inbox tag. You can see the ID when clicking on the inbox tag under the “Manage” menu item in Paperless-ngx.

And that’s it! You’ll get notified when items are waiting for you. If you have other cool automations for Paperless-ngx, let me know!


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply