homebridge-dummy 1.4.3 → 1.5.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 (42) hide show
  1. package/CHANGELOG.md +27 -17
  2. package/README.md +7 -411
  3. package/config.schema.json +60 -80
  4. package/dist/accessory/base.d.ts +3 -3
  5. package/dist/accessory/base.js +13 -13
  6. package/dist/accessory/base.js.map +1 -1
  7. package/dist/accessory/lock.js +2 -2
  8. package/dist/accessory/lock.js.map +1 -1
  9. package/dist/accessory/onoff/lightbulb.d.ts +1 -1
  10. package/dist/accessory/onoff/lightbulb.js +3 -3
  11. package/dist/accessory/onoff/lightbulb.js.map +1 -1
  12. package/dist/accessory/onoff/onoff.js +2 -2
  13. package/dist/accessory/onoff/onoff.js.map +1 -1
  14. package/dist/accessory/position/position.js +2 -2
  15. package/dist/accessory/position/position.js.map +1 -1
  16. package/dist/homebridge-ui/public/index.html +1 -1
  17. package/dist/homebridge-ui/public/ui.js +1 -1
  18. package/dist/i18n/de.d.ts +26 -18
  19. package/dist/i18n/en.d.ts +26 -18
  20. package/dist/i18n/en.js +28 -20
  21. package/dist/i18n/en.js.map +1 -1
  22. package/dist/i18n/es.d.ts +26 -18
  23. package/dist/i18n/i18n.d.ts +26 -18
  24. package/dist/i18n/ru.d.ts +26 -18
  25. package/dist/i18n/template.d.ts +26 -18
  26. package/dist/model/enums.d.ts +1 -0
  27. package/dist/model/enums.js +1 -0
  28. package/dist/model/enums.js.map +1 -1
  29. package/dist/model/types.d.ts +17 -3
  30. package/dist/timeout/schedule.d.ts +11 -3
  31. package/dist/timeout/schedule.js +92 -19
  32. package/dist/timeout/schedule.js.map +1 -1
  33. package/dist/timeout/timeout.d.ts +1 -2
  34. package/dist/tools/configMigration.js +4 -3
  35. package/dist/tools/configMigration.js.map +1 -1
  36. package/dist/tools/storage.d.ts +12 -0
  37. package/dist/tools/storage.js +12 -0
  38. package/dist/tools/storage.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/timeout/timer.d.ts +0 -14
  41. package/dist/timeout/timer.js +0 -68
  42. package/dist/timeout/timer.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,30 +2,40 @@
2
2
 
3
3
  All notable changes to homebridge-dummy will be documented in this file.
4
4
 
5
- ## 1.4.3 (2025-11-20)
5
+ ## 1.5.0 (2025-11-21)
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/wiki/Migration)
8
8
 
9
9
  ### Added
