[ntfy] Initial contribution#20560
Conversation
There was a problem hiding this comment.
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.ntfybundle 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.
b0632ad to
fc9b9f5
Compare
|
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 |
There was a problem hiding this comment.
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.
cfcb1a1 to
7cf1b25
Compare
There was a problem hiding this comment.
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.
lsiepel
left a comment
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Can you add the semantic equipment tags to all thing / bridges
209c300 to
bd91621
Compare
Signed-off-by: Christian Kittel <ckittel@gmx.de>
e8f54a9 to
82b8776
Compare
lsiepel
left a comment
There was a problem hiding this comment.
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
6ee1ce7 to
7de3df7
Compare
Signed-off-by: Christian Kittel <ckittel@gmx.de>
@lsiepel |
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
Noteworthy Changes & Documentation
Testing
I have tested this binding on a local openHAB 5.x instance with the following scenarios: