homebridge-dummy 1.3.2-beta.1 → 1.4.0-alpha.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 (79) hide show
  1. package/CHANGELOG.md +13 -4
  2. package/README.md +82 -26
  3. package/config.schema.json +258 -44
  4. package/dist/accessory/base.d.ts +28 -8
  5. package/dist/accessory/base.js +53 -37
  6. package/dist/accessory/base.js.map +1 -1
  7. package/dist/accessory/group.d.ts +9 -1
  8. package/dist/accessory/group.js +14 -9
  9. package/dist/accessory/group.js.map +1 -1
  10. package/dist/accessory/helpers.d.ts +3 -5
  11. package/dist/accessory/helpers.js +12 -12
  12. package/dist/accessory/helpers.js.map +1 -1
  13. package/dist/accessory/lock.d.ts +6 -6
  14. package/dist/accessory/lock.js +14 -8
  15. package/dist/accessory/lock.js.map +1 -1
  16. package/dist/accessory/onoff/lightbulb.d.ts +9 -4
  17. package/dist/accessory/onoff/lightbulb.js +31 -4
  18. package/dist/accessory/onoff/lightbulb.js.map +1 -1
  19. package/dist/accessory/onoff/onoff.d.ts +8 -8
  20. package/dist/accessory/onoff/onoff.js +25 -13
  21. package/dist/accessory/onoff/onoff.js.map +1 -1
  22. package/dist/accessory/position/garage.d.ts +3 -4
  23. package/dist/accessory/position/garage.js +3 -3
  24. package/dist/accessory/position/garage.js.map +1 -1
  25. package/dist/accessory/position/position.d.ts +6 -6
  26. package/dist/accessory/position/position.js +14 -8
  27. package/dist/accessory/position/position.js.map +1 -1
  28. package/dist/accessory/sensor.d.ts +4 -5
  29. package/dist/accessory/sensor.js +14 -15
  30. package/dist/accessory/sensor.js.map +1 -1
  31. package/dist/accessory/thermostat.d.ts +5 -6
  32. package/dist/accessory/thermostat.js +25 -19
  33. package/dist/accessory/thermostat.js.map +1 -1
  34. package/dist/homebridge/platform.d.ts +3 -2
  35. package/dist/homebridge/platform.js +31 -12
  36. package/dist/homebridge/platform.js.map +1 -1
  37. package/dist/homebridge-ui/public/index.html +1 -1
  38. package/dist/homebridge-ui/public/ui.js +1 -1
  39. package/dist/i18n/de.d.ts +35 -0
  40. package/dist/i18n/en.d.ts +35 -0
  41. package/dist/i18n/en.js +43 -8
  42. package/dist/i18n/en.js.map +1 -1
  43. package/dist/i18n/es.d.ts +35 -0
  44. package/dist/i18n/i18n.d.ts +35 -0
  45. package/dist/i18n/ru.d.ts +35 -0
  46. package/dist/i18n/template.d.ts +35 -0
  47. package/dist/model/conditions.d.ts +17 -0
  48. package/dist/model/conditions.js +150 -0
  49. package/dist/model/conditions.js.map +1 -0
  50. package/dist/model/enums.d.ts +19 -4
  51. package/dist/model/enums.js +41 -12
  52. package/dist/model/enums.js.map +1 -1
  53. package/dist/model/types.d.ts +18 -3
  54. package/dist/model/webhook.js +23 -19
  55. package/dist/model/webhook.js.map +1 -1
  56. package/dist/timeout/fader.d.ts +9 -0
  57. package/dist/timeout/fader.js +33 -0
  58. package/dist/timeout/fader.js.map +1 -0
  59. package/dist/timeout/limiter.d.ts +2 -2
  60. package/dist/timeout/limiter.js +8 -8
  61. package/dist/timeout/limiter.js.map +1 -1
  62. package/dist/timeout/schedule.d.ts +3 -3
  63. package/dist/timeout/schedule.js +18 -18
  64. package/dist/timeout/schedule.js.map +1 -1
  65. package/dist/timeout/timeout.d.ts +6 -4
  66. package/dist/timeout/timeout.js +12 -7
  67. package/dist/timeout/timeout.js.map +1 -1
  68. package/dist/timeout/timer.d.ts +3 -4
  69. package/dist/timeout/timer.js +8 -9
  70. package/dist/timeout/timer.js.map +1 -1
  71. package/dist/tools/configMigration.js +2 -2
  72. package/dist/tools/configMigration.js.map +1 -1
  73. package/dist/tools/logWatcher.d.ts +13 -0
  74. package/dist/tools/logWatcher.js +52 -0
  75. package/dist/tools/logWatcher.js.map +1 -0
  76. package/dist/tools/primitive.d.ts +3 -0
  77. package/dist/tools/primitive.js +24 -0
  78. package/dist/tools/primitive.js.map +1 -0
  79. package/package.json +13 -3
