homebridge-lametric-time-messenger 0.1.0-beta.4
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 +17 -0
- package/README.md +457 -0
- package/assets/plugin-icon.png +0 -0
- package/config.schema.json +381 -0
- package/dist/accessories/message-accessory.d.ts +7 -0
- package/dist/accessories/message-accessory.js +7 -0
- package/dist/accessories/message-accessory.js.map +1 -0
- package/dist/accessories/notification-switch.d.ts +13 -0
- package/dist/accessories/notification-switch.js +43 -0
- package/dist/accessories/notification-switch.js.map +1 -0
- package/dist/config/defaults.d.ts +28 -0
- package/dist/config/defaults.js +40 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/types.d.ts +69 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validation.d.ts +6 -0
- package/dist/config/validation.js +233 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lametric/client.d.ts +18 -0
- package/dist/lametric/client.js +121 -0
- package/dist/lametric/client.js.map +1 -0
- package/dist/lametric/errors.d.ts +17 -0
- package/dist/lametric/errors.js +35 -0
- package/dist/lametric/errors.js.map +1 -0
- package/dist/lametric/notification-builder.d.ts +8 -0
- package/dist/lametric/notification-builder.js +37 -0
- package/dist/lametric/notification-builder.js.map +1 -0
- package/dist/lametric/types.d.ts +26 -0
- package/dist/lametric/types.js +2 -0
- package/dist/lametric/types.js.map +1 -0
- package/dist/platform.d.ts +27 -0
- package/dist/platform.js +157 -0
- package/dist/platform.js.map +1 -0
- package/dist/services/queue.d.ts +32 -0
- package/dist/services/queue.js +96 -0
- package/dist/services/queue.js.map +1 -0
- package/dist/services/rate-limiter.d.ts +6 -0
- package/dist/services/rate-limiter.js +16 -0
- package/dist/services/rate-limiter.js.map +1 -0
- package/dist/services/template-engine.d.ts +9 -0
- package/dist/services/template-engine.js +13 -0
- package/dist/services/template-engine.js.map +1 -0
- package/dist/settings.d.ts +3 -0
- package/dist/settings.js +4 -0
- package/dist/settings.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +23 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/security.d.ts +6 -0
- package/dist/utils/security.js +31 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Thierry Lubrez
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
# homebridge-lametric-time-messenger
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## English
|
|
6
|
+
|
|
7
|
+
Dynamic Homebridge platform plugin for sending local notifications to one or more LaMetric TIME V2 clocks.
|
|
8
|
+
|
|
9
|
+
> Beta release: this plugin is versioned as `0.1.0-beta.4`. It has automated tests and compiles, but it should still be validated with real LaMetric TIME V2 hardware before being considered stable.
|
|
10
|
+
|
|
11
|
+
> Compatibility notice: this plugin targets LaMetric TIME V2 / 2022+ devices. The first-generation LaMetric TIME is not supported by this plugin because its local API key/authentication flow can differ and has not been validated reliably.
|
|
12
|
+
|
|
13
|
+
The plugin uses the LaMetric Device API v2 local endpoint:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
POST http://<device-host>:8080/api/v2/device/notifications
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
HTTPS on port `4343` can be configured, but the plugin does not disable TLS verification globally. If your device uses a self-signed local certificate and Node rejects it, prefer HTTP on a trusted local network for now.
|
|
20
|
+
|
|
21
|
+
### Compatibility
|
|
22
|
+
|
|
23
|
+
- Homebridge: `^1.6.0 || ^2.0.0`
|
|
24
|
+
- Node.js: `^22.12.0 || ^24.0.0`
|
|
25
|
+
- LaMetric: LaMetric TIME V2 / 2022+ devices only
|
|
26
|
+
- Plugin type: dynamic platform
|
|
27
|
+
- Module format: ESM
|
|
28
|
+
|
|
29
|
+
Homebridge 2 compatibility is based on the official dynamic platform model and avoids deprecated callback characteristics by using `onGet` and `onSet`.
|
|
30
|
+
|
|
31
|
+
### Installation
|
|
32
|
+
|
|
33
|
+
#### Homebridge UI
|
|
34
|
+
|
|
35
|
+
After the package is published to npm, install it from the Homebridge UI:
|
|
36
|
+
|
|
37
|
+
1. Open Homebridge UI.
|
|
38
|
+
2. Go to **Plugins**.
|
|
39
|
+
3. Search for `homebridge-lametric-time-messenger`.
|
|
40
|
+
4. Click **Install**.
|
|
41
|
+
5. Restart Homebridge.
|
|
42
|
+
|
|
43
|
+
#### npm
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install -g homebridge-lametric-time-messenger
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### Local development install
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm install
|
|
53
|
+
npm run build
|
|
54
|
+
npm link
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### LaMetric local API key
|
|
58
|
+
|
|
59
|
+
Enable or retrieve the local Device API key from your LaMetric developer/device settings. The plugin authenticates with HTTP Basic auth:
|
|
60
|
+
|
|
61
|
+
- user: `dev`
|
|
62
|
+
- password: your local LaMetric API key
|
|
63
|
+
|
|
64
|
+
The key is configured as a Homebridge UI password field and is never logged by the plugin.
|
|
65
|
+
|
|
66
|
+
### Homebridge UI configuration
|
|
67
|
+
|
|
68
|
+
The plugin ships a `config.schema.json`, so Homebridge UI can render the configuration form without a custom UI.
|
|
69
|
+
|
|
70
|
+
Sections:
|
|
71
|
+
|
|
72
|
+
- General settings: debug logging, queue size, duplicate behavior, global delay, optional test switch.
|
|
73
|
+
- LaMetric TIME V2 devices: internal ID, display name, host, protocol, port, API key, timeout, retries.
|
|
74
|
+
- Messages: internal ID, name, target devices, HomeKit switch exposure, auto-reset, cooldown, priority, icon type, cycles, frames, optional sound.
|
|
75
|
+
|
|
76
|
+
The schema can mask the API key with `format: password`. Per-device connection test buttons are not included in this version because the standard schema form does not provide a reliable server-side button flow by itself.
|
|
77
|
+
|
|
78
|
+
Detailed configuration documentation is available in the repository wiki.
|
|
79
|
+
|
|
80
|
+
### Example configuration
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"platform": "LaMetricTime",
|
|
85
|
+
"name": "LaMetric Time",
|
|
86
|
+
"debug": false,
|
|
87
|
+
"maxQueueSize": 50,
|
|
88
|
+
"duplicateStrategy": "drop",
|
|
89
|
+
"globalDelayMs": 250,
|
|
90
|
+
"testSwitch": true,
|
|
91
|
+
"devices": [
|
|
92
|
+
{
|
|
93
|
+
"id": "salon",
|
|
94
|
+
"name": "LaMetric Salon",
|
|
95
|
+
"host": "192.168.1.50",
|
|
96
|
+
"protocol": "http",
|
|
97
|
+
"port": 8080,
|
|
98
|
+
"apiKey": "SECRET",
|
|
99
|
+
"timeoutMs": 5000,
|
|
100
|
+
"retryCount": 2,
|
|
101
|
+
"retryBackoffMs": 500
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"messages": [
|
|
105
|
+
{
|
|
106
|
+
"id": "front-door-open",
|
|
107
|
+
"name": "Door open",
|
|
108
|
+
"deviceIds": ["salon"],
|
|
109
|
+
"exposeSwitch": true,
|
|
110
|
+
"autoResetMs": 1000,
|
|
111
|
+
"cooldownMs": 5000,
|
|
112
|
+
"priority": "info",
|
|
113
|
+
"iconType": "none",
|
|
114
|
+
"cycles": 1,
|
|
115
|
+
"frames": [
|
|
116
|
+
{
|
|
117
|
+
"order": 0,
|
|
118
|
+
"icon": "a1234",
|
|
119
|
+
"text": "Door {{name}} opened"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"sound": {
|
|
123
|
+
"enabled": true,
|
|
124
|
+
"category": "notifications",
|
|
125
|
+
"id": "positive1",
|
|
126
|
+
"repeat": 1
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Home app automation example
|
|
134
|
+
|
|
135
|
+
1. A HomeKit contact sensor detects that a front door opened.
|
|
136
|
+
2. An Apple Home automation turns on the virtual switch `Door open`.
|
|
137
|
+
3. Homebridge builds and queues the configured LaMetric notification.
|
|
138
|
+
4. The plugin sends the notification locally to the selected LaMetric.
|
|
139
|
+
5. The switch automatically returns to off after `autoResetMs`.
|
|
140
|
+
|
|
141
|
+
The plugin does not claim to observe every accessory managed by other Homebridge plugins directly. Use Apple Home automations or another supported trigger to turn on the virtual switch.
|
|
142
|
+
|
|
143
|
+
### Notifications
|
|
144
|
+
|
|
145
|
+
Each message contains one or more frames. Frames are sorted by `order` during configuration validation.
|
|
146
|
+
|
|
147
|
+
Supported template variables:
|
|
148
|
+
|
|
149
|
+
- `{{date}}`
|
|
150
|
+
- `{{time}}`
|
|
151
|
+
- `{{name}}`
|
|
152
|
+
- `{{value}}`
|
|
153
|
+
|
|
154
|
+
Missing values render as an empty string. Templates do not execute JavaScript and do not use `eval` or `Function`.
|
|
155
|
+
|
|
156
|
+
### Priorities, icons, and sounds
|
|
157
|
+
|
|
158
|
+
The LaMetric Device API documents notification priorities:
|
|
159
|
+
|
|
160
|
+
- `info`: normal queue priority.
|
|
161
|
+
- `warning`: higher priority than internal notifications.
|
|
162
|
+
- `critical`: interrupts other notifications and wakes the device from sleep/screensaver.
|
|
163
|
+
|
|
164
|
+
If the LaMetric returns `Only notifications with priority 'critical' are allowed in current mode`, edit the message in Homebridge UI and set its priority to `Critical`. This usually means the device is currently in a restrictive mode such as sleep, screen saver, or do-not-disturb. The global Homebridge test switch uses `critical` by default so it can still validate the connection in that state.
|
|
165
|
+
|
|
166
|
+
`iconType` supports `none`, `info`, and `alert`.
|
|
167
|
+
|
|
168
|
+
Frame icons can use LaMetric icon IDs such as:
|
|
169
|
+
|
|
170
|
+
- `i1234` for a static icon.
|
|
171
|
+
- `a1234` for an animated icon.
|
|
172
|
+
|
|
173
|
+
Sound categories supported by the API are `notifications` and `alarms`. The plugin omits the `sound` object entirely when sound is disabled.
|
|
174
|
+
|
|
175
|
+
### Queue and anti-spam
|
|
176
|
+
|
|
177
|
+
The plugin keeps in-memory queues per LaMetric device:
|
|
178
|
+
|
|
179
|
+
- processing is sequential per device;
|
|
180
|
+
- different devices can process independently;
|
|
181
|
+
- queue size is limited;
|
|
182
|
+
- cooldown is applied per message after a successful send only;
|
|
183
|
+
- duplicates can be enqueued, dropped, or replaced;
|
|
184
|
+
- failures are logged and the queue continues.
|
|
185
|
+
|
|
186
|
+
Queues are not persisted. API keys and notification payloads are not written to log files by the plugin.
|
|
187
|
+
|
|
188
|
+
### Troubleshooting
|
|
189
|
+
|
|
190
|
+
`401 Authentication refused`: verify the local API key and ensure there are no extra spaces.
|
|
191
|
+
|
|
192
|
+
`404 endpoint not found`: verify the host, port, protocol, and that the device supports Device API v2 notifications.
|
|
193
|
+
|
|
194
|
+
Timeout or unreachable device: verify that Homebridge can reach the LaMetric on the local network. HTTP usually uses port `8080`; HTTPS usually uses port `4343`.
|
|
195
|
+
|
|
196
|
+
`429 rate limit`: increase `globalDelayMs`, reduce automations that trigger the same message, or use cooldowns.
|
|
197
|
+
|
|
198
|
+
### Security
|
|
199
|
+
|
|
200
|
+
- No cloud service is used.
|
|
201
|
+
- No telemetry is included.
|
|
202
|
+
- The plugin accepts host, protocol, and port, not arbitrary URLs.
|
|
203
|
+
- Only `http` and `https` protocols are accepted.
|
|
204
|
+
- Header injection characters are rejected.
|
|
205
|
+
- Text and payload inputs are bounded.
|
|
206
|
+
- API keys and Authorization headers are never logged.
|
|
207
|
+
- TLS validation is not disabled globally.
|
|
208
|
+
|
|
209
|
+
### Development
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npm install
|
|
213
|
+
npm run lint
|
|
214
|
+
npm run build
|
|
215
|
+
npm test
|
|
216
|
+
npm run verify:pack
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Tests mock the LaMetric API and do not require a real device.
|
|
220
|
+
|
|
221
|
+
### Publishing
|
|
222
|
+
|
|
223
|
+
Before publishing:
|
|
224
|
+
|
|
225
|
+
1. Confirm repository, bugs, homepage, author, and license metadata.
|
|
226
|
+
2. Run `npm run lint`, `npm run build`, `npm test`, and `npm run verify:pack`.
|
|
227
|
+
3. Log in with `npm login`.
|
|
228
|
+
4. Publish the beta release with `npm publish --tag beta`.
|
|
229
|
+
|
|
230
|
+
For a scoped package, use `npm publish --access=public` the first time.
|
|
231
|
+
|
|
232
|
+
## Français
|
|
233
|
+
|
|
234
|
+
Plugin de plateforme dynamique Homebridge permettant d’envoyer des notifications locales vers une ou plusieurs horloges LaMetric TIME V2.
|
|
235
|
+
|
|
236
|
+
> Version bêta : ce plugin est actuellement en `0.1.0-beta.4`. Il compile et dispose de tests automatisés, mais il doit encore être validé avec du matériel LaMetric TIME V2 réel avant d’être considéré comme stable.
|
|
237
|
+
|
|
238
|
+
> Note de compatibilité : ce plugin cible uniquement les appareils LaMetric TIME V2 / 2022+. La première génération de LaMetric TIME n’est pas prise en charge, car son flux d’authentification / clé API locale peut différer et n’a pas pu être validé de façon fiable.
|
|
239
|
+
|
|
240
|
+
Le plugin utilise l’endpoint local LaMetric Device API v2 :
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
POST http://<adresse-appareil>:8080/api/v2/device/notifications
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
HTTPS sur le port `4343` peut être configuré, mais le plugin ne désactive pas globalement la vérification TLS. Si l’appareil utilise un certificat local autosigné et que Node.js le refuse, privilégiez HTTP sur un réseau local de confiance pour le moment.
|
|
247
|
+
|
|
248
|
+
### Compatibilité
|
|
249
|
+
|
|
250
|
+
- Homebridge : `^1.6.0 || ^2.0.0`
|
|
251
|
+
- Node.js : `^22.12.0 || ^24.0.0`
|
|
252
|
+
- LaMetric : appareils LaMetric TIME V2 / 2022+ uniquement
|
|
253
|
+
- Type de plugin : plateforme dynamique
|
|
254
|
+
- Format de module : ESM
|
|
255
|
+
|
|
256
|
+
La compatibilité Homebridge 2 repose sur le modèle officiel de plateforme dynamique et évite les caractéristiques à callbacks dépréciées en utilisant `onGet` et `onSet`.
|
|
257
|
+
|
|
258
|
+
### Installation
|
|
259
|
+
|
|
260
|
+
#### Homebridge UI
|
|
261
|
+
|
|
262
|
+
Une fois le paquet publié sur npm, installez-le depuis Homebridge UI :
|
|
263
|
+
|
|
264
|
+
1. Ouvrez Homebridge UI.
|
|
265
|
+
2. Allez dans **Plugins**.
|
|
266
|
+
3. Recherchez `homebridge-lametric-time-messenger`.
|
|
267
|
+
4. Cliquez sur **Install**.
|
|
268
|
+
5. Redémarrez Homebridge.
|
|
269
|
+
|
|
270
|
+
#### npm
|
|
271
|
+
|
|
272
|
+
```sh
|
|
273
|
+
npm install -g homebridge-lametric-time-messenger
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### Installation locale de développement
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
npm install
|
|
280
|
+
npm run build
|
|
281
|
+
npm link
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Clé API locale LaMetric
|
|
285
|
+
|
|
286
|
+
Activez ou récupérez la clé locale Device API depuis les réglages développeur/appareil LaMetric. Le plugin s’authentifie en HTTP Basic auth :
|
|
287
|
+
|
|
288
|
+
- utilisateur : `dev`
|
|
289
|
+
- mot de passe : votre clé API locale LaMetric
|
|
290
|
+
|
|
291
|
+
La clé est configurée dans Homebridge UI comme champ mot de passe et n’est jamais écrite dans les logs du plugin.
|
|
292
|
+
|
|
293
|
+
### Configuration Homebridge UI
|
|
294
|
+
|
|
295
|
+
Le plugin fournit un fichier `config.schema.json`, ce qui permet à Homebridge UI d’afficher le formulaire de configuration sans interface personnalisée.
|
|
296
|
+
|
|
297
|
+
Sections :
|
|
298
|
+
|
|
299
|
+
- Réglages généraux : logs de debug, taille de file, comportement des doublons, délai global, switch de test optionnel.
|
|
300
|
+
- Appareils LaMetric TIME V2 : identifiant interne, nom affiché, hôte, protocole, port, clé API, délai d’attente, tentatives.
|
|
301
|
+
- Messages : identifiant interne, nom, appareils cibles, exposition du switch HomeKit, réinitialisation automatique, cooldown, priorité, type d’icône, cycles, frames, son optionnel.
|
|
302
|
+
|
|
303
|
+
Le schéma masque la clé API avec `format: password`. Les boutons de test par appareil ne sont pas inclus dans cette version, car le formulaire standard Homebridge UI ne fournit pas de flux serveur fiable pour ce type de bouton.
|
|
304
|
+
|
|
305
|
+
La documentation détaillée des options de configuration est disponible dans le wiki du dépôt.
|
|
306
|
+
|
|
307
|
+
### Exemple de configuration
|
|
308
|
+
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"platform": "LaMetricTime",
|
|
312
|
+
"name": "LaMetric Time",
|
|
313
|
+
"debug": false,
|
|
314
|
+
"maxQueueSize": 50,
|
|
315
|
+
"duplicateStrategy": "drop",
|
|
316
|
+
"globalDelayMs": 250,
|
|
317
|
+
"testSwitch": true,
|
|
318
|
+
"devices": [
|
|
319
|
+
{
|
|
320
|
+
"id": "salon",
|
|
321
|
+
"name": "LaMetric Salon",
|
|
322
|
+
"host": "192.168.1.50",
|
|
323
|
+
"protocol": "http",
|
|
324
|
+
"port": 8080,
|
|
325
|
+
"apiKey": "SECRET",
|
|
326
|
+
"timeoutMs": 5000,
|
|
327
|
+
"retryCount": 2,
|
|
328
|
+
"retryBackoffMs": 500
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"messages": [
|
|
332
|
+
{
|
|
333
|
+
"id": "front-door-open",
|
|
334
|
+
"name": "Porte ouverte",
|
|
335
|
+
"deviceIds": ["salon"],
|
|
336
|
+
"exposeSwitch": true,
|
|
337
|
+
"autoResetMs": 1000,
|
|
338
|
+
"cooldownMs": 5000,
|
|
339
|
+
"priority": "info",
|
|
340
|
+
"iconType": "none",
|
|
341
|
+
"cycles": 1,
|
|
342
|
+
"frames": [
|
|
343
|
+
{
|
|
344
|
+
"order": 0,
|
|
345
|
+
"icon": "a1234",
|
|
346
|
+
"text": "Porte {{name}} ouverte"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"sound": {
|
|
350
|
+
"enabled": true,
|
|
351
|
+
"category": "notifications",
|
|
352
|
+
"id": "positive1",
|
|
353
|
+
"repeat": 1
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Exemple d’automatisation Apple Maison
|
|
361
|
+
|
|
362
|
+
1. Un capteur de contact HomeKit détecte l’ouverture d’une porte.
|
|
363
|
+
2. Une automatisation Apple Maison active le switch virtuel `Porte ouverte`.
|
|
364
|
+
3. Homebridge construit et met en file la notification LaMetric configurée.
|
|
365
|
+
4. Le plugin envoie la notification localement à la LaMetric sélectionnée.
|
|
366
|
+
5. Le switch revient automatiquement à Off après `autoResetMs`.
|
|
367
|
+
|
|
368
|
+
Le plugin ne prétend pas observer directement tous les accessoires gérés par d’autres plugins Homebridge. Utilisez des automatisations Apple Maison ou un autre déclencheur compatible pour activer le switch virtuel.
|
|
369
|
+
|
|
370
|
+
### Notifications
|
|
371
|
+
|
|
372
|
+
Chaque message contient une ou plusieurs frames. Les frames sont triées par `order` pendant la validation de configuration.
|
|
373
|
+
|
|
374
|
+
Variables de modèle prises en charge :
|
|
375
|
+
|
|
376
|
+
- `{{date}}`
|
|
377
|
+
- `{{time}}`
|
|
378
|
+
- `{{name}}`
|
|
379
|
+
- `{{value}}`
|
|
380
|
+
|
|
381
|
+
Les valeurs absentes sont remplacées par une chaîne vide. Les modèles n’exécutent pas de JavaScript et n’utilisent ni `eval` ni `Function`.
|
|
382
|
+
|
|
383
|
+
### Priorités, icônes et sons
|
|
384
|
+
|
|
385
|
+
La Device API LaMetric documente les priorités suivantes :
|
|
386
|
+
|
|
387
|
+
- `info` : priorité normale.
|
|
388
|
+
- `warning` : priorité plus élevée que les notifications internes.
|
|
389
|
+
- `critical` : interrompt les autres notifications et réveille l’appareil depuis le mode veille / écran de veille.
|
|
390
|
+
|
|
391
|
+
Si la LaMetric renvoie `Only notifications with priority 'critical' are allowed in current mode`, modifiez le message dans Homebridge UI et mettez sa priorité sur `Critical`. Cela signifie généralement que l’appareil est dans un mode restrictif comme veille, écran de veille ou ne pas déranger. Le switch de test global utilise `critical` par défaut afin de pouvoir valider la connexion dans cet état.
|
|
392
|
+
|
|
393
|
+
`iconType` prend en charge `none`, `info` et `alert`.
|
|
394
|
+
|
|
395
|
+
Les icônes de frame peuvent utiliser les identifiants LaMetric :
|
|
396
|
+
|
|
397
|
+
- `i1234` pour une icône statique.
|
|
398
|
+
- `a1234` pour une icône animée.
|
|
399
|
+
|
|
400
|
+
Les catégories de son prises en charge par l’API sont `notifications` et `alarms`. Le plugin omet entièrement l’objet `sound` lorsque le son est désactivé.
|
|
401
|
+
|
|
402
|
+
### File d’attente et anti-spam
|
|
403
|
+
|
|
404
|
+
Le plugin maintient des files en mémoire par appareil LaMetric :
|
|
405
|
+
|
|
406
|
+
- le traitement est séquentiel par appareil ;
|
|
407
|
+
- plusieurs appareils peuvent traiter leurs files indépendamment ;
|
|
408
|
+
- la taille de file est limitée ;
|
|
409
|
+
- le cooldown est appliqué par message uniquement après un envoi réussi ;
|
|
410
|
+
- les doublons peuvent être ajoutés, ignorés ou remplacés ;
|
|
411
|
+
- les erreurs sont journalisées et la file continue.
|
|
412
|
+
|
|
413
|
+
Les files ne sont pas persistées. Les clés API et les payloads de notification ne sont pas écrits dans les logs par le plugin.
|
|
414
|
+
|
|
415
|
+
### Dépannage
|
|
416
|
+
|
|
417
|
+
`401 Authentication refused` : vérifiez la clé API locale et assurez-vous qu’il n’y a pas d’espace copié en trop.
|
|
418
|
+
|
|
419
|
+
`404 endpoint not found` : vérifiez l’hôte, le port, le protocole et le support de l’endpoint Device API v2 par l’appareil.
|
|
420
|
+
|
|
421
|
+
Timeout ou appareil inaccessible : vérifiez que Homebridge peut joindre la LaMetric sur le réseau local. HTTP utilise généralement le port `8080`, HTTPS le port `4343`.
|
|
422
|
+
|
|
423
|
+
`429 rate limit` : augmentez `globalDelayMs`, réduisez les automatisations qui déclenchent le même message, ou utilisez les cooldowns.
|
|
424
|
+
|
|
425
|
+
### Sécurité
|
|
426
|
+
|
|
427
|
+
- Aucun service cloud n’est utilisé.
|
|
428
|
+
- Aucune télémétrie n’est incluse.
|
|
429
|
+
- Le plugin accepte un hôte, un protocole et un port, pas des URL arbitraires.
|
|
430
|
+
- Seuls les protocoles `http` et `https` sont acceptés.
|
|
431
|
+
- Les caractères d’injection d’en-têtes sont rejetés.
|
|
432
|
+
- Les textes et payloads sont bornés.
|
|
433
|
+
- Les clés API et en-têtes Authorization ne sont jamais journalisés.
|
|
434
|
+
- La validation TLS n’est pas désactivée globalement.
|
|
435
|
+
|
|
436
|
+
### Développement
|
|
437
|
+
|
|
438
|
+
```sh
|
|
439
|
+
npm install
|
|
440
|
+
npm run lint
|
|
441
|
+
npm run build
|
|
442
|
+
npm test
|
|
443
|
+
npm run verify:pack
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Les tests simulent l’API LaMetric et ne nécessitent pas d’appareil réel.
|
|
447
|
+
|
|
448
|
+
### Publication
|
|
449
|
+
|
|
450
|
+
Avant publication :
|
|
451
|
+
|
|
452
|
+
1. Vérifier les métadonnées repository, bugs, homepage, author et license.
|
|
453
|
+
2. Exécuter `npm run lint`, `npm run build`, `npm test` et `npm run verify:pack`.
|
|
454
|
+
3. Se connecter avec `npm login`.
|
|
455
|
+
4. Publier la version bêta avec `npm publish --tag beta`.
|
|
456
|
+
|
|
457
|
+
Pour un paquet scopé, utiliser `npm publish --access=public` lors de la première publication.
|
|
Binary file
|