@eribbey/homebridge-ntfy 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ @eribbey/homebridge-ntfy
2
+ Copyright 2026 Evan Ribbey
3
+
4
+ This product includes software originally developed as "homebridge-ntfy"
5
+ by Emil Löfblom (https://github.com/emilof/homebridge-ntfy), licensed under
6
+ the Apache License, Version 2.0.
7
+
8
+ This is a maintained fork of that project. Changes made in this fork include:
9
+
10
+ - Support for publishing to a custom (self-hosted or SaaS) ntfy server
11
+ instead of only the official https://ntfy.sh server.
12
+ - Authentication support via access token or username/password.
13
+ - More detailed logging of failed publish requests.
14
+
15
+ The original work remains available under the Apache License, Version 2.0,
16
+ a copy of which is included in the LICENSE file.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # Homebridge Ntfy
2
+
3
+ [![npm](https://img.shields.io/npm/v/@eribbey/homebridge-ntfy/latest?label=latest)](https://www.npmjs.com/package/@eribbey/homebridge-ntfy)
4
+ [![npm](https://img.shields.io/npm/dt/@eribbey/homebridge-ntfy)](https://www.npmjs.com/package/@eribbey/homebridge-ntfy)
5
+
6
+ > Maintained fork of [emilof/homebridge-ntfy](https://github.com/emilof/homebridge-ntfy), published as
7
+ > [`@eribbey/homebridge-ntfy`](https://www.npmjs.com/package/@eribbey/homebridge-ntfy). Adds support for custom
8
+ > (self-hosted or SaaS) ntfy servers and authentication. The upstream project is no longer actively maintained.
9
+
10
+ This plugin allows you to send notifications through ntfy (https://ntfy.sh) directly from HomeKit. It works by creating a momentary switch, that when turned on, sends a message via ntfy. Once the message has been sent, the switch automatically returns to its off state.
11
+
12
+ Messages are sent through the official ntfy.sh server by default, but you can point the plugin at your own self-hosted or SaaS ntfy server instead. See [Custom server](#custom-server).
13
+
14
+ This is especially useful if you want to send a notification to your device when a particular event occurs. Simply create a HomeKit automation that is triggered by the desired event or condition, and set the action to turn on the switch.
15
+
16
+ ## Prerequisites
17
+
18
+ - Homebridge installed
19
+ - The ntfy app installed on your device
20
+ - Optional: a self-hosted or SaaS ntfy server, if you'd rather not use the official ntfy.sh server
21
+
22
+ ## Installation
23
+
24
+ ### Option 1: Homebridge UI
25
+
26
+ Go to the 'Plugins' page, search for `@eribbey/homebridge-ntfy`, and click 'Install'.
27
+
28
+ ### Option 2: Manually
29
+
30
+ Run the following command to install the plugin globally:
31
+
32
+ $ sudo npm install @eribbey/homebridge-ntfy -g
33
+
34
+ ### Migrating from `homebridge-ntfy`
35
+
36
+ This fork uses the same platform identifier (`NtfyPlatform`) as upstream, so your existing
37
+ `platforms` config block works unchanged. To switch over:
38
+
39
+ 1. Uninstall `homebridge-ntfy`.
40
+ 2. Install `@eribbey/homebridge-ntfy`.
41
+ 3. Restart Homebridge.
42
+
43
+ Because Homebridge caches accessories per plugin, the switches are re-created under the new
44
+ plugin. They keep the same names, but any HomeKit automations referencing them may need to be
45
+ re-pointed at the new accessories.
46
+
47
+ ## Configuration
48
+
49
+ ### Option 1: Homebridge UI
50
+
51
+ The easiest way to configure the plugin is to use the config UI in Homebridge. It will be displayed automatically after you've installed the plugin. If not, it can be found under the 'More Menu' `⋮` for the 'Homebridge Ntfy' plugin.
52
+
53
+ ### Option 2: Manually
54
+
55
+ An alternative is to edit the Homebridge JSON config file manually by adding the following config to the `platforms` array:
56
+
57
+ ```json
58
+ {
59
+ "platform": "NtfyPlatform",
60
+ "messages": [
61
+ {
62
+ "name": "Send warning message",
63
+ "topic": "my-private-topic-9yfxy",
64
+ "message": "Warning message text"
65
+ }
66
+ ]
67
+ }
68
+ ```
69
+
70
+ ## Config Properties
71
+
72
+ | Property | Type | Required | Description |
73
+ | --------------------- | --------- | -------- | ------------------------------------------------------------------------- |
74
+ | `platform` | `string` | Yes | Platform identifier. **Do not change this line** |
75
+ | `serverUrl` | `string` | No | Base URL of the ntfy server to publish to. A base path is supported for servers behind a reverse proxy, e.g. `https://home.example.com/ntfy`. Default: **https://ntfy.sh**. |
76
+ | `authType` | `string` | No | Authentication method to use when publishing: `none`, `token` or `basic`. Default: **none**. [[More info](https://docs.ntfy.sh/publish/#authentication)] |
77
+ | `accessToken` | `string` | Yes/No | Required if `authType` is set to `token`. [[More info](https://docs.ntfy.sh/config/#access-tokens)] |
78
+ | `username` | `string` | Yes/No | Required if `authType` is set to `basic`. |
79
+ | `password` | `string` | Yes/No | Required if `authType` is set to `basic`. |
80
+ | `messages` | `array` | Yes | List of messages/switch accessories to setup in HomeKit. |
81
+ | └ `name` | `string` | Yes | Name of the switch shown in the Home app. |
82
+ | └ `useJson` | `boolean` | No | Set to `true` to use ntfy JSON format. See parameter `json`. Default: **false**. |
83
+ | └ `topic` | `string` | Yes/No | Required if `useJson` is set to `false`. |
84
+ | └ `title` | `string` | No | Title of the notification sent to the device. |
85
+ | └ `message` | `string` | No | Message text of the notification sent to the device. |
86
+ | └ `priority` | `string` | No | Priority of the message. Default: **default**. [[More info](https://docs.ntfy.sh/publish/#message-priority)] |
87
+ | └ `tags` | `string` | No | Tag message with emoji or text tag. A comma-separated list of tag names. [[More info](https://docs.ntfy.sh/emojis)] |
88
+ | └ `json` | `string` | Yes/No | Required if `useJson` is set to `true`. For advanced users ONLY. The value must be a valid JSON string (escaped) and adhere to ntfy's JSON message format. [[More info](https://docs.ntfy.sh/subscribe/api/#json-message-format)] |
89
+ | └ `cooldownTime` | `number` | No | Minimum time before this message can be sent again. Default: no cooldown. |
90
+
91
+ ### Example config
92
+
93
+ In the example below, two switch accessories have been configured. The first one has high priority and the second one has a emoji (tag) and cooldown set.
94
+
95
+ ```json
96
+ {
97
+ "platform": "NtfyPlatform",
98
+ "messages": [
99
+ {
100
+ "name": "Send warning message",
101
+ "topic": "my-private-topic-9yfxy",
102
+ "title": "Warning title",
103
+ "message": "High priority warning message",
104
+ "priority": "high"
105
+ },
106
+ {
107
+ "name": "Send alert message",
108
+ "topic": "my-private-topic-9yfxy",
109
+ "title": "Alert title",
110
+ "message": "Alert with emoji that can be triggered once every 10 seconds at most",
111
+ "tags": "warning",
112
+ "cooldownTime": 10000
113
+ }
114
+ ]
115
+ }
116
+ ```
117
+
118
+ ## Custom server
119
+
120
+ By default the plugin publishes to the official server at `https://ntfy.sh`. Set `serverUrl` to use your own self-hosted or SaaS server instead. The URL is the base address of the server, not a topic URL — the topic from each message is appended automatically.
121
+
122
+ ```json
123
+ {
124
+ "platform": "NtfyPlatform",
125
+ "serverUrl": "https://ntfy.home.example.com",
126
+ "messages": [
127
+ {
128
+ "name": "Send warning message",
129
+ "topic": "home-alerts",
130
+ "message": "Warning message text"
131
+ }
132
+ ]
133
+ }
134
+ ```
135
+
136
+ If no protocol is given, `https` is assumed. A base path is kept, so a server behind a reverse proxy such as `https://home.example.com/ntfy` works too. If the URL can't be parsed, the plugin logs an error and falls back to `https://ntfy.sh`.
137
+
138
+ ### Authentication
139
+
140
+ Self-hosted servers usually have access control enabled, and the official server needs authentication for protected topics. Set `authType` to `token` or `basic` and supply the matching credentials. ([Read more](https://docs.ntfy.sh/publish/#authentication))
141
+
142
+ Using an access token:
143
+
144
+ ```json
145
+ {
146
+ "platform": "NtfyPlatform",
147
+ "serverUrl": "https://ntfy.home.example.com",
148
+ "authType": "token",
149
+ "accessToken": "tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2",
150
+ "messages": [
151
+ {
152
+ "name": "Send warning message",
153
+ "topic": "home-alerts",
154
+ "message": "Warning message text"
155
+ }
156
+ ]
157
+ }
158
+ ```
159
+
160
+ Using a username and password:
161
+
162
+ ```json
163
+ {
164
+ "platform": "NtfyPlatform",
165
+ "serverUrl": "https://ntfy.home.example.com",
166
+ "authType": "basic",
167
+ "username": "homebridge",
168
+ "password": "your-password",
169
+ "messages": [
170
+ {
171
+ "name": "Send warning message",
172
+ "topic": "home-alerts",
173
+ "message": "Warning message text"
174
+ }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ Credentials are sent as an `Authorization` header on every request, so use `https` for any server reachable outside your local network. If the credentials are incomplete, the plugin logs an error and sends requests unauthenticated. When the server rejects the credentials, the resulting `401`/`403` is reported in the Homebridge log.
180
+
181
+ Authentication applies to JSON format messages as well.
182
+
183
+ ## JSON message config
184
+
185
+ When 'Use JSON format' is enabled, you have the ability to set a custom config (JSON) for your messages. Using this format will unlock more advanced features that cannot be configured using the standard Homebridge plugin config UI. The value must be a valid JSON string and adhere to ntfy's JSON message format. ([Read more](https://docs.ntfy.sh/subscribe/api/#json-message-format)).
186
+
187
+ Note: Use the plugin config UI when setting the JSON message config. If you're editing the Homebridge config, the JSON message config (stored in `json`) must be escaped first.
188
+
189
+ ### Example JSON message config
190
+
191
+ In the example below, a message has been configured to have two action buttons. Pressing the first one opens a webpage, and pressing the second one calls a server endpoint with a pre-configured payload.
192
+
193
+ ```json
194
+ {
195
+ "topic": "my-private-topic-9yfxy",
196
+ "title": "Adjust A/C",
197
+ "message": "You left the house. Turn down the A/C?",
198
+ "actions": [
199
+ {
200
+ "action": "view",
201
+ "label": "Open portal",
202
+ "url": "https://home.nest.com/",
203
+ "clear": true
204
+ },
205
+ {
206
+ "action": "http",
207
+ "label": "Turn down",
208
+ "url": "https://api.nest.com/",
209
+ "body": "{\"temperature\": 65}"
210
+ }
211
+ ]
212
+ }
213
+ ```
@@ -0,0 +1,219 @@
1
+ {
2
+ "pluginAlias": "NtfyPlatform",
3
+ "pluginType": "platform",
4
+ "singular": true,
5
+ "schema": {
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "title": "Name",
10
+ "type": "string",
11
+ "default": "Homebridge Ntfy"
12
+ },
13
+ "serverUrl": {
14
+ "title": "Server URL",
15
+ "description": "Base URL of the ntfy server to publish to. Leave empty to use the official server at https://ntfy.sh. A base path is supported for servers behind a reverse proxy, e.g. https://home.example.com/ntfy.",
16
+ "placeholder": "https://ntfy.sh",
17
+ "type": "string"
18
+ },
19
+ "authType": {
20
+ "title": "Authentication",
21
+ "description": "How to authenticate when publishing. Self-hosted servers usually require this, and the official server needs it for protected topics. [<a href=\"https://docs.ntfy.sh/publish/#authentication\" target=\"_blank\">More info</a>]",
22
+ "type": "string",
23
+ "default": "none",
24
+ "oneOf": [
25
+ {
26
+ "title": "None",
27
+ "const": "none"
28
+ },
29
+ {
30
+ "title": "Access token",
31
+ "const": "token"
32
+ },
33
+ {
34
+ "title": "Username and password",
35
+ "const": "basic"
36
+ }
37
+ ]
38
+ },
39
+ "accessToken": {
40
+ "title": "Access token <strong><font color=\"red\" class=\"text-danger\">*</font></strong>",
41
+ "description": "Access token used to publish to the server. [<a href=\"https://docs.ntfy.sh/config/#access-tokens\" target=\"_blank\">More info</a>]",
42
+ "placeholder": "tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2",
43
+ "type": "string",
44
+ "x-schema-form": {
45
+ "type": "password"
46
+ },
47
+ "condition": {
48
+ "functionBody": "return model.authType === 'token';"
49
+ }
50
+ },
51
+ "username": {
52
+ "title": "Username <strong><font color=\"red\" class=\"text-danger\">*</font></strong>",
53
+ "description": "Username of an account allowed to publish to the topic.",
54
+ "type": "string",
55
+ "condition": {
56
+ "functionBody": "return model.authType === 'basic';"
57
+ }
58
+ },
59
+ "password": {
60
+ "title": "Password <strong><font color=\"red\" class=\"text-danger\">*</font></strong>",
61
+ "description": "Password for the account above.",
62
+ "type": "string",
63
+ "x-schema-form": {
64
+ "type": "password"
65
+ },
66
+ "condition": {
67
+ "functionBody": "return model.authType === 'basic';"
68
+ }
69
+ },
70
+ "messages": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "object",
74
+ "properties": {
75
+ "name": {
76
+ "title": "Name",
77
+ "description": "Name of the switch shown in the Home app.",
78
+ "type": "string"
79
+ },
80
+ "useJson": {
81
+ "title": "Use JSON format",
82
+ "description": "For advanced users ONLY! Using JSON will give you more options and the ability to utilize more features in ntfy.",
83
+ "type": "boolean",
84
+ "default": false
85
+ },
86
+ "topic": {
87
+ "title": "Topic <strong><font color=\"red\" class=\"text-danger\">*</font></strong>",
88
+ "description": "Topic to publish message to. <strong>Important:</strong> Topics are public on ntfy's server and can be read by anyone, so pick a name that is hard for others to guess.",
89
+ "placeholder": "my-topic-2fd8cffa",
90
+ "type": "string",
91
+ "condition": {
92
+ "functionBody": "return !model.messages[arrayIndices].useJson;"
93
+ }
94
+ },
95
+ "title": {
96
+ "title": "Title",
97
+ "description": "Title of the message.",
98
+ "type": "string",
99
+ "condition": {
100
+ "functionBody": "return !model.messages[arrayIndices].useJson;"
101
+ }
102
+ },
103
+ "message": {
104
+ "title": "Message",
105
+ "description": "The message text.",
106
+ "type": "string",
107
+ "condition": {
108
+ "functionBody": "return !model.messages[arrayIndices].useJson;"
109
+ }
110
+ },
111
+ "priority": {
112
+ "title": "Priority",
113
+ "description": "Priority of the message. [<a href=\"https://docs.ntfy.sh/publish/#message-priority\" target=\"_blank\">More info</a>]",
114
+ "type": "string",
115
+ "oneOf": [
116
+ {
117
+ "title": "Max",
118
+ "const": "max"
119
+ },
120
+ {
121
+ "title": "High",
122
+ "const": "high"
123
+ },
124
+ {
125
+ "title": "Default",
126
+ "const": "default"
127
+ },
128
+ {
129
+ "title": "Low",
130
+ "const": "low"
131
+ },
132
+ {
133
+ "title": "Min",
134
+ "const": "min"
135
+ }
136
+ ],
137
+ "condition": {
138
+ "functionBody": "return !model.messages[arrayIndices].useJson;"
139
+ }
140
+ },
141
+ "tags": {
142
+ "title": "Tags",
143
+ "description": "Tag message with emoji or text tag. A comma separated list of tag names. [<a href=\"https://docs.ntfy.sh/emojis\" target=\"_blank\">More info</a>]",
144
+ "type": "string",
145
+ "condition": {
146
+ "functionBody": "return !model.messages[arrayIndices].useJson;"
147
+ }
148
+ },
149
+ "json": {
150
+ "title": "JSON message config <strong><font color=\"red\" class=\"text-danger\">*</font></strong>",
151
+ "description": "Input must be a valid JSON string and adhere to ntfy's JSON message format. [<a href=\"https://docs.ntfy.sh/subscribe/api/#json-message-format\" target=\"_blank\">More info</a>]",
152
+ "type": "string",
153
+ "condition": {
154
+ "functionBody": "return model.messages[arrayIndices].useJson;"
155
+ }
156
+ },
157
+ "cooldownTime": {
158
+ "title": "Cooldown time (millis)",
159
+ "description": "Minimum time before this message can be sent again. Default: off",
160
+ "type": "integer"
161
+ }
162
+ },
163
+ "required": ["name"],
164
+ "if": {
165
+ "properties": {
166
+ "useJson": { "const": true }
167
+ }
168
+ },
169
+ "then": {
170
+ "required": ["json"]
171
+ },
172
+ "else": {
173
+ "required": ["topic"]
174
+ }
175
+ }
176
+ }
177
+ },
178
+ "required": ["name"]
179
+ },
180
+ "layout": [
181
+ {
182
+ "type": "fieldset",
183
+ "title": "Server",
184
+ "expandable": true,
185
+ "expanded": true,
186
+ "items": [
187
+ "serverUrl",
188
+ "authType",
189
+ "accessToken",
190
+ "username",
191
+ "password"
192
+ ]
193
+ },
194
+ {
195
+ "type": "array",
196
+ "title": "Messages",
197
+ "key": "messages",
198
+ "items": [
199
+ {
200
+ "type": "section",
201
+ "items": [
202
+ "messages[].name",
203
+ "messages[].useJson",
204
+ "messages[].topic",
205
+ "messages[].title",
206
+ "messages[].message",
207
+ "messages[].priority",
208
+ "messages[].tags",
209
+ {
210
+ "key": "messages[].json",
211
+ "type": "textarea"
212
+ },
213
+ "messages[].cooldownTime"
214
+ ]
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ }
@@ -0,0 +1,3 @@
1
+ export declare const PLATFORM_NAME = "NtfyPlatform";
2
+ export declare const PLUGIN_NAME = "@eribbey/homebridge-ntfy";
3
+ export declare const DEFAULT_SERVER_URL = "https://ntfy.sh";
package/dist/const.js ADDED
@@ -0,0 +1,4 @@
1
+ export const PLATFORM_NAME = 'NtfyPlatform';
2
+ export const PLUGIN_NAME = '@eribbey/homebridge-ntfy';
3
+ export const DEFAULT_SERVER_URL = 'https://ntfy.sh';
4
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { API } from 'homebridge';
2
+ declare const _default: (api: API) => void;
3
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { NtfyPlatform } from './platform.js';
2
+ import { PLATFORM_NAME } from './const.js';
3
+ export default (api) => {
4
+ api.registerPlatform(PLATFORM_NAME, NtfyPlatform);
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { Logging } from 'homebridge';
2
+ import type { NtfyAuth } from './types.js';
3
+ export interface MessageRequest {
4
+ topic: string;
5
+ message?: string;
6
+ title?: string;
7
+ tags?: string;
8
+ priority?: number;
9
+ }
10
+ export declare class NtfyClient {
11
+ private readonly log;
12
+ private readonly serverAddress;
13
+ private readonly authHeader?;
14
+ constructor(log: Logging, serverAddress: string, auth?: NtfyAuth);
15
+ sendMessage(request: MessageRequest | string): Promise<void>;
16
+ private sendMessageRequest;
17
+ private sendMessageJson;
18
+ private baseHeaders;
19
+ private buildAuthHeader;
20
+ private logRequestError;
21
+ private isMessageRequest;
22
+ }
@@ -0,0 +1,85 @@
1
+ import axios from 'axios';
2
+ export class NtfyClient {
3
+ log;
4
+ serverAddress;
5
+ authHeader;
6
+ constructor(log, serverAddress, auth) {
7
+ this.log = log;
8
+ this.serverAddress = serverAddress;
9
+ this.authHeader = this.buildAuthHeader(auth);
10
+ }
11
+ async sendMessage(request) {
12
+ if (this.isMessageRequest(request)) {
13
+ return this.sendMessageRequest(request);
14
+ }
15
+ else if (typeof request === 'string') {
16
+ return this.sendMessageJson(request);
17
+ }
18
+ else {
19
+ this.log.error('Unknown request type:', request);
20
+ }
21
+ }
22
+ async sendMessageRequest(request) {
23
+ this.log.debug('Sending ntfy request:', request);
24
+ const url = `${this.serverAddress}/${request.topic}`;
25
+ const body = request.message;
26
+ const headers = this.baseHeaders();
27
+ if (request.title) {
28
+ headers.Title = request.title;
29
+ }
30
+ if (request.priority) {
31
+ headers.Priority = request.priority.toString();
32
+ }
33
+ if (request.tags) {
34
+ headers.Tags = request.tags;
35
+ }
36
+ await axios.post(url, body, { headers })
37
+ .then(response => {
38
+ this.log.debug('Success! Result:', response.data);
39
+ })
40
+ .catch(error => {
41
+ this.logRequestError(error);
42
+ });
43
+ }
44
+ async sendMessageJson(json) {
45
+ this.log.debug('Sending ntfy JSON request:', JSON.parse(json));
46
+ await axios.post(this.serverAddress, json, { headers: this.baseHeaders() })
47
+ .then(response => {
48
+ this.log.debug('Success! Result:', response.data);
49
+ })
50
+ .catch(error => {
51
+ this.logRequestError(error);
52
+ });
53
+ }
54
+ baseHeaders() {
55
+ return this.authHeader ? { Authorization: this.authHeader } : {};
56
+ }
57
+ buildAuthHeader(auth) {
58
+ if (!auth) {
59
+ return undefined;
60
+ }
61
+ if (auth.type === 'token') {
62
+ return `Bearer ${auth.accessToken}`;
63
+ }
64
+ const credentials = Buffer.from(`${auth.username}:${auth.password ?? ''}`).toString('base64');
65
+ return `Basic ${credentials}`;
66
+ }
67
+ logRequestError(error) {
68
+ if (axios.isAxiosError(error) && error.response) {
69
+ const { status, data } = error.response;
70
+ const details = typeof data === 'string' ? data : JSON.stringify(data);
71
+ if (status === 401 || status === 403) {
72
+ this.log.error(`ntfy request failed: ${status} - the server rejected the credentials. `
73
+ + 'Check the authentication settings and that the token or user is allowed to publish to this topic.', details);
74
+ return;
75
+ }
76
+ this.log.error(`ntfy request failed: ${status}`, details);
77
+ return;
78
+ }
79
+ this.log.error('ntfy request failed:', error instanceof Error ? error.message : error);
80
+ }
81
+ isMessageRequest(obj) {
82
+ return typeof obj.topic === 'string';
83
+ }
84
+ }
85
+ //# sourceMappingURL=ntfy-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ntfy-client.js","sourceRoot":"","sources":["../src/ntfy-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,MAAM,OAAO,UAAU;IAIF;IACA;IAJF,UAAU,CAAU;IAErC,YACmB,GAAY,EACZ,aAAqB,EACtC,IAAe;QAFE,QAAG,GAAH,GAAG,CAAS;QACZ,kB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CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9F,OAAO,SAAS,WAAW,EAAE,CAAC;IAChC,CAAC;IAEO,eAAe,CAAC,KAAc;QACpC,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;YACxC,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAEvE,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrC,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,wBAAwB,MAAM,0CAA0C;sBACtE,mGAAmG,EACrG,OAAO,CACR,CAAC;gBACF,OAAO;YACT,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzF,CAAC;IAEO,gBAAgB,CAAC,GAAY;QACnC,OAAO,OAAQ,GAA0B,CAAC,KAAK,KAAK,QAAQ,CAAC;IAC/D,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, PlatformConfig, Service } from 'homebridge';
2
+ export declare class NtfyPlatform implements DynamicPlatformPlugin {
3
+ readonly log: Logging;
4
+ readonly config: PlatformConfig;
5
+ readonly api: API;
6
+ readonly Service: typeof Service;
7
+ readonly Characteristic: typeof Characteristic;
8
+ private readonly accessories;
9
+ private readonly discoveredCacheUUIDs;
10
+ constructor(log: Logging, config: PlatformConfig, api: API);
11
+ configureAccessory(accessory: PlatformAccessory): void;
12
+ private registerAccessories;
13
+ private resolveServerUrl;
14
+ private resolveAuth;
15
+ private validateMessage;
16
+ }
@@ -0,0 +1,108 @@
1
+ import { SwitchAccessory } from './switch-accessory.js';
2
+ import { DEFAULT_SERVER_URL, PLATFORM_NAME, PLUGIN_NAME } from './const.js';
3
+ import { NtfyClient } from './ntfy-client.js';
4
+ import { isValidJson, normalizeServerUrl } from './utils.js';
5
+ export class NtfyPlatform {
6
+ log;
7
+ config;
8
+ api;
9
+ Service;
10
+ Characteristic;
11
+ accessories = new Map();
12
+ discoveredCacheUUIDs = [];
13
+ constructor(log, config, api) {
14
+ this.log = log;
15
+ this.config = config;
16
+ this.api = api;
17
+ this.Service = api.hap.Service;
18
+ this.Characteristic = api.hap.Characteristic;
19
+ this.log.debug('Finished initializing platform:', config.name);
20
+ this.api.on('didFinishLaunching', () => {
21
+ log.debug('Registering accessories...');
22
+ this.registerAccessories();
23
+ });
24
+ }
25
+ configureAccessory(accessory) {
26
+ this.log.debug('Loading accessory from cache:', accessory.displayName);
27
+ this.accessories.set(accessory.UUID, accessory);
28
+ }
29
+ registerAccessories() {
30
+ const config = this.config;
31
+ const serverUrl = this.resolveServerUrl(config);
32
+ this.log.info('Using ntfy server:', serverUrl);
33
+ const ntfyClient = new NtfyClient(this.log, serverUrl, this.resolveAuth(config));
34
+ if (config.messages) {
35
+ for (const message of config.messages) {
36
+ if (!this.validateMessage(message)) {
37
+ continue;
38
+ }
39
+ const uuid = this.api.hap.uuid.generate(message.name);
40
+ const existingAccessory = this.accessories.get(uuid);
41
+ if (existingAccessory) {
42
+ this.log.debug('Restoring existing accessory from cache:', existingAccessory.displayName);
43
+ new SwitchAccessory(this, existingAccessory, ntfyClient, message);
44
+ }
45
+ else {
46
+ this.log.debug('Adding new accessory:', message.name);
47
+ const accessory = new this.api.platformAccessory(message.name, uuid);
48
+ new SwitchAccessory(this, accessory, ntfyClient, message);
49
+ this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
50
+ }
51
+ this.discoveredCacheUUIDs.push(uuid);
52
+ }
53
+ }
54
+ for (const [uuid, accessory] of this.accessories) {
55
+ if (!this.discoveredCacheUUIDs.includes(uuid)) {
56
+ this.log.debug('Removing existing accessory from cache:', accessory.displayName);
57
+ this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
58
+ }
59
+ }
60
+ }
61
+ resolveServerUrl(config) {
62
+ const serverUrl = normalizeServerUrl(config.serverUrl);
63
+ if (config.serverUrl?.trim() && !serverUrl) {
64
+ this.log.error(`Invalid server URL - falling back to ${DEFAULT_SERVER_URL}:`, config.serverUrl);
65
+ }
66
+ return serverUrl ?? DEFAULT_SERVER_URL;
67
+ }
68
+ resolveAuth(config) {
69
+ switch (config.authType) {
70
+ case 'token':
71
+ if (!config.accessToken) {
72
+ this.log.error('Access token authentication is selected but no access token is configured. Sending requests unauthenticated.');
73
+ return undefined;
74
+ }
75
+ return { type: 'token', accessToken: config.accessToken };
76
+ case 'basic':
77
+ if (!config.username || !config.password) {
78
+ this.log.error('Username/password authentication is selected but the credentials are incomplete. Sending requests unauthenticated.');
79
+ return undefined;
80
+ }
81
+ return { type: 'basic', username: config.username, password: config.password };
82
+ default:
83
+ return undefined;
84
+ }
85
+ }
86
+ validateMessage(message) {
87
+ let error;
88
+ if (message.useJson) {
89
+ if (!message.json) {
90
+ error = 'Invalid JSON message config - \'json\' is missing:';
91
+ }
92
+ else if (!isValidJson(message.json)) {
93
+ error = 'Invalid JSON message config - \'json\' is malformed:';
94
+ }
95
+ }
96
+ else {
97
+ if (!message.topic) {
98
+ error = 'Invalid JSON message config - \'topic\' is missing:';
99
+ }
100
+ }
101
+ if (error) {
102
+ this.log.error(error, message.name);
103
+ return false;
104
+ }
105
+ return true;
106
+ }
107
+ }
108
+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AAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;YAE5D,KAAK,OAAO;gBACV,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACzC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oHAAoH,CAAC,CAAC;oBACrI,OAAO,SAAS,CAAC;gBACnB,CAAC;gBACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;YAEjF;gBACE,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,OAAgB;QACtC,IAAI,KAAK,CAAC;QACV,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,GAAG,oDAAoD,CAAC;YAC/D,CAAC;iBAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,KAAK,GAAG,sDAAsD,CAAC;YACjE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnB,KAAK,GAAG,qDAAqD,CAAC;YAChE,CAAC;QACH,CAAC;QACD,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import type { PlatformAccessory } from 'homebridge';
2
+ import type { NtfyClient } from './ntfy-client.js';
3
+ import type { NtfyPlatform } from './platform.js';
4
+ import type { Message } from './types.js';
5
+ export declare class SwitchAccessory {
6
+ private readonly platform;
7
+ private readonly accessory;
8
+ private readonly ntfyClient;
9
+ private readonly message;
10
+ private log;
11
+ private service;
12
+ private onCharacteristic;
13
+ private isOn;
14
+ private inCooldown;
15
+ constructor(platform: NtfyPlatform, accessory: PlatformAccessory, ntfyClient: NtfyClient, message: Message);
16
+ private setOn;
17
+ private getOn;
18
+ private sendMessage;
19
+ private triggerCooldown;
20
+ private resetSwitch;
21
+ }
@@ -0,0 +1,90 @@
1
+ import { wait } from './utils.js';
2
+ export class SwitchAccessory {
3
+ platform;
4
+ accessory;
5
+ ntfyClient;
6
+ message;
7
+ log;
8
+ service;
9
+ onCharacteristic;
10
+ isOn = false;
11
+ inCooldown = false;
12
+ constructor(platform, accessory, ntfyClient, message) {
13
+ this.platform = platform;
14
+ this.accessory = accessory;
15
+ this.ntfyClient = ntfyClient;
16
+ this.message = message;
17
+ this.log = platform.log;
18
+ // Set accessory information
19
+ const infoService = this.accessory.getService(this.platform.Service.AccessoryInformation);
20
+ if (infoService) {
21
+ infoService
22
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'Homebridge Ntfy')
23
+ .setCharacteristic(this.platform.Characteristic.Model, 'Notification Switch')
24
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, 'N/A');
25
+ }
26
+ this.service = this.accessory.getService(this.platform.Service.Switch) || this.accessory.addService(this.platform.Service.Switch);
27
+ this.service.setCharacteristic(this.platform.Characteristic.Name, this.message.name);
28
+ this.onCharacteristic = this.service.getCharacteristic(this.platform.Characteristic.On);
29
+ // Register handlers for the On/Off Characteristic
30
+ this.onCharacteristic
31
+ .onSet(this.setOn.bind(this))
32
+ .onGet(this.getOn.bind(this));
33
+ }
34
+ async setOn(value) {
35
+ this.log.debug('setOn:', value);
36
+ this.isOn = value;
37
+ this.onCharacteristic.updateValue(this.isOn);
38
+ if (this.inCooldown) {
39
+ this.log.info('Still in cooldown:', this.message.name);
40
+ await wait(250);
41
+ this.resetSwitch();
42
+ return;
43
+ }
44
+ if (this.isOn) {
45
+ this.triggerCooldown(this.message.cooldownTime);
46
+ await this.sendMessage();
47
+ this.resetSwitch();
48
+ }
49
+ }
50
+ async getOn() {
51
+ return this.isOn;
52
+ }
53
+ async sendMessage() {
54
+ let request;
55
+ if (!this.message.useJson && this.message.topic) {
56
+ request = {
57
+ topic: this.message.topic,
58
+ title: this.message.title,
59
+ message: this.message.message,
60
+ priority: this.message.priority,
61
+ tags: this.message.tags,
62
+ };
63
+ }
64
+ else if (this.message.useJson && this.message.json) {
65
+ request = this.message.json;
66
+ }
67
+ else {
68
+ this.log.info('Nothing to send. Check configuration for:', this.message.name);
69
+ return;
70
+ }
71
+ await this.ntfyClient.sendMessage(request);
72
+ this.log.info('Message sent:', this.message.name);
73
+ }
74
+ async triggerCooldown(cooldownTime = 0) {
75
+ if (cooldownTime <= 0) {
76
+ return;
77
+ }
78
+ this.log.debug('Entering cooldown:', this.message.name);
79
+ this.inCooldown = true;
80
+ await wait(cooldownTime);
81
+ this.inCooldown = false;
82
+ this.log.debug('Exited cooldown:', this.message.name);
83
+ }
84
+ resetSwitch() {
85
+ this.log.debug('Resetting switch:', this.message.name);
86
+ this.isOn = false;
87
+ this.onCharacteristic.updateValue(this.isOn);
88
+ }
89
+ }
90
+ //# sourceMappingURL=switch-accessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-accessory.js","sourceRoot":"","sources":["../src/switch-accessory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,OAAO,eAAe;IASP;IACA;IACA;IACA;IAXX,GAAG,CAAS;IACZ,OAAO,CAAU;IACjB,gBAAgB,CAAiB;IAEjC,IAAI,GAAG,KAAK,CAAC;IACb,UAAU,GAAG,KAAK,CAAC;IAE3B,YACmB,QAAsB,EACtB,SAA4B,EAC5B,UAAsB,EACtB,OAAgB;QAHhB,aAAQ,GAAR,QAAQ,CAAc;QACtB,cAAS,GAAT,SAAS,CAAmB;QAC5B,eAAU,GAAV,UAAU,CAAY;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I,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACrD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9E,OAAO;QACT,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,YAAY,GAAG,CAAC;QAC5C,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import { PlatformConfig } from 'homebridge';
2
+ export type AuthType = 'none' | 'token' | 'basic';
3
+ export interface NtfyPlatformConfig extends PlatformConfig {
4
+ serverUrl?: string;
5
+ authType?: AuthType;
6
+ accessToken?: string;
7
+ username?: string;
8
+ password?: string;
9
+ messages: Message[];
10
+ }
11
+ export interface NtfyAuth {
12
+ type: Exclude<AuthType, 'none'>;
13
+ accessToken?: string;
14
+ username?: string;
15
+ password?: string;
16
+ }
17
+ export interface Message {
18
+ name: string;
19
+ topic?: string;
20
+ title?: string;
21
+ message?: string;
22
+ priority?: number;
23
+ tags?: string;
24
+ useJson?: boolean;
25
+ json?: string;
26
+ cooldownTime?: number;
27
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare const wait: (delay: number) => Promise<void>;
2
+ export declare const isValidJson: (str: string) => boolean;
3
+ /**
4
+ * Normalizes a user supplied ntfy server address into a base URL without a
5
+ * trailing slash. Assumes https when no protocol is given and keeps any base
6
+ * path, so servers behind a reverse proxy (e.g. https://home.example.com/ntfy)
7
+ * keep working. Returns undefined when the address cannot be parsed.
8
+ */
9
+ export declare const normalizeServerUrl: (url?: string) => string | undefined;
package/dist/utils.js ADDED
@@ -0,0 +1,37 @@
1
+ export const wait = (delay) => new Promise((resolve) => {
2
+ setTimeout(resolve, delay);
3
+ });
4
+ export const isValidJson = (str) => {
5
+ try {
6
+ JSON.parse(str);
7
+ return true;
8
+ }
9
+ catch (e) {
10
+ return false;
11
+ }
12
+ };
13
+ /**
14
+ * Normalizes a user supplied ntfy server address into a base URL without a
15
+ * trailing slash. Assumes https when no protocol is given and keeps any base
16
+ * path, so servers behind a reverse proxy (e.g. https://home.example.com/ntfy)
17
+ * keep working. Returns undefined when the address cannot be parsed.
18
+ */
19
+ export const normalizeServerUrl = (url) => {
20
+ const trimmed = url?.trim();
21
+ if (!trimmed) {
22
+ return undefined;
23
+ }
24
+ const withProtocol = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
25
+ let parsed;
26
+ try {
27
+ parsed = new URL(withProtocol);
28
+ }
29
+ catch (e) {
30
+ return undefined;
31
+ }
32
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
33
+ return undefined;
34
+ }
35
+ return `${parsed.origin}${parsed.pathname.replace(/\/+$/, '')}`;
36
+ };
37
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAa,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IAC5E,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;IACzC,IAAI,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAY,EAAsB,EAAE;IACrE,MAAM,OAAO,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC;IAE/F,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAChE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;AAClE,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@eribbey/homebridge-ntfy",
3
+ "displayName": "Homebridge Ntfy",
4
+ "type": "module",
5
+ "version": "1.1.0",
6
+ "description": "Homebridge plugin to send notifications through ntfy from HomeKit, with support for custom self-hosted servers and authentication",
7
+ "author": "Evan Ribbey",
8
+ "contributors": [
9
+ "Emil Löfblom (https://github.com/emilof)"
10
+ ],
11
+ "license": "Apache-2.0",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "homepage": "https://git.ribbey.net/evan/homebridge-ntfy#readme",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://git.ribbey.net/evan/homebridge-ntfy.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://git.ribbey.net/evan/homebridge-ntfy/issues"
22
+ },
23
+ "keywords": [
24
+ "homebridge",
25
+ "homebridge-plugin",
26
+ "ntfy",
27
+ "ntfy-sh",
28
+ "notifications",
29
+ "self-hosted"
30
+ ],
31
+ "main": "dist/index.js",
32
+ "engines": {
33
+ "node": "^20.18.0 || ^22.10.0 || ^24.0.0",
34
+ "homebridge": "^1.8.0 || ^2.0.0-beta.0"
35
+ },
36
+ "scripts": {
37
+ "build": "rimraf ./dist && tsc",
38
+ "lint": "eslint . --max-warnings=0",
39
+ "prepublishOnly": "npm run lint && npm run build",
40
+ "watch": "npm run build && npm link && nodemon"
41
+ },
42
+ "devDependencies": {
43
+ "@eslint/js": "^9.39.1",
44
+ "@types/node": "^24.10.2",
45
+ "eslint": "^9.39.1",
46
+ "homebridge": "^2.0.0-beta.55",
47
+ "nodemon": "^3.1.11",
48
+ "rimraf": "^6.1.2",
49
+ "ts-node": "^10.9.2",
50
+ "typescript": "^5.9.3",
51
+ "typescript-eslint": "^8.49.0"
52
+ },
53
+ "dependencies": {
54
+ "axios": "^1.13.2",
55
+ "homebridge-lib": "^7.2.0"
56
+ }
57
+ }