[RELEASE] NTFY Notifier Driver - Push Notifications via ntfy.sh or Self-Hosted

[RELEASE] NTFY Notifier Driver

This is a lightweight, secure Hubitat driver that lets you send push notifications via ntfy.sh or your own self-hosted NTFY server.

Built with simplicity and flexibility in mind, this driver works out of the box with the hosted ntfy.sh service — but is equally ready for self-hosted setups (including with authentication, custom ports, etc.).


:white_check_mark: Features

  • Fully compatible with ntfy.sh and self-hosted NTFY
  • Supports HTTPS or HTTP
  • Optional title and priority headers
  • Integrates cleanly with Hubitat's "Notification" capability
  • Designed for fast, lightweight usage with minimal setup

:package: Install via Hubitat Package Manager (HPM)

If you're using Hubitat Package Manager:

  1. Open HPM
  2. Choose Install
  3. Search by keyword: ntfy
  4. Install: NTFY Notifier Driver by Graf Technology, LLC

:inbox_tray: Manual Installation

Driver code & manifest:
:link: https://github.com/graftechnology/hubitat-ntfy-notification-driver


:hammer_and_wrench: Usage

  1. Add a Virtual Device
  2. Choose NTFY Notifier Driver as the driver type
  3. Set the following preferences:
    • Protocol: https or http
    • Host: ntfy.sh or your custom domain
    • Topic: Topic name (e.g. hubitat)
    • (Optional) Title & Priority

Then use deviceNotification("Your message") from Rule Machine or any Hubitat app.


:brain: Example Use Cases

  • Instant alerts for motion or door sensors
  • Backup to SMS/email
  • Redundant alerts to multiple devices
  • Dead-simple webhook integrations

:mega: Feedback / Issues

This is actively maintained by me (Jacob Graf / Graf Technology, LLC).
If you find a bug, want to request a feature, or just say thanks:

  • Reply here
  • Open an issue on GitHub
  • Or ping me in the forums

Enjoy — and happy automating! :tada:

7 Likes

Hi - I threw together a very crude ntfy driver last year for personal use but I posted it anyway. It's worked great for my basic needs, but I'm glad to see someone has come along and produced something MUCH more robust and feature rich. Would you mind if I [re]directed any visitors to my repo to yours?

Cheers,
James

1 Like

PS - I see there wasn't explicit support for custom ports however (FYI) I was able to append the port to the hostname (e.g. 192.168.0.5:xxxx). Because I have ntfy running locally in a docker I have some goofy port numbers defined. May be worth mentioning in the documentation. I'm only using http.

2 Likes

Absolutely! Thanks!

@jacobgraf I didn't want to clutter up your [RELEASE] thread with this long post, so I'll just tag you and the original thread: [RELEASE] NTFY Notifier Driver - Push Notifications via ntfy.sh or Self-Hosted.

I have been using Gotify for a while but really wanted something that could auto-expire messages. I was testing Pushover, which can do auto-expiration, but then realized that NTFY has update, clear, and delete functionality which is even better for my use case. It's also a big plus that NTFY can be self-hosted. However to use those functions you need to send a sequence-id as part of the message, which isn't an option in your current driver, so I forked the driver and made a few changes.

TLDR: I added support for sequence-id to enable updating, clearing, and deleting messages. I added the ability to override device settings so a single NTFY device can be re-used for multiple rules, and I made a companion driver for clearing and deleting messages.

I still need to test for a while, but if you're open to a PR, I can submit one. Otherwise I'll just keep my fork separate. I used Visual Studio and CoPilot to do most of the work. While I can just about get by in Groovy, it was much faster using the AI assistance. While the coding was AI-assisted, this rambling post is entirely the fault of my meat-brain.

Details:

  • I added a "sequence-id" field to the driver.

    • When you send a second message to a topic with the same sequence-id, it replaces the previous message. This can be really useful for status messages where only the most recent one matters.
    • One of my use cases is location tracking. I get region enter/exit notifications from Owntracks in Hubitat plus destination/ETA notifications from my wife's car navigation and geofence updates from the car (being sent from NodeRED) all of which add up to "where is my wife?"
    • I created a NTFY device with topic={wife's_name}location, title="Owntracks", and sequence-id = "{wife's_name}location". I have Owntracks sending each update to that device.
    • In NodeRED I sent the navigation/geofence messages to the same topic and sequence-id, but with different titles.
    • I only see the latest notification as each overwrites the previous one. The different titles tell me which data source pushed the message.
    • This could also be used to keep a persistent status notification, for example, use a rule to send the HSM status to topic=hsm sequence-id=hsm_status each time it changes. The notification in the hsm topic will always show the current HSM status. The old ones won't clutter up the history.
    • You could also set up a workflow where the old messages are retained, but they are cleared (marked as read) when the next message is sent so they are all in the history but only one is showing as unread.
  • I added the ability for the driver to process a JSON-formatted incoming notification message with the following overrides: topic, title, priority, tag, click action (open_url or http_request), actionurl, attachmenturl, attachmentfilename, iconurl, sequenceid, message

    • All of those are obviously fields from the device settings except 'message', which is used for the message body text.
    • This allows me to have a single NTFY driver device receive messages from multiple Rule Machine rules by setting the options in the JSON-formatted message.
    • If an incoming message has valid override tags, they are used in place of the configured settings. If the message doesn't have valid tags, it is just treated as regular message text.
    • So if I have a device set up with the topic "hubitat" the title "Hubitat", and priority 3 but I have a rule send a notification message like:
{"title":"HSM Alert","message":"HSM Failed to arm","priority":"5"}

I'll get this notification in the hubitat topic (notice the title and priority ^^^):

image

Finally, I added a companion driver that is used to clear or delete messages. It is set up with the Hubitat "notification" capability, so you can send it a message using the "Notify" action in rules. The only device preferences are protocol, host, and optionally username and password. You only need to create one device using this driver (per NTFY server) as the incoming message dictates its actions.

This driver expects an incoming notification message in JSON format with command, topic, and sequenceid fields. So if I sent an initial message to topic "hubitat" with sequenceid "abc123", I could then send a message to my clear/delete device like:

{"command":"clear","topic":"hubitat","sequenceid":"abc123"}

That would clear the notification, which leaves it on the list but makes it look like it was read. It clears from the phone app's notification pull-down and is removed from the new message count.

or I could send:

{"command":"delete","topic":"hubitat","sequenceid":"abc123"}

That would completely delete the message.

Putting that all together, with this hypothetical rule:

First I have this (notice the green "new message" dot)

image

Then 10 seconds later I have this (message is marked as read):

image

then 10 second later I have this:
image

I would really like to see and try your NTFY driver. It sounds like those extra features would be very handy in my notifications. I encourage you to make your code available. Thanks!

It's already out there if you know where to look :slight_smile: The direct link to my fork is GitHub - youzer-name/hubitat-ntfy-notification-driver. Here are the links to the raw text files you can copy/paste to your hub. You only need the second driver if you plan to use the clear and delete functions.

https://raw.githubusercontent.com/youzer-name/hubitat-ntfy-notification-driver/refs/heads/main/drivers/graftechnology/ntfy-clear-delete.groovy and https://raw.githubusercontent.com/youzer-name/hubitat-ntfy-notification-driver/refs/heads/main/drivers/graftechnology/ntfy-clear-delete.groovy

Caveats:

  • I haven't updated the README or docs at all, so for now the only documentation is what I wrote in this thread
  • I haven't tested all of the different override fields yet. All the ones I've tested worked as expected, but I haven't tried them all.

I have successfully set up a persistent HSM status notification that is automatically marked as 'read' using this rule:

image

Thank you! Sorry for my initial confusion. This is working perfectly for me now!

1 Like