Skip to content

[ntfy] Initial contribution#20560

Open
EvilPingu wants to merge 2 commits intoopenhab:mainfrom
EvilPingu:ntfy
Open

[ntfy] Initial contribution#20560
EvilPingu wants to merge 2 commits intoopenhab:mainfrom
EvilPingu:ntfy

Conversation

@EvilPingu
Copy link
Copy Markdown
Contributor

Description

This pull request introduces a new binding for ntfy (https://ntfy.sh/), a simple HTTP-based pub-sub notification service.

Motivation and Goal

The goal of this binding is to provide a seamless way for openHAB users to send push notifications to their devices without relying on proprietary services or complex setups. Since ntfy is open-source and can be self-hosted, it perfectly aligns with openHAB's privacy-focused philosophy.

Features for the End User

  • Action Support: Provides a dedicated Rule Action to send notifications (including priority, tags, and titles) directly from DSL, JavaScript, or Blocky rules.
  • Flexible Configuration: Supports both the public ntfy.sh server and self-hosted instances.
  • Authentication: Supports username/password.
  • Dynamic Content: Allows sending notifications with custom icons (tags) and click-URLs.

Noteworthy Changes & Documentation

  • The binding includes a comprehensive README.md with configuration examples and a detailed description of the available Rule Actions.
  • It follows the standard openHAB coding guidelines and has been checked against static code analysis (Checkstyle/SpotBugs).
  • community thread for feedback has been initialized

Testing

I have tested this binding on a local openHAB 5.x instance with the following scenarios:

  • Sending messages to a self-hosted ntfy instance via Docker.
  • Verified Rule Action execution via DSL scripts and MainUI rules.
  • Tested different priority levels and tag combinations.

@EvilPingu EvilPingu added the new binding If someone has started to work on a binding. For a new binding PR. label Apr 12, 2026
@EvilPingu EvilPingu requested a review from a team as a code owner April 12, 2026 15:41
@lsiepel lsiepel requested a review from Copilot April 12, 2026 16:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a new openHAB binding for ntfy (HTTP-based pub-sub notifications), including a bridge for server configuration, topic Things for subscriptions, and Rule Actions for publishing/deleting notifications.

Changes:

  • Adds the new org.openhab.binding.ntfy bundle to the build reactor/BOM and assigns CODEOWNERS.
  • Implements ntfy bridge/topic handlers, websocket receiving, and HTTP publishing (with Rule Actions).
  • Adds initial unit tests, i18n resources, thing-types, feature, and README documentation.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 24 comments.

Show a summary per file
File Description
CODEOWNERS Adds code owner entry for the new ntfy binding bundle.
bundles/pom.xml Adds the ntfy binding module to the bundles reactor.
bom/openhab-addons/pom.xml Adds the ntfy binding artifact to the add-ons BOM.
bundles/org.openhab.binding.ntfy/pom.xml Declares the new binding Maven module.
bundles/org.openhab.binding.ntfy/NOTICE Adds NOTICE file for the new binding.
bundles/org.openhab.binding.ntfy/README.md Documents Things, channels, and Rule Actions for the binding.
bundles/org.openhab.binding.ntfy/src/main/feature/feature.xml Adds Karaf feature for installing the binding.
bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/addon/addon.xml Registers the add-on metadata for the binding.
bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/i18n/ntfy.properties Adds i18n strings for Things/config/channels.
bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/thing/thing-types.xml Declares bridge/topic Thing types, config, and channel types.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyBindingConstants.java Defines binding IDs, ThingTypeUIDs, and channel IDs.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyConnectionConfiguration.java Bridge configuration model (hostname, auth, timeout).
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyConnectionHandler.java Bridge handler managing websocket clients and auth headers.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyHandlerFactory.java OSGi factory wiring bridge/topic handlers and shared clients.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyTopicConfiguration.java Topic Thing configuration model (topicname).
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/NtfyTopicHandler.java Topic handler handling websocket events and channel updates; exposes actions service.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/action/NtfyActions.java Rule Actions (builder-style) for sending/deleting notifications.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/models/BaseEvent.java Base event model for websocket/message responses.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/models/EventType.java Enum mapping event string to typed event kind.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/models/MessageEvent.java Message event model (sequence_id, expires, message, priority).
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/models/OpenEvent.java Open event model.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/ActionButtonBase.java Base class for serializing ntfy action headers.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/BroadcastActionButton.java Broadcast action header implementation.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/CopyActionButton.java Copy action header implementation.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/HttpActionButton.java HTTP action header implementation.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/ViewActionButton.java View action header implementation.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/NtfyMessage.java Message builder object (priority/tags/icon/attachments/actions/etc.).
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/NtfyMessageHeaderBuilder.java Converts NtfyMessage fields into HTTP headers.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/NtfySender.java HTTP sender for publish/upload/delete requests.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/WebSocketConnectionListener.java Listener interface for websocket lifecycle and events.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/NtfyWebSocket.java Jetty websocket adapter deserializing incoming messages.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/GsonDeserializer.java Gson wrapper for event deserialization.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/EventDeserializer.java Polymorphic event deserializer based on event field.
bundles/org.openhab.binding.ntfy/src/main/java/org/openhab/binding/ntfy/internal/network/InstantDeserializer.java Gson adapter converting epoch seconds to Instant.
bundles/org.openhab.binding.ntfy/src/test/java/org/openhab/binding/ntfy/internal/network/NtfySenderTest.java Unit tests for sender publish/upload/delete behavior.
bundles/org.openhab.binding.ntfy/src/test/java/org/openhab/binding/ntfy/internal/network/NtfyMessageHeaderBuilderTest.java Unit tests for HTTP header generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ntfy/README.md Outdated
@EvilPingu EvilPingu force-pushed the ntfy branch 5 times, most recently from b0632ad to fc9b9f5 Compare April 15, 2026 17:27
@openhab-bot
Copy link
Copy Markdown
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/ntfy-new-binding-for-ntfy/169028/1

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ntfy/README.md Outdated
Comment thread bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/i18n/ntfy.properties Outdated
Comment thread bundles/pom.xml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/thing/thing-types.xml Outdated
Comment thread bundles/org.openhab.binding.ntfy/README.md Outdated
Comment thread bundles/org.openhab.binding.ntfy/README.md Outdated
Copy link
Copy Markdown
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binding code is improving, thanks for the quick follow-ups. I left some more comments.
After all is resolved, i might need one last pass.
Just as a reminder, check build warnings, SAT errors and i18n properties file when commiting these changes.


<label>Ntfy Connection</label>
<description>Connection to an ntfy server</description>
<representation-property>hostname</representation-property>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the semantic equipment tags to all thing / bridges

Comment thread bundles/org.openhab.binding.ntfy/src/main/resources/OH-INF/thing/thing-types.xml Outdated
@EvilPingu EvilPingu force-pushed the ntfy branch 3 times, most recently from 209c300 to bd91621 Compare April 25, 2026 07:51
@EvilPingu EvilPingu requested a review from lsiepel April 25, 2026 07:51
Signed-off-by: Christian Kittel <ckittel@gmx.de>
@EvilPingu EvilPingu force-pushed the ntfy branch 2 times, most recently from e8f54a9 to 82b8776 Compare April 26, 2026 12:22
Copy link
Copy Markdown
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed some progress and did another pass. Looked a bit closer now. Good to see no build or SAT errors. I have many smaller optimizations besides the few comments left open from the previous round.
I have one comment about the overall design. The topichandler does some plumbing to connect a http client, topichanlder and bridgehandler into the ntfysender. This design mix should be untagled by creating a clear hierarchie / responsibility.
topicHandler <=> bridgeHandler <=> connection / ntfysender

@EvilPingu EvilPingu force-pushed the ntfy branch 2 times, most recently from 6ee1ce7 to 7de3df7 Compare April 29, 2026 17:10
Signed-off-by: Christian Kittel <ckittel@gmx.de>
@EvilPingu
Copy link
Copy Markdown
Contributor Author

Noticed some progress and did another pass. Looked a bit closer now. Good to see no build or SAT errors. I have many smaller optimizations besides the few comments left open from the previous round. I have one comment about the overall design. The topichandler does some plumbing to connect a http client, topichanlder and bridgehandler into the ntfysender. This design mix should be untagled by creating a clear hierarchie / responsibility. topicHandler <=> bridgeHandler <=> connection / ntfysender

@lsiepel
I have changed the hierarchie a little bit. The sender is now completely created by the bridge but the topic holds an reference to the sender. Please have a look again. However the code is much simpler now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new binding If someone has started to work on a binding. For a new binding PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants