homebridge-easy-mqtt 1.1.0-beta.0 → 1.2.0-beta.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +27 -11
  3. package/config.schema.json +187 -92
  4. package/dist/accessory/{base.d.ts → abstract/base.d.ts} +6 -6
  5. package/dist/accessory/{base.js → abstract/base.js} +5 -5
  6. package/dist/accessory/abstract/base.js.map +1 -0
  7. package/dist/accessory/{statusActive.d.ts → abstract/statusActive.d.ts} +4 -5
  8. package/dist/accessory/{statusActive.js → abstract/statusActive.js} +7 -9
  9. package/dist/accessory/abstract/statusActive.js.map +1 -0
  10. package/dist/accessory/lock.d.ts +5 -6
  11. package/dist/accessory/lock.js +17 -19
  12. package/dist/accessory/lock.js.map +1 -1
  13. package/dist/accessory/{lightbulb.d.ts → onoff/lightbulb.d.ts} +6 -7
  14. package/dist/accessory/{lightbulb.js → onoff/lightbulb.js} +16 -18
  15. package/dist/accessory/onoff/lightbulb.js.map +1 -0
  16. package/dist/accessory/onoff/onoff.d.ts +14 -0
  17. package/dist/accessory/{onoff.js → onoff/onoff.js} +12 -14
  18. package/dist/accessory/onoff/onoff.js.map +1 -0
  19. package/dist/accessory/{outlet.d.ts → onoff/outlet.d.ts} +6 -7
  20. package/dist/accessory/{outlet.js → onoff/outlet.js} +12 -14
  21. package/dist/accessory/onoff/outlet.js.map +1 -0
  22. package/dist/accessory/{switch.d.ts → onoff/switch.d.ts} +4 -4
  23. package/dist/accessory/{switch.js → onoff/switch.js} +2 -2
  24. package/dist/accessory/onoff/switch.js.map +1 -0
  25. package/dist/accessory/security.d.ts +27 -0
  26. package/dist/accessory/security.js +178 -0
  27. package/dist/accessory/security.js.map +1 -0
  28. package/dist/accessory/temperatureSensor.d.ts +5 -6
  29. package/dist/accessory/temperatureSensor.js +7 -9
  30. package/dist/accessory/temperatureSensor.js.map +1 -1
  31. package/dist/homebridge/platform.js +7 -3
  32. package/dist/homebridge/platform.js.map +1 -1
  33. package/dist/homebridge-ui/public/index.html +1 -1
  34. package/dist/i18n/en.d.ts +33 -1
  35. package/dist/i18n/en.js +33 -1
  36. package/dist/i18n/en.js.map +1 -1
  37. package/dist/i18n/i18n.d.ts +34 -3
  38. package/dist/i18n/i18n.js +0 -6
  39. package/dist/i18n/i18n.js.map +1 -1
  40. package/dist/i18n/template.d.ts +33 -1
  41. package/dist/model/mqtt.js +17 -10
  42. package/dist/model/mqtt.js.map +1 -1
  43. package/dist/model/types.d.ts +14 -0
  44. package/package.json +1 -1
  45. package/dist/accessory/base.js.map +0 -1
  46. package/dist/accessory/lightbulb.js.map +0 -1
  47. package/dist/accessory/onoff.d.ts +0 -15
  48. package/dist/accessory/onoff.js.map +0 -1
  49. package/dist/accessory/outlet.js.map +0 -1
  50. package/dist/accessory/statusActive.js.map +0 -1
  51. package/dist/accessory/switch.js.map +0 -1
  52. package/dist/i18n/zz.d.ts +0 -131
  53. package/dist/i18n/zz.js +0 -6
  54. package/dist/i18n/zz.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,12 +2,20 @@
2
2
 
3
3
  All notable changes to homebridge-dummy will be documented in this file.
4
4
 
5
- ## 1.1.0-beta.0 (2025-08-19)
5
+ ## 1.2.0-beta.0 (2025-08-26)
6
6
 
