@eribbey/homebridge-ntfy 1.2.0 → 1.2.2
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/README.md +1 -2
- package/config.schema.json +2 -1
- package/dist/ntfy-client.d.ts +23 -1
- package/dist/ntfy-client.js +48 -8
- package/dist/ntfy-client.js.map +1 -1
- package/dist/platform.d.ts +2 -0
- package/dist/platform.js +31 -1
- package/dist/platform.js.map +1 -1
- package/dist/switch-accessory.d.ts +2 -0
- package/dist/switch-accessory.js +15 -5
- package/dist/switch-accessory.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@eribbey/homebridge-ntfy)
|
|
4
4
|
[](https://www.npmjs.com/package/@eribbey/homebridge-ntfy)
|
|
5
|
-
[](https://git.ribbey.net/evan/homebridge-ntfy/actions)
|
|
6
5
|
|
|
7
6
|
> Maintained fork of [emilof/homebridge-ntfy](https://github.com/emilof/homebridge-ntfy), published as
|
|
8
7
|
> [`@eribbey/homebridge-ntfy`](https://www.npmjs.com/package/@eribbey/homebridge-ntfy). Adds support for custom
|
|
@@ -87,7 +86,7 @@ An alternative is to edit the Homebridge JSON config file manually by adding the
|
|
|
87
86
|
| └ `priority` | `string` \| `number` | No | Priority of the message, either a name (`max`, `high`, `default`, `low`, `min`) or ntfy's numeric equivalent (`5`-`1`). Default: **default**. [[More info](https://docs.ntfy.sh/publish/#message-priority)] |
|
|
88
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)] |
|
|
89
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)] |
|
|
90
|
-
| └ `cooldownTime` | `number` | No | Minimum time before this message can be sent again. Default: no cooldown. |
|
|
89
|
+
| └ `cooldownTime` | `number` | No | Minimum time, in milliseconds, before this message can be sent again. Default: no cooldown. |
|
|
91
90
|
|
|
92
91
|
### Example config
|
|
93
92
|
|
package/config.schema.json
CHANGED
|
@@ -85,9 +85,10 @@
|
|
|
85
85
|
},
|
|
86
86
|
"topic": {
|
|
87
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.",
|
|
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. Letters, numbers, '-' and '_' only, up to 64 characters.",
|
|
89
89
|
"placeholder": "my-topic-2fd8cffa",
|
|
90
90
|
"type": "string",
|
|
91
|
+
"pattern": "^[-_A-Za-z0-9]{1,64}$",
|
|
91
92
|
"condition": {
|
|
92
93
|
"functionBody": "return !model.messages[arrayIndices].useJson;"
|
|
93
94
|
}
|
package/dist/ntfy-client.d.ts
CHANGED
|
@@ -7,11 +7,26 @@ export interface MessageRequest {
|
|
|
7
7
|
tags?: string;
|
|
8
8
|
priority?: string | number;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* How long to wait for the ntfy server before giving up. Without a limit a
|
|
12
|
+
* server that accepts the connection but never answers leaves the request
|
|
13
|
+
* pending forever.
|
|
14
|
+
*/
|
|
15
|
+
export declare const REQUEST_TIMEOUT_MS = 10000;
|
|
16
|
+
/**
|
|
17
|
+
* Node only allows latin-1 in header values: anything beyond it (emoji, most
|
|
18
|
+
* scripts) makes the request throw, and latin-1 accents arrive at ntfy as
|
|
19
|
+
* invalid UTF-8. ntfy decodes RFC 2047 encoded words on every header, so
|
|
20
|
+
* non-ASCII values are sent as a base64 UTF-8 encoded word. Line breaks are
|
|
21
|
+
* folded to spaces, matching what ntfy does with them anyway.
|
|
22
|
+
*/
|
|
23
|
+
export declare const encodeHeaderValue: (value: string) => string;
|
|
10
24
|
export declare class NtfyClient {
|
|
11
25
|
private readonly log;
|
|
12
26
|
private readonly serverAddress;
|
|
27
|
+
private readonly timeoutMs;
|
|
13
28
|
private readonly authHeader?;
|
|
14
|
-
constructor(log: Logging, serverAddress: string, auth?: NtfyAuth);
|
|
29
|
+
constructor(log: Logging, serverAddress: string, auth?: NtfyAuth, timeoutMs?: number);
|
|
15
30
|
/**
|
|
16
31
|
* Publishes a message. Resolves to true when the server accepted it, and to
|
|
17
32
|
* false when it did not - failures are logged here rather than thrown, so
|
|
@@ -20,6 +35,13 @@ export declare class NtfyClient {
|
|
|
20
35
|
sendMessage(request: MessageRequest | string): Promise<boolean>;
|
|
21
36
|
private sendMessageRequest;
|
|
22
37
|
private sendMessageJson;
|
|
38
|
+
/**
|
|
39
|
+
* Redirects are never followed: on a 301/302 the POST is replayed as a GET
|
|
40
|
+
* without its body, which ntfy answers with 200, so the message would be
|
|
41
|
+
* dropped while reporting success. Failing loudly lets the user point the
|
|
42
|
+
* server URL at where it redirects to (typically http:// -> https://).
|
|
43
|
+
*/
|
|
44
|
+
private requestConfig;
|
|
23
45
|
private baseHeaders;
|
|
24
46
|
private buildAuthHeader;
|
|
25
47
|
private logRequestError;
|
package/dist/ntfy-client.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* How long to wait for the ntfy server before giving up. Without a limit a
|
|
4
|
+
* server that accepts the connection but never answers leaves the request
|
|
5
|
+
* pending forever.
|
|
6
|
+
*/
|
|
7
|
+
export const REQUEST_TIMEOUT_MS = 10_000;
|
|
8
|
+
/**
|
|
9
|
+
* Node only allows latin-1 in header values: anything beyond it (emoji, most
|
|
10
|
+
* scripts) makes the request throw, and latin-1 accents arrive at ntfy as
|
|
11
|
+
* invalid UTF-8. ntfy decodes RFC 2047 encoded words on every header, so
|
|
12
|
+
* non-ASCII values are sent as a base64 UTF-8 encoded word. Line breaks are
|
|
13
|
+
* folded to spaces, matching what ntfy does with them anyway.
|
|
14
|
+
*/
|
|
15
|
+
export const encodeHeaderValue = (value) => {
|
|
16
|
+
const singleLine = value.replace(/[\r\n]+/g, ' ');
|
|
17
|
+
if (/^[\x20-\x7e]*$/.test(singleLine)) {
|
|
18
|
+
return singleLine;
|
|
19
|
+
}
|
|
20
|
+
return `=?UTF-8?B?${Buffer.from(singleLine, 'utf8').toString('base64')}?=`;
|
|
21
|
+
};
|
|
2
22
|
export class NtfyClient {
|
|
3
23
|
log;
|
|
4
24
|
serverAddress;
|
|
25
|
+
timeoutMs;
|
|
5
26
|
authHeader;
|
|
6
|
-
constructor(log, serverAddress, auth) {
|
|
27
|
+
constructor(log, serverAddress, auth, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
7
28
|
this.log = log;
|
|
8
29
|
this.serverAddress = serverAddress;
|
|
30
|
+
this.timeoutMs = timeoutMs;
|
|
9
31
|
this.authHeader = this.buildAuthHeader(auth);
|
|
10
32
|
}
|
|
11
33
|
/**
|
|
@@ -25,20 +47,21 @@ export class NtfyClient {
|
|
|
25
47
|
}
|
|
26
48
|
async sendMessageRequest(request) {
|
|
27
49
|
this.log.debug('Sending ntfy request:', request);
|
|
28
|
-
|
|
50
|
+
// Encoded so a stray '?', '#' or '/' cannot truncate or redirect the path
|
|
51
|
+
const url = `${this.serverAddress}/${encodeURIComponent(request.topic)}`;
|
|
29
52
|
const body = request.message;
|
|
30
53
|
const headers = this.baseHeaders();
|
|
31
54
|
if (request.title) {
|
|
32
|
-
headers.Title = request.title;
|
|
55
|
+
headers.Title = encodeHeaderValue(request.title);
|
|
33
56
|
}
|
|
34
57
|
if (request.priority !== undefined && request.priority !== '') {
|
|
35
|
-
headers.Priority = request.priority.toString();
|
|
58
|
+
headers.Priority = encodeHeaderValue(request.priority.toString());
|
|
36
59
|
}
|
|
37
60
|
if (request.tags) {
|
|
38
|
-
headers.Tags = request.tags;
|
|
61
|
+
headers.Tags = encodeHeaderValue(request.tags);
|
|
39
62
|
}
|
|
40
63
|
try {
|
|
41
|
-
const response = await axios.post(url, body,
|
|
64
|
+
const response = await axios.post(url, body, this.requestConfig(headers));
|
|
42
65
|
this.log.debug('Success! Result:', response.data);
|
|
43
66
|
return true;
|
|
44
67
|
}
|
|
@@ -50,7 +73,10 @@ export class NtfyClient {
|
|
|
50
73
|
async sendMessageJson(json) {
|
|
51
74
|
this.log.debug('Sending ntfy JSON request:', json);
|
|
52
75
|
try {
|
|
53
|
-
|
|
76
|
+
// ntfy takes JSON publishes at its root path. The trailing slash keeps a
|
|
77
|
+
// base path like https://host/ntfy pointing at /ntfy/ - without it a
|
|
78
|
+
// reverse proxy may redirect, and redirected POSTs turn into GETs.
|
|
79
|
+
const response = await axios.post(`${this.serverAddress}/`, json, this.requestConfig(this.baseHeaders()));
|
|
54
80
|
this.log.debug('Success! Result:', response.data);
|
|
55
81
|
return true;
|
|
56
82
|
}
|
|
@@ -59,6 +85,15 @@ export class NtfyClient {
|
|
|
59
85
|
return false;
|
|
60
86
|
}
|
|
61
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Redirects are never followed: on a 301/302 the POST is replayed as a GET
|
|
90
|
+
* without its body, which ntfy answers with 200, so the message would be
|
|
91
|
+
* dropped while reporting success. Failing loudly lets the user point the
|
|
92
|
+
* server URL at where it redirects to (typically http:// -> https://).
|
|
93
|
+
*/
|
|
94
|
+
requestConfig(headers) {
|
|
95
|
+
return { headers, timeout: this.timeoutMs, maxRedirects: 0 };
|
|
96
|
+
}
|
|
62
97
|
baseHeaders() {
|
|
63
98
|
return this.authHeader ? { Authorization: this.authHeader } : {};
|
|
64
99
|
}
|
|
@@ -74,8 +109,13 @@ export class NtfyClient {
|
|
|
74
109
|
}
|
|
75
110
|
logRequestError(error) {
|
|
76
111
|
if (axios.isAxiosError(error) && error.response) {
|
|
77
|
-
const { status, data } = error.response;
|
|
112
|
+
const { status, data, headers } = error.response;
|
|
78
113
|
const details = typeof data === 'string' ? data : JSON.stringify(data);
|
|
114
|
+
if (status >= 300 && status < 400) {
|
|
115
|
+
this.log.error(`ntfy request failed: ${status} - the server sent a redirect to ${headers?.location ?? 'another address'}. `
|
|
116
|
+
+ 'Following it would drop the message, so set the server URL to the address it redirects to.');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
79
119
|
if (status === 401 || status === 403) {
|
|
80
120
|
this.log.error(`ntfy request failed: ${status} - the server rejected the credentials. `
|
|
81
121
|
+ 'Check the authentication settings and that the token or user is allowed to publish to this topic.', details);
|
package/dist/ntfy-client.js.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"ntfy-client.js","sourceRoot":"","sources":["../src/ntfy-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE;IACzD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,aAAa,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC7E,CAAC,CAAC;AAEF,MAAM,OAAO,UAAU;IAIF;IACA;IAEA;IANF,UAAU,CAAU;IAErC,YACmB,GAAY,EACZ,aAAqB,EACtC,IAAe,EACE,YAAY,kBAAkB;QAH9B,QAAG,GA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AI,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,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,OAAQ,GAA0B,CAAC,KAAK,KAAK,QAAQ,CAAC;IAC1G,CAAC;CACF"}
|
package/dist/platform.d.ts
CHANGED
package/dist/platform.js
CHANGED
|
@@ -2,6 +2,9 @@ import { SwitchAccessory } from './switch-accessory.js';
|
|
|
2
2
|
import { DEFAULT_SERVER_URL, PLATFORM_NAME, PLUGIN_NAME } from './const.js';
|
|
3
3
|
import { NtfyClient } from './ntfy-client.js';
|
|
4
4
|
import { isValidJson, normalizeServerUrl } from './utils.js';
|
|
5
|
+
/** ntfy's own rule for topic names: https://docs.ntfy.sh/publish/#picking-a-topic */
|
|
6
|
+
const TOPIC_PATTERN = /^[-_A-Za-z0-9]{1,64}$/;
|
|
7
|
+
const TOPIC_RULE = '\'topic\' may only contain letters, numbers, \'-\' and \'_\' (max 64):';
|
|
5
8
|
export class NtfyPlatform {
|
|
6
9
|
log;
|
|
7
10
|
config;
|
|
@@ -30,7 +33,12 @@ export class NtfyPlatform {
|
|
|
30
33
|
const config = this.config;
|
|
31
34
|
const serverUrl = this.resolveServerUrl(config);
|
|
32
35
|
this.log.info('Using ntfy server:', serverUrl);
|
|
33
|
-
const
|
|
36
|
+
const auth = this.resolveAuth(config);
|
|
37
|
+
if (auth && serverUrl.startsWith('http://')) {
|
|
38
|
+
this.log.warn('Credentials are configured for a plain http:// server, so they are sent unencrypted with every message. '
|
|
39
|
+
+ 'Use https:// unless the server is only reachable on a trusted network.');
|
|
40
|
+
}
|
|
41
|
+
const ntfyClient = new NtfyClient(this.log, serverUrl, auth);
|
|
34
42
|
const configuredNames = new Set();
|
|
35
43
|
if (config.messages) {
|
|
36
44
|
for (const message of config.messages) {
|
|
@@ -102,11 +110,24 @@ export class NtfyPlatform {
|
|
|
102
110
|
else if (!isValidJson(message.json)) {
|
|
103
111
|
error = 'Invalid JSON message config - \'json\' is malformed:';
|
|
104
112
|
}
|
|
113
|
+
else {
|
|
114
|
+
// ntfy only accepts a JSON publish that is an object naming its topic
|
|
115
|
+
const topic = this.jsonTopic(message.json);
|
|
116
|
+
if (topic === undefined) {
|
|
117
|
+
error = 'Invalid JSON message config - \'json\' must be a JSON object with a \'topic\' string:';
|
|
118
|
+
}
|
|
119
|
+
else if (!TOPIC_PATTERN.test(topic)) {
|
|
120
|
+
error = `Invalid JSON message config - ${TOPIC_RULE}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
105
123
|
}
|
|
106
124
|
else {
|
|
107
125
|
if (!message.topic) {
|
|
108
126
|
error = 'Invalid message config - \'topic\' is missing:';
|
|
109
127
|
}
|
|
128
|
+
else if (!TOPIC_PATTERN.test(message.topic)) {
|
|
129
|
+
error = `Invalid message config - ${TOPIC_RULE}`;
|
|
130
|
+
}
|
|
110
131
|
}
|
|
111
132
|
if (error) {
|
|
112
133
|
this.log.error(error, message.name);
|
|
@@ -114,5 +135,14 @@ export class NtfyPlatform {
|
|
|
114
135
|
}
|
|
115
136
|
return true;
|
|
116
137
|
}
|
|
138
|
+
/** The topic of an already-parseable JSON payload, or undefined when it has none. */
|
|
139
|
+
jsonTopic(json) {
|
|
140
|
+
const payload = JSON.parse(json);
|
|
141
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const { topic } = payload;
|
|
145
|
+
return typeof topic === 'string' ? topic : undefined;
|
|
146
|
+
}
|
|
117
147
|
}
|
|
118
148
|
//# sourceMappingURL=platform.js.map
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,OAAO,YAAY;IAQZ;IACA;IACA;IATF,OAAO,CAAiB;IACxB,cAAc,CAAwB;IAE9B,WAAW,GAAmC,IAAI,GAAG,EAAE,CAAC;IACxD,oBAAoB,GAAa,EAAE,CAAC;IAErD,YACW,GAAY,EACZ,MAAsB,EACtB,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAS;QACZ,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QAEjB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAE7C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YACrC,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,SAA4B;QAC7C,I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CAAC;YACnD,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;IAED,qFAAqF;IAC7E,SAAS,CAAC,IAAY;QAC5B,MAAM,OAAO,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9E,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,OAA8B,CAAC;QACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -12,6 +12,8 @@ export declare class SwitchAccessory {
|
|
|
12
12
|
private onCharacteristic;
|
|
13
13
|
private isOn;
|
|
14
14
|
private inCooldown;
|
|
15
|
+
/** The send started by the most recent trigger, exposed for tests. */
|
|
16
|
+
pendingSend: Promise<void>;
|
|
15
17
|
constructor(platform: NtfyPlatform, accessory: PlatformAccessory, ntfyClient: NtfyClient, message: Message);
|
|
16
18
|
private setOn;
|
|
17
19
|
private getOn;
|
package/dist/switch-accessory.js
CHANGED
|
@@ -9,6 +9,8 @@ export class SwitchAccessory {
|
|
|
9
9
|
onCharacteristic;
|
|
10
10
|
isOn = false;
|
|
11
11
|
inCooldown = false;
|
|
12
|
+
/** The send started by the most recent trigger, exposed for tests. */
|
|
13
|
+
pendingSend = Promise.resolve();
|
|
12
14
|
constructor(platform, accessory, ntfyClient, message) {
|
|
13
15
|
this.platform = platform;
|
|
14
16
|
this.accessory = accessory;
|
|
@@ -35,17 +37,25 @@ export class SwitchAccessory {
|
|
|
35
37
|
this.log.debug('setOn:', value);
|
|
36
38
|
this.isOn = value;
|
|
37
39
|
this.onCharacteristic.updateValue(this.isOn);
|
|
40
|
+
// Only turning the switch on triggers anything; switching it off (by hand,
|
|
41
|
+
// or by an automation) is not a suppressed trigger even during cooldown
|
|
42
|
+
if (!this.isOn) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
38
45
|
if (this.inCooldown) {
|
|
39
46
|
this.log.info('Still in cooldown:', this.message.name);
|
|
40
47
|
await wait(250);
|
|
41
48
|
this.resetSwitch();
|
|
42
49
|
return;
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
void this.triggerCooldown(this.message.cooldownTime);
|
|
52
|
+
// Not awaited: HomeKit expects onSet to return promptly, and a slow or
|
|
53
|
+
// unreachable ntfy server would otherwise leave the switch unresponsive
|
|
54
|
+
// and trip Homebridge's slow-plugin warnings. The switch stays on while
|
|
55
|
+
// the message is in flight, then resets.
|
|
56
|
+
this.pendingSend = this.sendMessage()
|
|
57
|
+
.catch((error) => this.log.error('Failed to send message:', this.message.name, error))
|
|
58
|
+
.finally(() => this.resetSwitch());
|
|
49
59
|
}
|
|
50
60
|
async getOn() {
|
|
51
61
|
return this.isOn;
|
|
@@ -1 +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;
|
|
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;IAYP;IACA;IACA;IACA;IAdX,GAAG,CAAU;IACb,OAAO,CAAU;IACjB,gBAAgB,CAAiB;IAEjC,IAAI,G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AI,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"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@eribbey/homebridge-ntfy",
|
|
3
3
|
"displayName": "Homebridge Ntfy",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.2",
|
|
6
6
|
"description": "Homebridge plugin to send notifications through ntfy from HomeKit, with support for custom self-hosted servers and authentication",
|
|
7
7
|
"author": "Evan Ribbey",
|
|
8
8
|
"contributors": [
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://github.com/evan-ribbey/homebridge-ntfy#readme",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://
|
|
18
|
+
"url": "git+https://github.com/evan-ribbey/homebridge-ntfy.git"
|
|
19
19
|
},
|
|
20
20
|
"bugs": {
|
|
21
|
-
"url": "https://
|
|
21
|
+
"url": "https://github.com/evan-ribbey/homebridge-ntfy/issues"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"homebridge",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"vitest": "^4.1.11"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"axios": "^1.
|
|
65
|
+
"axios": "^1.21.0"
|
|
66
66
|
}
|
|
67
67
|
}
|