package/CHANGELOG.md CHANGED
@@ -2,13 +2,22 @@
2
2
 
3
3
  All notable changes to homebridge-dummy will be documented in this file.
4
4
 
5
- ## 1.3.2-beta.1 (2025-10-21)
5
+ ## 1.4.0-beta.4 (2025-10-26)
6
6
 
7
- ### ‼️ WARNING ‼️ If upgrading from v0.9.2 or earlier, [READ THIS FIRST](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#v10-migration)
7
+ ### ‼️ WARNING ‼️ If upgrading from v0.9.2 or earlier, [READ THIS FIRST](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#v10-migration)
8
8
 
9
- ### ⚠️ Feedback Request
9
+ ### Added
10
+ - [Trigger Conditions](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#trigger-conditions) to change the state of an accessory based on state changes of other Homebridge Dummy accessories or keywords in the Homebridge log
11
+ - ⚠️ Config UI for conditions is highly experimental. Please [open a ticket](https://github.com/mpatfield/homebridge-dummy/issues/new/choose) if you see any unusal behavior.
12
+ - `GET` requests for [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) (previously only `POST`)
13
+ - Fade Out option for `Lightbulb` brightness to emulate a simple "count-down"
14
+ - Min/max temperature settings for `Thermostat`
15
+
16
+ ### Changed
17
+ - `defaultOn` has been deprecated in favor of `defaultState` for `Lightbulb`, `Outlet`, and `Switch`
18
+ - This is backwards compatible so no manual edits are necessary
10
19
 
11
- I am considering the removal of Thermostat as a supported accessory type from a future version. If you use Thermostat, please add your use case to [this ticket](https://github.com/mpatfield/homebridge-dummy/issues/207).
20
+ ## 1.3.2 (2025-10-24)
12
21
 
13
22
  ### Added
14
23
  - Support for `GarageDoorOpener`
package/README.md CHANGED
@@ -123,13 +123,26 @@ Using the Homebridge Config UI is the easiest way to set up this plugin. However
123
123
  "units": "MILLISECONDS | SECONDS | MINUTES | HOURS",
124
124
  "period": "HOUR | DAY | WEEK | MONTH",
125
125
  },
126
+ "conditions": {
127
+ "operator": "and | or",
128
+ "operands" [
129
+ {
130
+ "accessoryId": "string",
131
+ "accessoryState": "on | off | open | closed | locked | unlocked",
132
+ }
133
+
134
+ ]
135
+ },
126
136
  "temperatureUnits": "C" | "F",
127
- "defaultOn": true | false,
137
+ "defaultState": "on" | "off",
128
138
  "defaultBrightness": 0-100,
139
+ "fadeOut": true | false,
129
140
  "defaultLockState": "locked" | "unlocked",
130
141
  "defaultPosition": "open" | "closed",
131
142
  "defaultThermostatState": "auto" | "heat" | "cool" | "off",
132
143
  "defaultTemperature": number,
144
+ "minimumTemperature": number,
145
+ "maximumTemperature": number,
133
146
  "commandOn": "string",
134
147
  "commandOff": "string",
135
148
  "commandLock": "string",
@@ -221,14 +234,49 @@ Execute arbitrary commands (e.g. curl) when the accessory changes state
221
234
  - `unlockCommand` - Arbitrary command to execute when lock mechanism is unlocked
222
235
  - `commandTemperature` - Arbitrary command to execute when temperature changes
223
236
 
237
+ ### Trigger Conditions
238
+
239
+ You can trigger an accessory whenever a set of conditions are satisfied, for example, when other Homebridge Dummy accessories turn on.
240
+
241
+ There are two logical operators to trigger the target accessory when all (`AND`) or any (`OR`) of a set of conditions are satisfied. This is set using `operator`.
242
+
243
+ You can have an arbitrarily long list of conditions and they are checked in order.
244
+
245
+ If target accessory is not setup to auto-reset with a timer, then it will immediately return to it's default setting as soon as the conditions are no longer met.
246
+
247
+ Note that due to limitations of HomeKit and Homebridge, it is only possible to check the states of other Homebridge Dummy accessories.
248
+
249
+ One workaround is to use the `LOG` operand type which will watch the Homebridge log for the specified string or regex.
250
+
251
+ `LOG` based conditions are stateless triggers. If it is the only condition or the conditions `operator` is `OR`, then it will fire immediately. If there are other `AND` conditions, then it will not fire unless all other conditions are satisfied.
252
+
253
+ For example, if I have `LOG` condition "A" and `ACCESSORY` condition "B" for when "B" is turned "On", then if "B" is "Off"" and the pattern is found in the log, "A" will not trigger.
254
+
255
+ Note that `LOG` triggers are not instantenous and may take several seconds to fire.
256
+
257
+ Another workaround for non-Dummy accessories is to set up duplicate accessories in Homebridge Dummy and use Automation to mirror the states.
258
+
259
+ For example, if I have a physical door lock I want to "watch", then I can setup a `LockMechanism` accessory in Homebridge Dummy and create two automations to change the state of my dummy lock whenever the physical door lock is unlocked or locked.
260
+
261
+ #### Conditions Object
262
+ - `operator` - "and" to require ALL conditions to be satisfied, and "or" ANY
263
+ - `operands` - A list of accessories to "watch" for state changes to see if conditions are satisfied
264
+
265
+ #### Operand Object
266
+ - `accessoryId` - The id of the accessory to watch for state changes
267
+ - `accessoryState` - The desired accessory state to make this condition "true"
268
+
224
269
  ### Defaults
225
270
  - `temperatureUnits` - Units to use for thermostats, either 'C' or 'F'
226
- - `defaultOn` — Initial value. Default _ON_ = true, default _OFF_ = false
271
+ - `defaultState` — Initial value, either "on" or "off"
227
272
  - `defaultBrightness` — If set, lightbulb will have additional dimmer settings with this default brightness percentage
273
+ - `fadeOut` - Fade smoothly instead of abruptly from 100% to off. Requires `defaultBrightness` and `timer` to be defined.
228
274
  - `defaultLockState` - The initial value for the lock, "locked" or "unlocked"
229
275
  - `defaultPosition` — Initial position for the door/garage/window/blinds, "open" or "closed"
230
276
  - `defaultThermostatState` - The initial state for the thermostat, "auto", "heat", "cool", or "off"
231
277
  - `defaultTemperature` - The default temperature for the thermostat in `temperatureUnits` defined above
278
+ - `minimumTemperature` - Defines a minimum temperature
279
+ - `maximumTemperature` - Defines a maximum temperature
232
280
 
233
281
  ### Options
234
282
  - `enableWebook` - Turn on webhooks for this accessory. See [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) section below for details.
@@ -241,23 +289,7 @@ You can optionally enable webhooks on an accessory by choosing `Enable Webhooks`
241
289
 
242
290
  If at least one accessory has webhooks enabled, then Homebridge Dummy will start a webhook server on startup. The default port is `63743`, e.g. `http://localhost:63743/`. To change the port, add `webhookPort` to the top level Homebridge Dummy config (see above).
243
291
 
244
- Incoming requests must be valid JSON and include the id of the accessory, the desired command, and the value to set.
245
-
246
- For example, to turn a switch on the JSON request should look like this:
247
-
248
- ```json
249
- {
250
- "id": "17a62a7b",
251
- "command": "On",
252
- "value": true
253
- }
254
- ```
255
-
256
- Here's how you would call it from the command line.
257
-
258
- ```
259
- curl -X POST http://localhost:63743/ -H "Content-Type: application/json" -d '{"id": "17a62a7b", "command": "On", "value": true}
260
- ```
292
+ Incoming requests must include the `id` of the accessory, the desired `command`, and the `value` to set.
261
293
 
262
294
  The accessory `id` can be found in the plugin JSON config.
263
295
 
@@ -269,21 +301,41 @@ Here are the possible values for `command` and their respective valid `value`
269
301
  - `TargetHeatingCoolingState` - 0 (OFF), 1 (HEAT), 2 (COOL), 3 (AUTO)
270
302
  - `TargetPosition` - number from 0-100
271
303
  - `TargetTemperature` - number between 10°C and 38°C
304
+ - For `TargetTemperature` you may optionally supply a `unit` (either 'F' or 'C') to allow you to pass in Fahrenheit or Celsius units.
305
+
306
+ #### GET Example
307
+
308
+ ```
309
+ http://localhost:63743/?id=ACCESSORY_ID&command=On&value=true
310
+ ```
311
+
312
+ ### POST Example
272
313
 
273
- For `TargetTemperature` you may optionally supply a `unit` (either 'F' or 'C') to allow you to pass in Fahrenheit or Celsius units.
314
+ POST requrests must be valid JSON.
315
+
316
+ For example, to turn a switch on the JSON request should look like this:
274
317
 
275
318
  ```json
276
319
  {
277
- "id": "18a35b6c",
278
- "command": "TargetTemperature",
279
- "value": 72,
280
- "unit": "F"
320
+ "id": "ACCESSORY_ID",
321
+ "command": "On",
322
+ "value": true
281
323
  }
282
324
  ```
283
325
 
326
+ Here's how you would call it from the command line.
327
+
328
+ ```
329
+ curl -X POST http://localhost:63743/ -H "Content-Type: application/json" -d '{"id": "ACCESSORY_ID", "command": "On", "value": true}
330
+ ```
331
+
284
332
  ## Credits
285
333
 
286
- Special thanks to [@nfarina](https://github.com/sponsors/nfarina) for creating the original version of this plugin and maintaining it for almost 10 (!!!) years
334
+ [@jotzet79](https://github.com/sponsors/jotzet79) for German translations
335
+
336
+ [@Silverdragon122](https://github.com/sponsors/Silverdragon122) for Russian translations
337
+
338
+ [@dcompane](https://github.com/sponsors/dcompane) for Spanish translations
287
339
 
288
340
  [Keryan Belahcene](https://www.instagram.com/keryan.me) for creating the [Flume](https://github.com/homebridge-plugins/homebridge-flume) banner image which was adapted for use with this plugin
289
341
 
@@ -293,4 +345,8 @@ Sensor feature inspired by [Homebridge-Delay-Switch](https://github.com/nitaybz/
293
345
 
294
346
  Command feature inspired by [homebridge-cmdtrigger](https://github.com/hallos/homebridge-cmdtrigger) by [@hallos](https://github.com/sponsors/hallos)
295
347
 
296
- And to the amazing creators/contributors of [Homebridge](https://homebridge.io) who made this plugin possible!
348
+ Log watch trigger feature inspired by [hb-virtual-switch](https://github.com/Plankske/hb-virtual-switch/) by [@Plankske](https://github.com/sponsors/Plankske)
349
+
350
+ Special thanks to [@nfarina](https://github.com/sponsors/nfarina) for creating the original version of this plugin and maintaining it for almost 10 (!!!) years
351
+
352
+ And to the amazing creators/contributors of [Homebridge](https://homebridge.io) who made this plugin possible!