7
7
  ### HELP NEEDED! (no coding experience required)
8
8
 
9
9
  Would you like to see Homebridge Easy MQTT in your language? Please consider [getting involved](https://github.com/mpatfield/homebridge-easy-mqtt/issues/4).
10
10
 
11
+ ### Added
12
+ - Security System accessory type
13
+
14
+ ### Changed
15
+ - Updated dev dependencies
16
+
17
+ ## 1.1.0 (2025-08-20)
18
+
11
19
  ### Added
12
20
  - Temperature Sensor accessory type
13
21
 
package/README.md CHANGED
@@ -23,7 +23,7 @@ Any issues or damage resulting from use of this plugin are not the fault of the
23
23
 
24
24
  This plugin is designed to be a simple replacement for the fantastic [homebridge-mqttthing](https://github.com/arachnetech/homebridge-mqttthing) plugin which appears as though it's [no longer](https://github.com/arachnetech/homebridge-mqttthing/commits/master/) being actively developed.
25
25
 
26
- **HomebridgeEasyMQTT** currently supports `Lightbulb`, `LockMechanism`, `Outlet`, `Switch`, and `TemperatureSensor`, but will be expanded over time as more use cases are discovered. If there is an accessory type you'd like to see supported, please feel free to [create an issue in GitHub](https://github.com/mpatfield/homebridge-easy-mqtt/issues/new/choose).
26
+ **HomebridgeEasyMQTT** currently supports `Lightbulb`, `LockMechanism`, `Outlet`, `SecuitySystem`,`Switch`, and `TemperatureSensor`, but will be expanded over time as more use cases are discovered. If there is an accessory type you'd like to see supported, please feel free to [create an issue in GitHub](https://github.com/mpatfield/homebridge-easy-mqtt/issues/new/choose).
27
27
 
28
28
  ## Configuration
29
29
 
@@ -75,7 +75,7 @@ All fields are required unless noted as "(Optional)"
75
75
  Info:
76
76
  - `id` - A unique ID to identify this accessory. Changing this value will result in a new accessory.
77
77
  - `name` - The display name for the accessory in HomeKit
78
- - `type` - The type of accessory, currently Lightbulb, LockMechanism, Outlet, Switch, and Temperature Sensor are supported
78
+ - `type` - The type of accessory, currently Lightbulb, LockMechanism, Outlet, SecuitySystem, Switch, and Temperature Sensor are supported
79
79
  - `manufacturer` - (Optional) The accessory manufacturer which will display in HomeKit device details
80
80
  - `model` - (Optional) The accessory model which will display in HomeKit device details
81
81
  - `serialNumber` - (Optional) The accessory serial number which will display in HomeKit device details
@@ -117,13 +117,20 @@ You may define topics using a JSONPath dot notation to assist the parser in find
117
117
  - `topicGetOutletInUse` - (Optional) Whether or not the outlet is currently being used
118
118
  - `topicSetOutletInUse` - (Optional) For setting whether the outlet is currently being used
119
119
 
120
+ - SecuitySystem
121
+ - `topicGetCurrentSecurityState` — The current state of the system
122
+ - `topicGetTargetSecurityState` — The target state of the system
123
+ - `topicSetTargetSecurityState` — For setting the target state of the system
124
+ - `topicGetStatusTampered` — For getting whether the system has been tampered with
125
+ - `topicGetStatusFault` — For getting whether there is a system error
126
+
120
127
  - Switch
121
128
  - `topicGetOn` - The current state of the switch, i.e. on/off
122
129
  - `topicSetOn` - For setting the state of the switch
123
130
 
124
131
  - TemperatureSensor
125
132
  - `topicGetCurrentTemperature` - The current temperature of the sensor
126
- - `temperatureUnits` - (Optional) `C` for Celcius (default), `F` for Fahrenheit
133
+ - `temperatureUnits` - (Optional) The temperature units of the incoming value supplied by the sensor, `C` for Celsius (default) `F` for Fahrenheit
127
134
 
128
135
  Values:
129
136
 
@@ -133,8 +140,8 @@ As with Topics, you will need to populate the appropriate values based on the ty
133
140
  - `valueStatusActive` - Accessory is connected/reachable, e.g. "true", "1", or "Alive"
134
141
 
135
142
  - Lightbulb
136
- - `valueOn` - Turned on, e.g. "true", or "1", or "On"
137
- - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
143
+ - `valueOn` - Turned on, e.g. "true", or "1", or "On"
144
+ - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
138
145
 
139
146
  - LockMechanism
140
147
  - `valueLockStateSecured` - Locked state, e.g. "true", "255", or "Locked"
@@ -142,14 +149,23 @@ As with Topics, you will need to populate the appropriate values based on the ty
142
149
  - `valueLockStateJammed` - (Optional) Lock is jammed, e.g. "254" or "Jammed"
143
150
 
144
151
  - Outlet
145
- - `valueOn` - Turned on, e.g. "true", or "1", or "On"
146
- - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
147
- - `valueOutletInUse` - Currently being used, e.g. "true", or "1", or "On"
148
- - `valueOutletNotInUse` - Currently not being used, e.g. "false", or "0", or "Off"
152
+ - `valueOn` - Turned on, e.g. "true", or "1", or "On"
153
+ - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
154
+ - `valueOutletInUse` - Currently being used, e.g. "true", or "1", or "On"
155
+ - `valueOutletNotInUse` - Currently not being used, e.g. "false", or "0", or "Off"
156
+
157
+ - SecuritySystem
158
+ - `valueArmStay` — (Optional) system armed in stay mode, e.g. "SA" or "stay"
159
+ - `valueArmAway` — (Optional) system armed in away mode, e.g. "AA" or "away"
160
+ - `valueArmNight` — (Optional) system armed in night mode, e.g. "NA" or "night"
161
+ - `valueDisarm` — (Optional) system armed in away mode, e.g. "D" or "disarmed"
162
+ - `valueAlarmTriggered` — (Optional) when the alarm has been triggered, e.g. "true" or "1" or "triggered"
163
+ - `valueTampered` — (Optional) when the system has been tampered with, e.g. "true" or "1" or "tampered"
164
+ - `valueFault` — (Optional) when the system has a general fault, e.g. "true" or "1" or "fault"
149
165
 
150
166
  - Switch
151
- - `valueOn` - Turned on, e.g. "true", or "1", or "On"
152
- - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
167
+ - `valueOn` - Turned on, e.g. "true", or "1", or "On"
168
+ - `valueOff` - Turned off, e.g. "false", or "0", or "Off"
153
169
 
154
170
  Logging/Debugging:
155
171
 
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "name": {
17
17
  "type": "string",
18
- "title": "${config.title.name}" ,
18
+ "title": "${config.title.name}" ,
19
19
  "required": true
20
20
  },
21
21
  "type": {
22
22
  "type": "string",
23
23
  "title": "${config.title.type}",
24
- "enum": [ "Lightbulb", "LockMechanism", "Outlet", "Switch", "TemperatureSensor"],
25
- "enumNames": ["${config.enumNames.lightbulb}", "${config.enumNames.lockMechanism}", "${config.enumNames.outlet}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}"],
24
+ "enum": [ "Lightbulb", "LockMechanism", "Outlet", "SecuritySystem", "Switch", "TemperatureSensor"],
25
+ "enumNames": ["${config.enumNames.lightbulb}", "${config.enumNames.lockMechanism}", "${config.enumNames.outlet}", "${config.enumNames.securitySystem}", "${config.enumNames.switch}", "${config.enumNames.temperatureSensor}"],
26
26
  "required": true
27
27
  },
28
28
  "manufacturer": {
@@ -68,7 +68,7 @@
68
68
  }
69
69
  }
70
70
  }