10
- - MAC Address support for [Reachability](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#reachabilitypresence) conditions, useful for triggering events based on joining/leaving your local network
10
+ - Auto-Reset now supports the same options as Schedule — delay, interval, sun-based options, and cron
11
+ - ⚠️ This required significant under-the-hood changes to the timer logic, so please [open a ticket](https://github.com/mpatfield/homebridge-dummy/issues/new/choose) if you have issues
12
+
13
+ ### Changed
14
+ - Deprecated `timer` in favor of `autoReset` (see above)
15
+ - This is backwards compatible, so no manual JSON config edits are necessary
16
+
17
+ ### Notes
18
+ Would you like to see Homebridge Dummy in your language? Please consider [getting involved](https://github.com/mpatfield/homebridge-dummy/issues/105). No coding experience required!
19
+
20
+ ## 1.4.3 (2025-11-20)
21
+
22
+ ### Added
23
+ - MAC Address support for [Reachability](https://github.com/mpatfield/homebridge-dummy/wiki/Trigger-Conditions#reachabilitypresence) conditions, useful for triggering events based on joining/leaving your local network
11
24
  - ⚠️ Somewhat experimental so please [open a ticket](https://github.com/mpatfield/homebridge-dummy/issues/new/choose) if you have issues
12
25
 
13
26
  ### Fixed
14
- - `TargetTemperature` [Webhook](https://github.com/mpatfield/homebridge-dummy#webhooks) respects configured min/max ([#257](https://github.com/mpatfield/homebridge-dummy/issues/257))
27
+ - `TargetTemperature` [Webhook](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks) respects configured min/max ([#257](https://github.com/mpatfield/homebridge-dummy/issues/257))
15
28
  - Suppress `Lightbulb` warnings ([#258](https://github.com/mpatfield/homebridge-dummy/issues/258)) and avoid potential crash on startup ([#266](https://github.com/mpatfield/homebridge-dummy/issues/266))
16
29
  - `Thermostat` issue when setting `minimumTemperature` to zero ([#259](https://github.com/mpatfield/homebridge-dummy/issues/259))
17
30
 
18
31
  ### Changed
19
32
  - Triggering accessory via `Schedule` resets any `Auto-Reset Timer`
20
33
 
21
- ### Notes
22
- Would you like to see Homebridge Dummy in your language? Please consider [getting involved](https://github.com/mpatfield/homebridge-dummy/issues/105). No coding experience required!
23
-
24
34
  ## 1.4.2 (2025-11-14)
25
35
 
26
36
  ### Added
27
- - `sync` [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) which suppress command execution
28
- - Accessory states can be accessed within commands via [Environment Variables](https://github.com/mpatfield/homebridge-dummy#environment-variables)
37
+ - `sync` [Webhooks](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks) which suppress command execution
38
+ - Accessory states can be accessed within commands via [Environment Variables](https://github.com/mpatfield/homebridge-dummy/wiki/Environment-Variables)
29
39
 
30
40
  ### Changed
31
41
  - `Thermostat` - current state (i.e. HEAT/COOL/OFF) mirrors target state; previously always 'OFF'
@@ -33,17 +43,17 @@ Would you like to see Homebridge Dummy in your language? Please consider [gettin
33
43
  ## 1.4.1 (2025-11-06)
34
44
 
35
45
  ### Added
36
- - [Schedule](https://github.com/mpatfield/homebridge-dummy#schedule) settings for sunrise, sunset, dawn, dusk, golden hour, or night, with optional offset
37
- - [Reachability](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#reachabilitypresence) Trigger Condition
38
- - Fetch accessory state via [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks)
46
+ - [Schedule](https://github.com/mpatfield/homebridge-dummy/wiki/Schedule) settings for sunrise, sunset, dawn, dusk, golden hour, or night, with optional offset
47
+ - [Reachability](https://github.com/mpatfield/homebridge-dummy/wiki/Trigger-Conditions#reachabilitypresence) Trigger Condition
48
+ - Fetch accessory state via [Webhooks](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks)
39
49
  - `command` has been replaced by `get`/`set` - this is backwards compatible so no manual edits are necessary
40
50
 
41
51
  ## 1.4.0 (2025-11-01)
42
52
 
43
53
  ### Added
44
- - [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
54
+ - [Trigger Conditions](https://github.com/mpatfield/homebridge-dummy/wiki/Trigger-Conditions) to change the state of an accessory based on state changes of other Homebridge Dummy accessories or keywords in the Homebridge log
45
55
  - ⚠️ 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.
46
- - `GET` requests for [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) (previously only `POST`)
56
+ - `GET` requests for [Webhooks](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks) (previously only `POST`)
47
57
  - Fade Out option for `Lightbulb` brightness to emulate a simple "count-down"
48
58
  - Min/max temperature settings for `Thermostat`
49
59
 
@@ -72,12 +82,12 @@ After further consideration, I will continue to support `Thermostat` as an acces
72
82
  - Traducciones al español. ¡Gracias, [@dcompane](https://github.com/sponsors/dcompane)!
73
83
 
74
84
  ### Changed
75
- - Webhook server port is now configurable using `webhookPort` ([docs](https://github.com/mpatfield/homebridge-dummy#webhooks))
85
+ - Webhook server port is now configurable using `webhookPort` ([docs](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks))
76
86
 
77
87
  ## 1.3.0 (2025-10-13)
78
88
 
79
89
  ### Added
80
- - Time Limits ([docs](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#limiter))
90
+ - Time Limits ([docs](https://github.com/mpatfield/homebridge-dummy/wiki/Limiter))
81
91
 
82
92
  ### Fixed
83
93
  - More robust command execution to prevent incorrectly displaing errors on success
@@ -89,7 +99,7 @@ After further consideration, I will continue to support `Thermostat` as an acces
89
99
  ## 1.2.0 (2025-10-02)
90
100
 
91
101
  ### Added
92
- - Webhooks ([docs](https://github.com/mpatfield/homebridge-dummy#webhooks))
102
+ - Webhooks ([docs](https://github.com/mpatfield/homebridge-dummy/wiki/Webhooks))
93
103
 
94
104
  ### Changed
95
105
  - `schedule.cron` now expects an `@` preset or `CRON_CUSTOM` with `schedule.cronCustom` defined.
package/README.md CHANGED
@@ -16,425 +16,21 @@ Homebridge plugin to create fake accessories for assisting with advanced Apple H
16
16
 
17
17
  </span>
18
18
 
19
- ## Disclaimer
20
-
21
- Any issues or damage resulting from use of this plugin are not the fault of the developer. Use at your own risk.
22
-
23
- ## v1.0 Migration
24
-
25
- ### tl;dr
26
-
27
- ‼️ There are significant code changes between v0.9 and v1.0 which means you will need to reconfigure HomeKit automations after upgrading. Homebridge Dummy will try to help migrate old accessories.
28
-
29
- ### Why?
30
-
31
- The original Homebridge Dummy was written almost 10 years ago and uses the now deprecated [Accessory Plugin](https://developers.homebridge.io/#/api/accessory-plugins) architecture.
32
-
33
- While this still works okay for now, migrating the code to use [Platform Plugins](https://developers.homebridge.io/#/api/platform-plugins) will future-proof Homebridge Dummy and allow for more modern and robust design patterns.
34
-
35
- The architecture used in v1.0 will make it much easier to improve and extend this plugin going forward and already includes several new features.
36
-
37
- ### Drawbacks
38
-
39
- Unfortunately, there is no built-in way to migrate existing accessory plugins to platform plugins. This means that all accessories will be considered "new" by HomeKit, so any existing automations or room setups will be lost.
40
-
41
- However, Homebridge Dummy will try to help migrate the accessory configurations to the new system to prevent you having to set them all up again in Homebridge.
42
-
43
- ### HOOBS Users
44
-
45
- Homebridge Dummy now requires `customUi` for the config UI to help with migration from older versions, translations, UUID generation and some other useful tools. Unfortunately, HOOBS does not support `customUi`.
46
-
47
- If you use HOOBS your current options are:
48
-
49
- 1. Upgrade to v1.0+ and use Advanced Mode to manually edit the JSON config
50
- 2. Continue to use `v0.9.2` which should continue to work for the foreseeable future but won't include any of the new features
51
- 3. Migrate your system to Homebridge which is very actively developed and has an engaged community of developers
52
-
53
- You may also add a comment on [this ticket](https://github.com/hoobs-org/sidecars/issues/13) to help encourage the HOOBS team to add a "sidecar" for Homebridge Dummy.
54
-
55
- ### Migration Flow
56
-
57
- ⚠️ Please make sure to restart both Homebridge Service AND Homebridge UI after upgrading to v1.0 or you will experience issues with Homebridge Dummy configuration.
58
-
59
- Once you have installed v1.0, click on the icon to configure the Homebridge Dummy plugin in the Homebridge UI and it will walk you through the necessary questionnaire.
60
-
61
- Alternatively, you can add the following to "platforms" in your config.json
62
-
63
- ```json
64
- {
65
- "name": "Homebridge Dummy",
66
- "platform": "HomebridgeDummy",
67
- "migrationNeeded": true
68
- }
69
- ```
70
-
71
- You will need to restart Homebridge after completing the flow for changes to take effect.
72
-
73
- ⚠️ If you are using child bridges with v0.9, you may need to restart Homebridge _twice_ for migrated accessories to show up correctly.
74
-
75
- You may safely ignore any "No plugin was found…" errors you see in the Homebridge logs. These should go away after a few Homebridge restarts.
19
+ <h3 align="center">‼️ WARNING ‼️<br>If upgrading from v0.9.2 or earlier<br><a href="https://github.com/mpatfield/homebridge-dummy/wiki/Migration">READ THIS FIRST</a></h3>
76
20
 
77
- ### Problems?
21
+ <h4 align="center">⚠️ HOOBS Users ⚠️<br><a href="https://github.com/mpatfield/homebridge-dummy/wiki/HOOBS">Read This</a></h4>
78
22
 
79
- This is an experimental flow and may not work as intended. If you see "Sorry, something went wrong with the accessory migration" or encounter other issues, please [create an issue](https://github.com/mpatfield/homebridge-dummy/issues/new?template=new-issue.md).
23
+ ## Disclaimer
80
24
 
81
- The first thing the flow does is create a backup called `config.json.bak` in your Homebridge directory. If all else fails, you can replace your `config.json` with the backup and downgrade to Homebridge Dummy v0.9 to restore your previous accessories.
25
+ Any issues or damage resulting from use of this plugin are not the fault of the developer. Use at your own risk.
82
26
 
83
27
  ## About
84
28
 
85
- With this plugin, you can create any number of fake accessories which are useful for advanced automation with HomeKit scenes. Features include scheduling to trigger at a specific interval or times, resetting automatically after a delay, activating sensors such as motion or occupancy, running arbitrary commands such as cron, and more.
86
-
87
- Currently, Doors, Garage Door Openers, Lightbulbs, Locks, Outlets, Switches, Thermostats, Windows, and Window Coverings are supported. If there is a particular device or feature you'd like to see, please [create an issue](https://github.com/mpatfield/homebridge-dummy/issues/new?template=new-issue.md).
88
-
89
- ## Configuration
90
-
91
- Using the Homebridge Config UI is the easiest way to set up this plugin. However, if you wish to do things manually then you will need to add the following to your Homebridge `config.json`:
92
-
93
- ```json
94
- {
95
- "name": "Homebridge Dummy",
96
- "accessories": [
97
- {
98
- "id": "string",
99
- "name": "string",
100
- "type": "Door | GarageDoorOpener | Lightbulb | LockMechanism | Outlet | Switch | Thermostat | Window | WindowCovering",
101
- "groupName": "string",
102
- "timer": {
103
- "delay": number,
104
- "units": "MILLISECONDS | SECONDS | MINUTES | HOURS",
105
- "random": true | false
106
- },
107
- "schedule": {
108
- "type": "INTERVAL" | "CRON" | "SUNRISE" | "SUNSET" | "DAWN" | "DUSK" | "GOLDEN_HOUR" | "NIGHT",
109
- "interval": number,
110
- "units": "MILLISECONDS | SECONDS | MINUTES | HOURS",
111
- "random": true | false,
112
- "cron": "string",
113
- "offset": number,
114
- "latitude": number,
115
- "longitude": number
116
- },
117
- "sensor": {
118
- "type": "CarbonDioxideSensor | CarbonMonoxideSensor | ContactSensor | LeakSensor | MotionSensor | OccupancySensor | SmokeSensor",
119
- "timerControlled": true | false
120
- },
121
- "limiter": {
122
- "id": "string",
123
- "limit": number,
124
- "units": "MILLISECONDS | SECONDS | MINUTES | HOURS",
125
- "period": "HOUR | DAY | WEEK | MONTH",
126
- },
127
- "conditions": {
128
- "operator": "and | or",
129
- "operands" [
130
- {
131
- "accessoryId": "string",
132
- "accessoryState": "on | off | open | closed | locked | unlocked",
133
- "pattern": "string",
134
- "pingHost": "string",
135
- "pingAvailability": "AVAILABLE | NOT_AVAILABLE"
136
- "pingInterval": number,
137
- "pingUnits": "MILLISECONDS | SECONDS | MINUTES | HOURS"
138
- }
139
-
140
- ]
141
- },
142
- "temperatureUnits": "C" | "F",
143
- "defaultState": "on" | "off",
144
- "defaultBrightness": 0-100,
145
- "fadeOut": true | false,
146
- "defaultLockState": "locked" | "unlocked",
147
- "defaultPosition": "open" | "closed",
148
- "defaultThermostatState": "auto" | "heat" | "cool" | "off",
149
- "defaultTemperature": number,
150
- "minimumTemperature": number,
151
- "maximumTemperature": number,
152
- "commandOn": "string",
153
- "commandOff": "string",
154
- "commandLock": "string",
155
- "commandUnlock": "string",
156
- "commandOpen": "string",
157
- "commandClose": "string",
158
- "commandTemperature": "string",
159
- "enableWebook": true | false,
160
- "resetOnRestart": true | false,
161
- "disableLogging": true | false
162
- }
163
-
164
- ],
165
- "platform": "HomebridgeDummy",
166
- "verbose": true | false,
167
- "webhookPort": number,
168
- }
169
- ```
170
-
171
- All fields are optional unless noted with an asterisk (*)
172
-
173
- ### General
174
- - `id`* - A unique identifier for the accessory. Changing this value will create a new accessory.
175
- - `name`* - The display name for the accessory in HomeKit
176
- - `type`* - The type of accessory
177
-
178
- Valid values for `type` are:
179
- - `Door`
180
- - `GarageDoorOpener`
181
- - `Lightbulb`
182
- - `LockMechanism`
183
- - `Outlet`
184
- - `Switch`
185
- - `Thermostat`
186
- - `Window`
187
- - `WindowCovering`
188
-
189
- ### Group
190
- - `groupName` - Items sharing the same group name will be collected together in the Home app UI
191
-
192
- ⚠️ Adding/removing/changing the group name will require you to reconfigure any HomeKit scenes or automations
193
-
194
- ### Timer
195
- Return the accessory to its default value after the specified delay
196
-
197
- - `timer.delay` — If defined, the switch will automatically toggle after this many milliseconds/seconds/minutes/hours
198
- - `timer.units` — The units to use for delay above (`MILLISECONDS`, `SECONDS`, `MINUTES`, or `HOURS`). *Required if delay is set.
199
- - `timer.random` — If true, the delay will be randomized with a maximum value of `timer.delay`
200
-
201
- ### Schedule
202
- Set the accessory to its opposite (non-default) value at specified interval or times
203
-
204
- - `schedule.type` — One of `INTERVAL`, `CRON`, `SUNRISE`, `SUNSET`, `DAWN`, `DUSK`, `GOLDEN_HOUR`, `NIGHT`
205
- - `schedule.interval` — Trigger the accessory after this many milliseconds/seconds/minutes/hours. *Required if `schedule.type` = `INTERVAL`
206
- - `schedule.units` — The units to use for the interval (`MILLISECONDS`, `SECONDS`, `MINUTES`, or `HOURS`) *Required if `schedule.type` = `INTERVAL`
207
- - `schedule.random` — If true, the interval will be randomized with a maximum value of `schedule.interval`
208
- - `schedule.cron` — One of `@secondly`, `@minutely`, `@hourly`, `@daily`, `@weekly`, `@weekdays`, `@weekends`, `@monthly`, `@yearly`, or `CUSTOM_CRON`. *Required if `schedule.type` = `CRON`
209
- - `schedule.cronCustom` - Custom cron string for triggering the accessory. *Required if `schedule.cron` = `CUSTOM_CRON`
210
- - See [crontab.guru](http://crontab.guru) for help
211
- - `schedule.offset` - Add or subtract this value from the caluclated sun position for `SUNRISE`, `SUNSET`, etc.
212
- - `schedule.latitude` - Latitude used to calculate sun position *Required if `schedule.type` is `SUNRISE`, `SUNSET`, etc.
213
- - `schedule.longitude` - Longitude used to calculate sun position *Required if `schedule.type` is `SUNRISE`, `SUNSET`, etc.
214
-
215
- ### Limiter
216
- Restrict the total time this accessory can be set to its non-default value, for each specified period
217
-
218
- - `limiter.id` - A random id (such as UUID) for storing the limit. Change this value to reset the limit.
219
- - `limiter.limit` - The total time number of seconds/minutes/hours that this accessory may run for each `period`
220
- - `limiter.units` - The units to use for delay above (`MILLISECONDS`, `SECONDS`, `MINUTES`, or `HOURS`). *Required if limit is set.
221
- - `limiter.period` - How often the limit is reset (`HOUR`, `DAY`, `WEEK`, `MONTH`) *Required if limit is set.
222
- - `HOUR` is reset at X:00:00, `DAY` at local midnight, `WEEK` on Monday, and `MONTH` on the 1st day
223
-
224
- ### Sensor
225
- - `sensor.type` - Optionally attach a sensor that mirrors the state of the parent accessory
226
- - `sensor.timerControlled` - If true, sensor will be activated if accessory is reset by timer but not if it is reset manually
227
-
228
- Valid values for sensor are:
229
- - `CarbonDioxideSensor`
230
- - `CarbonMonoxideSensor`
231
- - `ContactSensor`
232
- - `LeakSensor`
233
- - `MotionSensor`
234
- - `OccupancySensor`
235
- - `SmokeSensor`
236
-
237
- ### Commands
238
- Execute arbitrary commands (e.g. curl) when the accessory changes state
239
-
240
- - `onCommand` - Arbitrary command to execute when lightbulb/outlet/switch/thermostat turns on
241
- - `offCommand` - Arbitrary command to execute when lightbulb/outlet/switch/thermostat turns off
242
- - `lockCommand` - Arbitrary command to execute when lock mechanism is locked
243
- - `unlockCommand` - Arbitrary command to execute when lock mechanism is unlocked
244
- - `commandTemperature` - Arbitrary command to execute when temperature changes
245
-
246
- #### Environment Variables
247
-
248
- Accessory states can be accessed within commands via environment variables which will have the form:
249
-
250
- `Dummy_[ACCESSORY_ID]_[CHARACTERISTIC]`
251
-
252
- `ACCESSORY_ID` will be sanitized to alphanumeric characters only. So, for example "cc5d51b8-40df-4889-89b4-3bbadd3749c0" will become "cc5d51b840df488989b43bbadd3749c0"
253
-
254
- `CHARACTERISTIC` will be one of the following depending on the accessory type:
255
-
256
- - `Brightness`
257
- - `LockTargetState`
258
- - `On`
259
- - `TargetHeatingCoolingState`
260
- - `TargetDoorState`
261
- - `TargetPosition`
262
- - `TargetTemperature`
263
-
264
- For example, here is how you would get the state of a switch.
265
-
266
- ```
267
- $ echo $Dummy_cc5d51b840df488989b43bbadd3749c0_On
268
- > true
269
- ```
270
-
271
- The easiest way to find all available variables is to create a switch that runs the command `printenv`
272
-
273
- ### Defaults
274
- - `temperatureUnits` - Units to use for thermostats, either 'C' or 'F'
275
- - `defaultState` — Initial value, either "on" or "off"
276
- - `defaultBrightness` — If set, lightbulb will have additional dimmer settings with this default brightness percentage
277
- - `fadeOut` - Fade smoothly instead of abruptly from 100% to off. Requires `defaultBrightness` and `timer` to be defined.
278
- - `defaultLockState` - The initial value for the lock, "locked" or "unlocked"
279
- - `defaultPosition` — Initial position for the door/garage/window/blinds, "open" or "closed"
280
- - `defaultThermostatState` - The initial state for the thermostat, "auto", "heat", "cool", or "off"
281
- - `defaultTemperature` - The default temperature for the thermostat in `temperatureUnits` defined above
282
- - `minimumTemperature` - Defines a minimum temperature
283
- - `maximumTemperature` - Defines a maximum temperature
284
-
285
- ### Options
286
- - `enableWebook` - Turn on webhooks for this accessory. See [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) section below for details.
287
- - `resetOnRestart` _ If true, accessory will return to default state when Homebridge restarts
288
- - `disableLogging` — If true, state changes will not be logged
289
-
290
- ## Trigger Conditions
291
-
292
- You can trigger an accessory whenever a set of conditions are satisfied. There are two logical operators to trigger the target accessory when all (`AND`) or any (`OR`) of a set of conditions are satisfied. You may have an arbitrarily long list of conditions and they are checked in order.
293
-
294
- - `conditions.operator` - `AND` to trigger when all conditions to be satisfied, `OR` to trigger when any conditions are satisfied
295
- - `conditions.operands` - A list of conditions as defined below
296
-
297
- ### Accessory Triggers
298
-
299
- You can trigger an accessory when one more more other Homebridge Dummy accessories change state using the `ACCESSORY` operand type. Accessories will immediately return to their default setting as soon as the conditions are no longer satisfied unless an accessory also has an auto-reset timer.
300
-
301
- Note that due to limitations of HomeKit and Homebridge, it is only possible to check the states of other Homebridge Dummy accessories. One workaround for non-Dummy accessories is to set up duplicate accessories in Homebridge Dummy and use Automation to mirror the states. 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.
302
-
303
- - `type` - `ACCESSORY`
304
- - `accessoryId` - The id of the accessory to watch for state changes
305
- - `accessoryState` - The desired accessory state to make this condition true, e.g. "on", "off", "open", "closed", "locked", "unlocked"
306
-
307
- ### Log Watcher
308
-
309
- Another workaround to the above limitation is to use the `LOG` operand type which will watch the Homebridge log for the specified string or regex.
310
-
311
- `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.
312
-
313
- 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.
314
-
315
- Note that `LOG` triggers are not instantenous and may take several seconds to fire.
316
-
317
- - `type` - `LOG`
318
- - `pattern` - a literal string or regex to watch for
319
-
320
- ### Reachability/Presence
321
-
322
- There is also a `PING` operand type that allows you to set the state based on the reachability/presence of a particular `pingHost`.
323
-
324
- - `type` - `PING`
325
- - `pingHost` - the host to ping, e.g. `192.168.0.1` or `example.com` or `aa:11:bb:22:cc:33`
326
- - `pingAvailability` - Indicates whether being `AVAILABLE` or `NOT_AVAILABLE` satisfies the condition
327
- - `pingInterval` - The raw interval to check the reachability of the above host (default 60 seconds)
328
- - `pingUnits` - The units to use for interval above
329
-
330
- This can be particularly useful for triggering events based on joining or leaving your local network.
331
-
332
- If you want to use this for "arriving" or "leaving" a location, it is not recommended to use a single presence accessory for both. This is because a device such as a phone can connect and disconnect frequently from the network when the screen is off, so the switch will toggle back and forth.
333
-
334
- Instead, it's recommended to choose one and use an auto-reset timer.
335
-
336
- ```json
337
- {
338
- "id": "a52da73e-f854-4a57-b90d-6ba14d8f1d72",
339
- "name": "Home",
340
- "type": "Switch",
341
- "timer": {
342
- "delay": 10,
343
- "units": "MINUTES",
344
- "random": false
345
- },
346
- "conditions": {
347
- "operator": "and",
348
- "operands": [
349
- {
350
- "type": "PING",
351
- "pingHost": "192.168.1.42",
352
- "pingAvailability": "AVAILABLE",
353
- "pingInterval": 15,
354
- "pingUnits": "SECONDS"
355
- }
356
- ]
357
- }
358
- }
359
- ```
360
-
361
- The above example will check every 15 seconds to see if your device is on your network. You can use this to trigger an event soon after you join your network. The switch will only turn off when the device hasn't connected within 10 minutes.
362
-
363
- To trigger an event soon after you leave the network, create a duplicate accessory with `"pingAvailability": "NOT_AVAILBLE"`.
364
-
365
- Note that while MAC Addresses are supported, it is a much more network intensive operation. It is preferred to use a fixed IP address where possible for best performance.
366
-
367
- ## Webhooks
368
-
369
- You can optionally enable webhooks on an accessory by choosing `Enable Webhooks` in the config UI or setting `enableWebhooks` to `true` in the JSON config.
370
-
371
- 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).
372
-
373
- Incoming requests must include the `id` of the accessory. The accessory `id` can be found in the plugin JSON config.
374
-
375
- You can `get`, `set`, or `sync` the value of the accessory. `set` and `sync` commands require a `value` to set.
376
-
377
- Here are the possible values for `get` or `set`/`sync` and their respective valid `value`
378
-
379
- - `Brightness` - number from 0-100
380
- - `LockTargetState` - 0 (UNSECURED) or 1 (SECURED)
381
- - `On` - true or false
382
- - `TargetHeatingCoolingState` - 0 (OFF), 1 (HEAT), 2 (COOL), 3 (AUTO)
383
- - `TargetPosition` - number from 0-100
384
- - `TargetTemperature` - number between 10°C and 38°C
385
-
386
- `sync` is identical to `set` except that no commands are executed. This can be useful for situations where you want to avoid a looping behavior between the dummy accessory and source.
387
-
388
- ### Using GET Requests
389
-
390
- Here is an example to get the on/off state for a switch:
391
-
392
- ```
393
- http://localhost:63743/?id=ACCESSORY_ID&get=On
394
- ```
395
-
396
- Returns `{ "value": false }`
397
-
398
- And here is an example to set the brightness of a lightbulb:
399
-
400
- ```
401
- http://localhost:63743/?id=ACCESSORY_ID&set=Brightness&value=42
402
- ```
403
-
404
- Returns `{ "success": "Accessory Name is on, brightness is 42%" }`
405
-
406
- ### Using POST Requests
407
-
408
- POST requests must be valid JSON. Here is an example of the JSON needed to get the on/off state for a switch:
409
-
410
- ```json
411
- {
412
- "id": "ACCESSORY_ID",
413
- "get": "On"
414
- }
415
- ```
416
-
417
- Here's how you would call it from the command line:
418
-
419
- ```
420
- curl -X POST http://localhost:63743/ -H "Content-Type: application/json" -d '{"id": "ACCESSORY_ID", "get": "On" }
421
- ```
422
-
423
- Here is an example of the JSON needed to set the brightness of a lightbulb:
424
-
425
- ```json
426
- {
427
- "id": "ACCESSORY_ID",
428
- "set": "Brightness",
429
- "value": 42
430
- }
431
- ```
29
+ With this plugin, you can create any number of fake accessories which are useful for advanced automation with HomeKit scenes.
432
30
 
433
- Here's how you would call it from the command line:
31
+ Features include scheduling to trigger at a specific interval or times, resetting automatically after a delay, activating sensors such as motion or occupancy, running arbitrary commands, triggering when certain conditions are met, and more.
434
32
 
435
- ```
436
- curl -X POST http://localhost:63743/ -H "Content-Type: application/json" -d '{"id": "ACCESSORY_ID", "set": "Brightness", "value": 42 }
437
- ```
33
+ Visit the [Wiki](https://github.com/mpatfield/homebridge-dummy/wiki) to learn more about available features.
438
34
 
439
35
  ## Credits
440
36