71
- },
71
+ },
72
72
  "properties": {
73
73
  "name": {
74
74
  "type": "string",
@@ -83,7 +83,6 @@
83
83
  "mqtt": { "$ref": "#/definitions/mqtt" },
84
84
  "temperatureUnits": {
85
85
  "type": "string",
86
- "title": "${config.title.temperatureUnits}",
87
86
  "enum": ["C", "F"],
88
87
  "enumNames": ["${config.enumNames.celsius}", "${config.enumNames.fahrenheit}"]
89
88
  },
@@ -155,6 +154,26 @@
155
154
  "type": "string",
156
155
  "title": "${config.title.topicGetCurrentTemperature}"
157
156
  },
157
+ "topicGetCurrentSecurityState": {
158
+ "type": "string",
159
+ "title": "${config.title.topicGetCurrentSecurityState}"
160
+ },
161
+ "topicGetTargetSecurityState": {
162
+ "type": "string",
163
+ "title": "${config.title.topicGetTargetSecurityState}"
164
+ },
165
+ "topicSetTargetSecurityState": {
166
+ "type": "string",
167
+ "title": "${config.title.topicSetTargetSecurityState}"
168
+ },
169
+ "topicGetStatusTampered": {
170
+ "type": "string",
171
+ "title": "${config.title.topicGetStatusTampered}"
172
+ },
173
+ "topicGetStatusFault": {
174
+ "type": "string",
175
+ "title": "${config.title.topicGetStatusFault}"
176
+ },
158
177
  "valueStatusActive": {
159
178
  "type": "string",
160
179
  "title": "${config.title.valueStatusActive}",
@@ -188,6 +207,34 @@
188
207
  "type": "string",
189
208
  "title": "${config.title.valueOutletNotInUse}"
190
209
  },
210
+ "valueArmStay": {
211
+ "type": "string",
212
+ "title": "${config.title.valueArmStay}"
213
+ },
214
+ "valueArmAway": {
215
+ "type": "string",
216
+ "title": "${config.title.valueArmAway}"
217
+ },
218
+ "valueArmNight": {
219
+ "type": "string",
220
+ "title": "${config.title.valueArmNight}"
221
+ },
222
+ "valueDisarm": {
223
+ "type": "string",
224
+ "title": "${config.title.valueDisarm}"
225
+ },
226
+ "valueAlarmTriggered": {
227
+ "type": "string",
228
+ "title": "${config.title.valueAlarmTriggered}"
229
+ },
230
+ "valueTampered": {
231
+ "type": "string",
232
+ "title": "${config.title.valueTampered}"
233
+ },
234
+ "valueFault": {
235
+ "type": "string",
236
+ "title": "${config.title.valueFault}"
237
+ },
191
238
  "disableLogging": {
192
239
  "type": "boolean",
193
240
  "title": "${config.title.disableLogging}",
@@ -217,18 +264,11 @@
217
264
  "items": [
218
265
  {
219
266
  "key": "accessories[].info.name",
220
- "flex": "1 1 33%"
267
+ "flex": "1 1 0"
221
268
  },
222
269
  {
223
270
  "key": "accessories[].info.type",
224
- "flex": "1 1 33%"
225
- },
226
- {
227
- "key": "accessories[].temperatureUnits",
228
- "flex": "1 1 33%",
229
- "condition": {
230
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'TemperatureSensor';"
231
- }
271
+ "flex": "1 1 0"
232
272
  }
233
273
  ]
234
274
  },
@@ -296,102 +336,93 @@
296
336
  {
297
337
  "type": "fieldset",
298
338
  "title": "${config.title.topics}",
339
+ "condition": {
340
+ "functionBody": "return model.accessories?.[arguments[1]]?.info?.type !== undefined;"
341
+ },
299
342
  "items": [
300
343
  {
301
- "key": "accessories[].topicGetLockCurrentState",
302
- "condition": {
303
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'LockMechanism';"
304
- }
305
- },
306
- {
307
- "key": "accessories[].topicGetLockTargetState",
308
- "condition": {
309
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'LockMechanism';"
310
- }
311
- },
312
- {
313
- "key": "accessories[].topicSetTargetState",
344
+ "type": "fieldset",
345
+ "notitle": "true",
346
+ "items": [
347
+ "accessories[].topicGetLockCurrentState",
348
+ "accessories[].topicGetLockTargetState",
349
+ "accessories[].topicSetTargetState"
350
+ ],
314
351
  "condition": {
315
352
  "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'LockMechanism';"
316
353
  }
317
354
  },
318
355
  {
319
- "key": "accessories[].topicGetOn",
320
- "condition": {
321
- "functionBody": "return ['Lightbulb', 'Outlet', 'Switch'].includes(model.accessories?.[arguments[1]]?.info?.type);"
322
- }
323
- },
324
- {
325
- "key": "accessories[].topicSetOn",
356
+ "type": "fieldset",
357
+ "notitle": "true",
358
+ "items": [
359
+ "accessories[].topicGetOn",
360
+ "accessories[].topicSetOn"
361
+ ],
326
362
  "condition": {
327
363
  "functionBody": "return ['Lightbulb', 'Outlet', 'Switch'].includes(model.accessories?.[arguments[1]]?.info?.type);"
328
364
  }
329
365
  },
330
366
  {
331
- "key": "accessories[].topicGetBrightness",
332
- "condition": {
333
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
334
- }
335
- },
336
- {
337
- "key": "accessories[].topicSetBrightness",
338
- "condition": {
339
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
340
- }
341
- },
342
- {
343
- "key": "accessories[].topicGetHue",
344
- "condition": {
345
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
346
- }
347
- },
348
- {
349
- "key": "accessories[].topicSetHue",
350
- "condition": {
351
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
352
- }
353
- },
354
- {
355
- "key": "accessories[].topicGetColorTemperature",
356
- "condition": {
357
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
358
- }
359
- },
360
- {
361
- "key": "accessories[].topicSetColorTemperature",
362
- "condition": {
363
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
364
- }
365
- },
366
- {
367
- "key": "accessories[].topicGetSaturation",
368
- "condition": {
369
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
370
- }
371
- },
372
- {
373
- "key": "accessories[].topicSetSaturation",
367
+ "type": "fieldset",
368
+ "notitle": "true",
369
+ "items": [
370
+ "accessories[].topicGetBrightness",
371
+ "accessories[].topicSetBrightness",
372
+ "accessories[].topicGetHue",
373
+ "accessories[].topicSetHue",
374
+ "accessories[].topicGetColorTemperature",
375
+ "accessories[].topicSetColorTemperature",
376
+ "accessories[].topicGetSaturation",
377
+ "accessories[].topicSetSaturation"
378
+ ],
374
379
  "condition": {
375
380
  "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Lightbulb';"
376
381
  }
377
382
  },
378
383
  {
379
- "key": "accessories[].topicGetOutletInUse",
384
+ "type": "fieldset",
385
+ "notitle": "true",
386
+ "items": [
387
+ "accessories[].topicGetOutletInUse",
388
+ "accessories[].topicSetOutletInUse"
389
+ ],
380
390
  "condition": {
381
391
  "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Outlet';"
382
392
  }
383
393
  },
384
394
  {
385
- "key": "accessories[].topicSetOutletInUse",
395
+ "type": "fieldset",
396
+ "notitle": "true",
397
+ "items": [
398
+ "accessories[].topicGetCurrentSecurityState",
399
+ "accessories[].topicGetTargetSecurityState",
400
+ "accessories[].topicSetTargetSecurityState",
401
+ "accessories[].topicGetStatusTampered",
402
+ "accessories[].topicGetStatusFault"
403
+ ],
386
404
  "condition": {
387
- "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'Outlet';"
405
+ "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'SecuritySystem';"
388
406
  }
389
407
  },
390
408
  {
391
- "key": "accessories[].topicGetCurrentTemperature",
409
+ "type": "div",
410
+ "displayFlex": true,
411
+ "flex-direction": "row",
392
412
  "condition": {
393
413
  "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'TemperatureSensor';"
394
- }
414
+ },
415
+ "items": [
416
+ {
417
+ "key": "accessories[].topicGetCurrentTemperature",
418
+ "flex": "1 1 67%"
419
+ },
420
+ {
421
+ "key": "accessories[].temperatureUnits",
422
+ "title": "${config.title.sourceUnits}",
423
+ "flex": "1 1 33%"
424
+ }
425
+ ]
395
426
  },
396
427
  "accessories[].topicGetStatusActive"
397
428
  ]
@@ -399,6 +430,9 @@
399
430
  {
400
431
  "type": "fieldset",
401
432
  "title": "${config.title.values}",
433
+ "condition": {
434
+ "functionBody": "return model.accessories?.[arguments[1]]?.info?.type !== undefined;"
435
+ },
402
436
  "items": [
403
437
  {
404
438
  "type": "div",
@@ -410,16 +444,16 @@
410
444
  "items": [
411
445
  {
412
446
  "key": "accessories[].valueLockStateSecured",
413
- "flex": "1 1 0"
447
+ "flex": "0 0 25%"
414
448
  },
415
449
  {
416
450
  "key": "accessories[].valueLockStateUnsecured",
417
- "flex": "1 1 0"
451
+ "flex": "0 0 25%"
418
452
  },
419
453
  {
420
454
  "key": "accessories[].valueLockStateJammed",
421
- "flex": "1 1 0"
422
- }
455
+ "flex": "0 0 25%"
456
+ }
423
457
  ]
424
458
  },
425
459
  {
@@ -432,11 +466,11 @@
432
466
  "items": [
433
467
  {
434
468
  "key": "accessories[].valueOn",
435
- "flex": "1 1 0"
469
+ "flex": "0 0 25%"
436
470
  },
437
471
  {
438
472
  "key": "accessories[].valueOff",
439
- "flex": "1 1 0"
473
+ "flex": "0 0 25%"
440
474
  }
441
475
  ]
442
476
  },
@@ -450,17 +484,78 @@
450
484
  "items": [
451
485
  {
452
486
  "key": "accessories[].valueOutletInUse",
453
- "flex": "1 1 0"
487
+ "flex": "0 0 25%"
454
488
  },
455
489
  {
456
490
  "key": "accessories[].valueOutletNotInUse",
457
- "flex": "1 1 0"
491
+ "flex": "0 0 25%"
458
492
  }
459
493
  ]
460
494
  },
461
- "accessories[].valueStatusActive"
495
+ {
496
+ "type": "fieldset",
497
+ "notitle": true,
498
+ "condition": {
499
+ "functionBody": "return model.accessories?.[arguments[1]]?.info?.type === 'SecuritySystem';"
500
+ },
501
+ "items": [
502
+ {
503
+ "type": "div",
504
+ "displayFlex": true,
505
+ "flex-direction": "row",
506
+ "items": [
507
+ {
508
+ "key": "accessories[].valueArmStay",
509
+ "flex": "0 0 25%"
510
+ },
511
+ {
512
+ "key": "accessories[].valueArmAway",
513
+ "flex": "0 0 25%"
514
+ },
515
+ {
516
+ "key": "accessories[].valueArmNight",
517
+ "flex": "0 0 25%"
518
+ },
519
+ {
520
+ "key": "accessories[].valueDisarm",
521
+ "flex": "0 0 25%"
522
+ }
523
+ ]
524
+ },
525
+ {
526
+ "type": "div",
527
+ "displayFlex": true,
528
+ "flex-direction": "row",
529
+ "items": [
530
+ {
531
+ "key": "accessories[].valueAlarmTriggered",
532
+ "flex": "0 0 25%"
533
+ },
534
+ {
535
+ "key": "accessories[].valueTampered",
536
+ "flex": "0 0 25%"
537
+ },
538
+ {
539
+ "key": "accessories[].valueFault",
540
+ "flex": "0 0 25%"
541
+ }
542
+ ]
543
+ }
544
+ ]
545
+ },
546
+ {
547
+ "type": "div",
548
+ "displayFlex": true,
549
+ "flex-direction": "row",
550
+ "items": [
551
+ {
552
+ "key": "accessories[].valueStatusActive",
553
+ "flex": "0 0 50%"
554
+ }
555
+ ]
556
+ }
462
557
  ]
463
- }
558
+ }
464
559
  ]
465
560
  }
466
561
  ]
@@ -1,20 +1,20 @@
1
1
  import { PlatformAccessory } from 'homebridge';
2
- import { AccessoryConfig, CharacteristicType, ServiceType } from '../model/types.js';
3
- import { Log } from '../tools/log.js';
4
- import { Primitive } from '../tools/primitive.js';
2
+ import { AccessoryConfig, CharacteristicType, ServiceType } from '../../model/types.js';
3
+ import { Log } from '../../tools/log.js';
4
+ import { Primitive } from '../../tools/primitive.js';
5
5
  export type TopicHandler = {
6
6
  topic: string;
7
7
  handler: ((topic: string, value: Primitive) => Promise<void>);
8
8
  };
9
9
  export declare function makeHandler(topic: string, handler: (topic: string, value: Primitive) => Promise<void>): TopicHandler;
10
- export declare abstract class MQTTAccessory {
10
+ export declare abstract class MQTTAccessory<C extends AccessoryConfig> {
11
11
  protected readonly Service: ServiceType;
12
12
  protected readonly Characteristic: CharacteristicType;
13
13
  protected readonly accessory: PlatformAccessory;
14
- protected readonly config: AccessoryConfig;
14
+ protected readonly config: C;
15
15
  protected readonly log: Log;
16
16
  private readonly mqttClient;
17
- constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: AccessoryConfig, log: Log, caller: string);
17
+ constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log, caller: string);
18
18
  private onMQTTConnect;
19
19
  protected abstract get topicHandlers(): TopicHandler[];
20
20
  protected get name(): string;
@@ -1,7 +1,7 @@
1
- import { PLATFORM_NAME } from '../homebridge/settings.js';
2
- import { MQTT } from '../model/mqtt.js';
3
- import getVersion from '../tools/version.js';
4
- import { assert } from '../tools/validation.js';
1
+ import { PLATFORM_NAME } from '../../homebridge/settings.js';
2
+ import { MQTT } from '../../model/mqtt.js';
3
+ import getVersion from '../../tools/version.js';
4
+ import { assert } from '../../tools/validation.js';
5
5
  export function makeHandler(topic, handler) {
6
6
  return { topic, handler };
7
7
  }
@@ -53,7 +53,7 @@ export class MQTTAccessory {
53
53
  if (this.config.disableLogging) {
54
54
  return;
55
55
  }
56
- this.log.always(message, ...parameters);
56
+ this.log.always(message, this.name, ...parameters);
57
57
  }
58
58
  }
59
59
  //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/accessory/abstract/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAK3C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAInD,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,OAA2D;IACpG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,OAAgB,aAAa;IAKZ;IACA;IACA;IACA;IACA;IAPJ,UAAU,CAAmB;IAE9C,YACqB,OAAoB,EACpB,cAAkC,EAClC,SAA4B,EAC5B,MAAS,EACT,GAAQ,EAC3B,MAAc;QALK,YAAO,GAAP,OAAO,CAAa;QACpB,mBAAc,GAAd,cAAc,CAAoB;QAClC,cAAS,GAAT,SAAS,CAAmB;QAC5B,WAAM,GAAN,MAAM,CAAG;QACT,QAAG,GAAH,GAAG,CAAK;QAI3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QAE9B,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,C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zC,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,8DAA8D;IACpD,MAAM,CAAC,GAAG,IAAmB;QACrC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC;IAES,YAAY,CAAC,OAAe,EAAE,GAAG,UAAoB;QAE7D,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC/B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC;IACrD,CAAC;CACF"}
@@ -1,12 +1,11 @@
1
1
  import { PlatformAccessory, Service } from 'homebridge';
2
2
  import { MQTTAccessory, TopicHandler } from './base.js';
3
- import { CharacteristicType, StatusActiveConfig, ServiceType } from '../model/types.js';
4
- import { Log } from '../tools/log.js';
5
- export declare abstract class StatusActiveAccessory extends MQTTAccessory {
6
- private readonly statusActiveConfig;
3
+ import { CharacteristicType, StatusActiveConfig, ServiceType } from '../../model/types.js';
4
+ import { Log } from '../../tools/log.js';
5
+ export declare abstract class StatusActiveAccessory<C extends StatusActiveConfig = StatusActiveConfig> extends MQTTAccessory<C> {
7
6
  protected readonly accessoryService: Service;
8
7
  private statusActive;
9
- constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, statusActiveConfig: StatusActiveConfig, log: Log, className: string);
8
+ constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: C, log: Log, className: string);
10
9
  protected abstract getAccessoryService(): Service;
11
10
  protected get topicHandlers(): TopicHandler[];
12
11
  private onStatusActiveUpdate;
@@ -1,34 +1,32 @@
1
1
  import { makeHandler, MQTTAccessory } from './base.js';
2
- import { strings } from '../i18n/i18n.js';
3
- import { toPrimitive } from '../tools/primitive.js';
2
+ import { strings } from '../../i18n/i18n.js';
3
+ import { toPrimitive } from '../../tools/primitive.js';
4
4
  export class StatusActiveAccessory extends MQTTAccessory {
5
- statusActiveConfig;
6
5
  accessoryService;
7
6
  statusActive = true;
8
- constructor(Service, Characteristic, accessory, statusActiveConfig, log, className) {
9
- super(Service, Characteristic, accessory, statusActiveConfig, log, className);
10
- this.statusActiveConfig = statusActiveConfig;
7
+ constructor(Service, Characteristic, accessory, config, log, className) {
8
+ super(Service, Characteristic, accessory, config, log, className);
11
9
  this.accessoryService = this.getAccessoryService();
12
10
  this.accessoryService.getCharacteristic(Characteristic.StatusActive)
13
11
  .onGet(this.getStatusActive.bind(this));
14
12
  }
15
13
  get topicHandlers() {
16
14
  return [
17
- ...(this.statusActiveConfig.topicGetStatusActive ? [makeHandler(this.statusActiveConfig.topicGetStatusActive, this.onStatusActiveUpdate.bind(this))] : []),
15
+ ...(this.config.topicGetStatusActive ? [makeHandler(this.config.topicGetStatusActive, this.onStatusActiveUpdate.bind(this))] : []),
18
16
  ];
19
17
  }
20
18
  async onStatusActiveUpdate(topic, value) {
21
19
  if (!this.assert('valueStatusActive')) {
22
20
  return;
23
21
  }
24
- const statusActive = value === toPrimitive(this.statusActiveConfig.valueStatusActive);
22
+ const statusActive = value === toPrimitive(this.config.valueStatusActive);
25
23
  if (statusActive === this.statusActive) {
26
24
  return;
27
25
  }
28
26
  this.statusActive = statusActive;
29
27
  this.accessoryService.updateCharacteristic(this.Characteristic.StatusActive, this.statusActive);
30
28
  if (this.statusActive) {
31
- this.logIfDesired(strings.accessory.statusActive, this.name);
29
+ this.logIfDesired(strings.accessory.statusActive);
32
30
  }
33
31
  else {
34
32
  this.log.warning(strings.accessory.statusInactive, this.name);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusActive.js","sourceRoot":"","sources":["../../../src/accessory/abstract/statusActive.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAgB,M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