homebridge-dummy 1.1.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.
- package/CHANGELOG.md +12 -3
- package/README.md +38 -141
- package/config.schema.json +104 -8
- package/dist/accessory/base.d.ts +5 -1
- package/dist/accessory/base.js +8 -5
- package/dist/accessory/base.js.map +1 -1
- package/dist/accessory/group.d.ts +2 -7
- package/dist/accessory/group.js +5 -14
- package/dist/accessory/group.js.map +1 -1
- package/dist/accessory/helpers.d.ts +2 -2
- package/dist/accessory/helpers.js +9 -9
- package/dist/accessory/helpers.js.map +1 -1
- package/dist/accessory/lock.d.ts +6 -2
- package/dist/accessory/lock.js +14 -4
- package/dist/accessory/lock.js.map +1 -1
- package/dist/accessory/onoff/lightbulb.d.ts +6 -3
- package/dist/accessory/onoff/lightbulb.js +15 -9
- package/dist/accessory/onoff/lightbulb.js.map +1 -1
- package/dist/accessory/onoff/onoff.d.ts +3 -1
- package/dist/accessory/onoff/onoff.js +13 -7
- package/dist/accessory/onoff/onoff.js.map +1 -1
- package/dist/accessory/onoff/outlet.d.ts +3 -2
- package/dist/accessory/onoff/outlet.js +1 -1
- package/dist/accessory/onoff/outlet.js.map +1 -1
- package/dist/accessory/onoff/switch.d.ts +3 -2
- package/dist/accessory/onoff/switch.js +1 -1
- package/dist/accessory/onoff/switch.js.map +1 -1
- package/dist/accessory/position/blind.d.ts +3 -2
- package/dist/accessory/position/blind.js +1 -1
- package/dist/accessory/position/blind.js.map +1 -1
- package/dist/accessory/position/door.d.ts +3 -2
- package/dist/accessory/position/door.js +1 -1
- package/dist/accessory/position/door.js.map +1 -1
- package/dist/accessory/position/position.d.ts +3 -0
- package/dist/accessory/position/position.js +14 -3
- package/dist/accessory/position/position.js.map +1 -1
- package/dist/accessory/position/window.d.ts +3 -2
- package/dist/accessory/position/window.js +1 -1
- package/dist/accessory/position/window.js.map +1 -1
- package/dist/accessory/sensor.d.ts +2 -1
- package/dist/accessory/sensor.js +1 -1
- package/dist/accessory/sensor.js.map +1 -1
- package/dist/accessory/thermostat.d.ts +8 -2
- package/dist/accessory/thermostat.js +33 -21
- package/dist/accessory/thermostat.js.map +1 -1
- package/dist/homebridge/platform.d.ts +1 -0
- package/dist/homebridge/platform.js +10 -3
- package/dist/homebridge/platform.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +1 -1
- package/dist/homebridge-ui/public/ui.js +1 -1
- package/dist/i18n/en.d.ts +26 -0
- package/dist/i18n/en.js +36 -10
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/i18n.d.ts +26 -0
- package/dist/i18n/template.d.ts +26 -0
- package/dist/i18n/zz.d.ts +26 -0
- package/dist/model/enums.d.ts +64 -0
- package/dist/model/enums.js +75 -0
- package/dist/model/enums.js.map +1 -0
- package/dist/model/types.d.ts +4 -56
- package/dist/model/types.js +1 -65
- package/dist/model/types.js.map +1 -1
- package/dist/model/webhook.d.ts +27 -0
- package/dist/model/webhook.js +161 -0
- package/dist/model/webhook.js.map +1 -0
- package/dist/timeout/schedule.js +11 -4
- package/dist/timeout/schedule.js.map +1 -1
- package/dist/timeout/timeout.d.ts +1 -1
- package/dist/timeout/timeout.js +1 -1
- package/dist/tools/configMigration.js +1 -1
- package/dist/tools/configMigration.js.map +1 -1
- package/dist/tools/log.d.ts +6 -2
- package/dist/tools/log.js +28 -1
- package/dist/tools/log.js.map +1 -1
- package/dist/tools/temperature.d.ts +1 -1
- package/dist/tools/temperature.js +1 -1
- package/dist/tools/validation.d.ts +1 -3
- package/dist/tools/validation.js +0 -8
- package/dist/tools/validation.js.map +1 -1
- package/package.json +11 -7
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.
|
|
5
|
+
## 1.2.0-beta.0 (2025-09-24)
|
|
6
6
|
|
|
7
7
|
### ‼️ WARNING — Read this if upgrading from v0.9.2 or earlier…
|
|
8
8
|
|
|
9
9
|
Automations and scenes using Homebridge Dummy accessories will need to be reconfigured. After upgrading, you must **RESTART HOMEBRIDGE SERVICE & UI** (not just *RESTART HOMEBRIDGE*). After restarting, open the Homebridge Dummy plugin settings to run the accessory migration helper. Full details [here](https://github.com/mpatfield/homebridge-dummy?tab=readme-ov-file#v10-migration).
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Changed
|
|
12
|
+
- Support for webhooks ([documentation](https://github.com/mpatfield/homebridge-dummy#webhooks))
|
|
13
|
+
- Better field validation in config UI (Thank you, [@justjam2013](https://github.com/sponsors/justjam2013) for teaching me this!)
|
|
14
|
+
- `schedule.cron` now expects an `@` preset or `CRON_CUSTOM` with `schedule.cronCustom` defined.
|
|
15
|
+
- This is backwards compatible so no manual edits are necessary
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Config UI rendering issue when migrating deprecated fields
|
|
19
|
+
|
|
20
|
+
## 1.1.0 (2025-08-14)
|
|
12
21
|
|
|
13
22
|
### Added
|
|
14
23
|
- "Schedule" feature to invoke accessory at a specified interval or times via cron ([#136](https://github.com/mpatfield/homebridge-dummy/issues/136))
|
|
@@ -41,7 +50,7 @@ Automations and scenes using Homebridge Dummy accessories will need to be reconf
|
|
|
41
50
|
- resetOnRestart option for stateful accessories to return to defaults on Homebridge restart
|
|
42
51
|
- Support for Door, Outlet, and Lock Mechanism, Window, and Window Covering
|
|
43
52
|
- Sensor support (CO2, CO, Contact, Leak, Motion, Occupancy, and Smoke)
|
|
44
|
-
- Execute
|
|
53
|
+
- Execute arbitrary commands when accessory state changes
|
|
45
54
|
|
|
46
55
|
## 0.9.2 (2025-06-26)
|
|
47
56
|
|
package/README.md
CHANGED
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
Homebridge plugin to create fake accessories for assisting with advanced Apple HomeKit automations
|
|
11
11
|
|
|
12
12
|
[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
|
|
13
|
-
[](https://plugins.hoobs.org/plugin/homebridge-dummy)
|
|
13
|
+
[](https://plugins.hoobs.org/plugin/homebridge-dummy)\
|
|
14
14
|
[](https://www.npmjs.com/package/homebridge-dummy)
|
|
15
|
-
[](https://www.npmjs.com/package/homebridge-dummy)
|
|
15
|
+
[](https://www.npmjs.com/package/homebridge-dummy)\
|
|
16
|
+
[](https://discord.com/channels/432663330281226270/1406798847279366214)
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
</span>
|
|
18
20
|
|
|
@@ -117,6 +119,7 @@ Using the Homebridge Config UI is the easiest way to set up this plugin. However
|
|
|
117
119
|
"commandOpen": "string",
|
|
118
120
|
"commandClose": "string",
|
|
119
121
|
"commandTemperature": "string",
|
|
122
|
+
"enableWebook": true | false
|
|
120
123
|
"resetOnRestart": true | false,
|
|
121
124
|
"disableLogging": true | false
|
|
122
125
|
}
|
|
@@ -133,7 +136,7 @@ All fields are optional unless noted with an asterisk (*)
|
|
|
133
136
|
- `name`* - The display name for the accessory in HomeKit
|
|
134
137
|
- `type`* - The type of accessory: `Door`, `Lightbulb`, `LockMechanism`, `Outlet`, `Switch`, `Thermostat`, `Window`, or `WindowCovering`
|
|
135
138
|
|
|
136
|
-
- `groupName` -
|
|
139
|
+
- `groupName` - Items sharing the same group name will be collected together in the Home app UI
|
|
137
140
|
- ⚠️ Adding/removing/changing the group name will require you to reconfigure any HomeKit scenes or automations
|
|
138
141
|
|
|
139
142
|
- `timer.delay` — If defined, the switch will automatically toggle after this many milliseconds/seconds/minutes/hours
|
|
@@ -144,7 +147,8 @@ All fields are optional unless noted with an asterisk (*)
|
|
|
144
147
|
- `schedule.interval` — Trigger the accessory after this many milliseconds/seconds/minutes/hours. *Required if `schedule.type` = `INTERVAL`
|
|
145
148
|
- `schedule.units` — The units to use for the interval (`MILLISECONDS`, `SECONDS`, `MINUTES`, or `HOURS`) *Required if `schedule.type` = `INTERVAL`
|
|
146
149
|
- `schedule.random` — If true, the interval will be randomized with a maximum value of `schedule.interval`
|
|
147
|
-
- `schedule.cron` —
|
|
150
|
+
- `schedule.cron` — One of `@secondly`, `@minutely`, `@hourly`, `@daily`, `@weekly`, `@weekdays`, `@weekends`, `@monthly`, `@yearly`, or `CUSTOM_CRON`. *Required if `schedule.type` = `CRON`
|
|
151
|
+
- `schedule.cronCustom` - Custom cron string for triggering the accessory. *Required if `schedule.cron` = `CUSTOM_CRON`
|
|
148
152
|
- See [crontab.guru](http://crontab.guru) for help
|
|
149
153
|
|
|
150
154
|
- `sensor.type` - Optionally attach a sensor that mirrors the state of the parent accessory
|
|
@@ -153,6 +157,8 @@ All fields are optional unless noted with an asterisk (*)
|
|
|
153
157
|
|
|
154
158
|
- `temperatureUnits` - Units to use for thermostats, either 'C' or 'F'
|
|
155
159
|
|
|
160
|
+
- `enableWebook` - Turn on webhooks for this accessory. See [Webhooks](https://github.com/mpatfield/homebridge-dummy#webhooks) section below for details.
|
|
161
|
+
|
|
156
162
|
- `defaultOn` — Initial value. Default _ON_ = true, default _OFF_ = false
|
|
157
163
|
|
|
158
164
|
- `defaultBrightness` — If set, lightbulb will have additional dimmer settings with this default brightness percentage
|
|
@@ -165,11 +171,11 @@ All fields are optional unless noted with an asterisk (*)
|
|
|
165
171
|
|
|
166
172
|
- `defaultTemperature` - The default temperature for the thermostat in `temperatureUnits` defined above
|
|
167
173
|
|
|
168
|
-
- `onCommand` -
|
|
169
|
-
- `offCommand` -
|
|
174
|
+
- `onCommand` - Arbitrary command to execute when lightbulb/outlet/switch/thermostat turns on
|
|
175
|
+
- `offCommand` - Arbitrary command to execute when lightbulb/outlet/switch/thermostat turns off
|
|
170
176
|
|
|
171
|
-
- `lockCommand` -
|
|
172
|
-
- `unlockCommand` -
|
|
177
|
+
- `lockCommand` - Arbitrary command to execute when lock mechanism is locked
|
|
178
|
+
- `unlockCommand` - Arbitrary command to execute when lock mechanism is unlocked
|
|
173
179
|
|
|
174
180
|
- `commandTemperature` - Arbitrary command to execute when temperature changes
|
|
175
181
|
|
|
@@ -177,158 +183,49 @@ All fields are optional unless noted with an asterisk (*)
|
|
|
177
183
|
|
|
178
184
|
- `disableLogging` — If true, state changes will not be logged
|
|
179
185
|
|
|
180
|
-
##
|
|
186
|
+
## Webhooks
|
|
181
187
|
|
|
182
|
-
|
|
183
|
-
```json
|
|
184
|
-
{
|
|
185
|
-
"name": "Stateful",
|
|
186
|
-
"type": "Switch"
|
|
187
|
-
}
|
|
188
|
-
```
|
|
188
|
+
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.
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
```json
|
|
192
|
-
{
|
|
193
|
-
"name": "Timer",
|
|
194
|
-
"type": "Switch",
|
|
195
|
-
"timer": {
|
|
196
|
-
"delay": 10,
|
|
197
|
-
"units": "SECONDS"
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
```
|
|
190
|
+
If at least one accessory has webhooks enabled, then Homebridge Dummy will start a webhook server on startup on port `63743`, e.g. `http://localhost:63743/`
|
|
201
191
|
|
|
202
|
-
|
|
203
|
-
```json
|
|
204
|
-
{
|
|
205
|
-
"name": "Default On",
|
|
206
|
-
"type": "Switch",
|
|
207
|
-
"timer": {
|
|
208
|
-
"delay": 5,
|
|
209
|
-
"units": "SECONDS"
|
|
210
|
-
},
|
|
211
|
-
"defaultOn": true
|
|
212
|
-
}
|
|
213
|
-
```
|
|
192
|
+
Incoming requests must be valid JSON and include the id of the accessory, the desired command, and the value to set.
|
|
214
193
|
|
|
215
|
-
|
|
216
|
-
```json
|
|
217
|
-
{
|
|
218
|
-
"name": "Lightbulb",
|
|
219
|
-
"type": "Lightbulb",
|
|
220
|
-
"timer": {
|
|
221
|
-
"delay": 5,
|
|
222
|
-
"units": "SECONDS"
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
```
|
|
194
|
+
For example, to turn a switch on the JSON request should look like this:
|
|
226
195
|
|
|
227
|
-
### Stateful Dimmer Lightbulb
|
|
228
196
|
```json
|
|
229
197
|
{
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
198
|
+
"id": "17a62a7b",
|
|
199
|
+
"command": "On",
|
|
200
|
+
"value": true
|
|
233
201
|
}
|
|
234
202
|
```
|
|
235
203
|
|
|
236
|
-
|
|
237
|
-
```json
|
|
238
|
-
{
|
|
239
|
-
"name": "Random",
|
|
240
|
-
"type": "Switch",
|
|
241
|
-
"timer": {
|
|
242
|
-
"delay": 2,
|
|
243
|
-
"units": "MINUTES",
|
|
244
|
-
"random": true
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
```
|
|
204
|
+
Here's how you would call it from the command line.
|
|
248
205
|
|
|
249
|
-
### Lock
|
|
250
|
-
```json
|
|
251
|
-
{
|
|
252
|
-
"name": "Lock",
|
|
253
|
-
"type": "LockMechanism",
|
|
254
|
-
"timer": {
|
|
255
|
-
"delay": 10,
|
|
256
|
-
"units": "MINUTES"
|
|
257
|
-
},
|
|
258
|
-
"defaultLockState": "locked"
|
|
259
|
-
}
|
|
260
206
|
```
|
|
261
|
-
|
|
262
|
-
### Motion Sensor Switch
|
|
263
|
-
```json
|
|
264
|
-
{
|
|
265
|
-
"name": "Motion Switch",
|
|
266
|
-
"type": "Switch",
|
|
267
|
-
"timer": {
|
|
268
|
-
"delay": 3,
|
|
269
|
-
"units": "MINUTES"
|
|
270
|
-
},
|
|
271
|
-
"sensor": "MotionSensor"
|
|
272
|
-
}
|
|
207
|
+
curl -X POST http://localhost:63743/ -H "Content-Type: application/json" -d '{"id": "17a62a7b", "command": "On", "value": true}
|
|
273
208
|
```
|
|
274
209
|
|
|
275
|
-
|
|
276
|
-
```json
|
|
277
|
-
{
|
|
278
|
-
"name": "Door",
|
|
279
|
-
"type": "Door",
|
|
280
|
-
"timer": {
|
|
281
|
-
"delay": 20,
|
|
282
|
-
"units": "SECONDS"
|
|
283
|
-
},
|
|
284
|
-
"defaultPosition": "closed"
|
|
285
|
-
}
|
|
286
|
-
```
|
|
210
|
+
The accessory `id` can be found in the plugin JSON config.
|
|
287
211
|
|
|
288
|
-
|
|
289
|
-
```json
|
|
290
|
-
{
|
|
291
|
-
"name": "Outlet 1",
|
|
292
|
-
"type": "Outlet",
|
|
293
|
-
"groupName": "Powerstrip"
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"name": "Outlet 2",
|
|
297
|
-
"type": "Outlet",
|
|
298
|
-
"groupName": "Powerstrip"
|
|
299
|
-
}
|
|
300
|
-
{
|
|
301
|
-
"name": "Outlet 3",
|
|
302
|
-
"type": "Outlet",
|
|
303
|
-
"groupName": "Powerstrip"
|
|
304
|
-
}
|
|
305
|
-
```
|
|
212
|
+
Here are the possible values for `command` and their respective valid `value`
|
|
306
213
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
"schedule": {
|
|
317
|
-
"type": "INTERVAL",
|
|
318
|
-
"interval": 1,
|
|
319
|
-
"units": "HOURS"
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
```
|
|
214
|
+
- `Brightness` - number from 0-100
|
|
215
|
+
- `LockTargetState` - 0 (UNSECURED) or 1 (SECURED)
|
|
216
|
+
- `On` - true or false
|
|
217
|
+
- `TargetHeatingCoolingState` - 0 (OFF), 1 (HEAT), 2 (COOL), 3 (AUTO)
|
|
218
|
+
- `TargetPosition` - number from 0-100
|
|
219
|
+
- `TargetTemperature` - number between 10°C and 38°C
|
|
220
|
+
|
|
221
|
+
For `TargetTemperature` you may optionally supply a `unit` (either 'F' or 'C') to allow you to pass in Fahrenheit or Celsius units.
|
|
323
222
|
|
|
324
|
-
### Thermostat
|
|
325
223
|
```json
|
|
326
224
|
{
|
|
327
|
-
"
|
|
328
|
-
"
|
|
329
|
-
"
|
|
330
|
-
"
|
|
331
|
-
"defaultTemperature": 78
|
|
225
|
+
"id": "18a35b6c",
|
|
226
|
+
"command": "TargetTemperature",
|
|
227
|
+
"value": 72,
|
|
228
|
+
"unit": "F"
|
|
332
229
|
}
|
|
333
230
|
```
|
|
334
231
|
|
package/config.schema.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"schema": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"definitions": {
|
|
10
|
-
|
|
10
|
+
"units": {
|
|
11
11
|
"type": "string",
|
|
12
12
|
"title": "${config.title.units}",
|
|
13
13
|
"enum": [ "MILLISECONDS", "SECONDS", "MINUTES", "HOURS"],
|
|
@@ -43,7 +43,33 @@
|
|
|
43
43
|
"title": "${config.title.random}",
|
|
44
44
|
"description": "${config.description.random}"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"allOf": [
|
|
48
|
+
{
|
|
49
|
+
"if": {
|
|
50
|
+
"properties": {
|
|
51
|
+
"delay": {
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"required": ["delay"]
|
|
55
|
+
},
|
|
56
|
+
"then": {
|
|
57
|
+
"required": ["units"]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"if": {
|
|
62
|
+
"properties": {
|
|
63
|
+
"units" : {
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": [ "units" ]
|
|
67
|
+
},
|
|
68
|
+
"then": {
|
|
69
|
+
"required": [ "delay"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
47
73
|
},
|
|
48
74
|
"schedule": {
|
|
49
75
|
"type": "object",
|
|
@@ -67,12 +93,56 @@
|
|
|
67
93
|
},
|
|
68
94
|
"cron": {
|
|
69
95
|
"type": "string",
|
|
70
|
-
"title": "${config.title.
|
|
71
|
-
"
|
|
96
|
+
"title": "${config.title.preset}",
|
|
97
|
+
"enum": [ "@secondly", "@minutely", "@hourly", "@daily", "@weekly", "@weekdays", "@weekends", "@monthly", "@yearly", "CRON_CUSTOM"],
|
|
98
|
+
"enumNames": ["${config.enumNames.secondly}", "${config.enumNames.minutely}", "${config.enumNames.hourly}", "${config.enumNames.daily}", "${config.enumNames.weekly}", "${config.enumNames.weekdays}", "${config.enumNames.weekends}", "${config.enumNames.monthly}", "${config.enumNames.yearly}", "${config.enumNames.custom}"]
|
|
99
|
+
},
|
|
100
|
+
"cronCustom": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"title": "${config.title.cronCustom}",
|
|
72
103
|
"placeholder": "* * * * * *",
|
|
73
|
-
"
|
|
104
|
+
"pattern": "(^((\\*\\/)?([0-5]?[0-9])((,|-|\\/)([0-5]?[0-9]))*|\\*)\\s((\\*\\/)?((2[0-3]|1[0-9]|[0-9]|00))((,|-|\\/)(2[0-3]|1[0-9]|[0-9]|00))*|\\*)\\s((\\*\\/)?([1-9]|[12][0-9]|3[01])((,|-|\\/)([1-9]|[12][0-9]|3[01]))*|\\*)\\s((\\*\\/)?([1-9]|1[0-2])((,|-|\\/)([1-9]|1[0-2]))*|\\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))\\s((\\*\\/)?[0-6]((,|-|\\/)[0-6])*|\\*|00|(sun|mon|tue|wed|thu|fri|sat))$)"
|
|
74
105
|
}
|
|
75
|
-
}
|
|
106
|
+
},
|
|
107
|
+
"allOf": [
|
|
108
|
+
{
|
|
109
|
+
"if": {
|
|
110
|
+
"properties": {
|
|
111
|
+
"type": {
|
|
112
|
+
"const": "INTERVAL"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"then": {
|
|
117
|
+
"required": ["interval", "units"]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"if": {
|
|
122
|
+
"properties": {
|
|
123
|
+
"type": {
|
|
124
|
+
"const": "CRON"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"then": {
|
|
129
|
+
"required": ["cron"]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"if": {
|
|
134
|
+
"required": ["cron"],
|
|
135
|
+
"properties": {
|
|
136
|
+
"cron": {
|
|
137
|
+
"const": "CRON_CUSTOM"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"then": {
|
|
142
|
+
"required": ["cronCustom"]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
]
|
|
76
146
|
}
|
|
77
147
|
},
|
|
78
148
|
"properties": {
|
|
@@ -178,12 +248,19 @@
|
|
|
178
248
|
"type": "boolean",
|
|
179
249
|
"title": "${config.title.resetOnRestart}"
|
|
180
250
|
},
|
|
251
|
+
"enableWebook": {
|
|
252
|
+
"type": "boolean",
|
|
253
|
+
"title": "${config.title.enableWebook}"
|
|
254
|
+
},
|
|
181
255
|
"disableLogging": {
|
|
182
256
|
"type": "boolean",
|
|
183
257
|
"title": "${config.title.disableLogging}"
|
|
184
258
|
}
|
|
185
259
|
}
|
|
186
260
|
}
|
|
261
|
+
},
|
|
262
|
+
"verbose": {
|
|
263
|
+
"type": "boolean"
|
|
187
264
|
}
|
|
188
265
|
}
|
|
189
266
|
},
|
|
@@ -312,6 +389,10 @@
|
|
|
312
389
|
"displayFlex": true,
|
|
313
390
|
"flex-direction": "row",
|
|
314
391
|
"items": [
|
|
392
|
+
{
|
|
393
|
+
"key": "accessories[].enableWebook",
|
|
394
|
+
"flex": "0 1 33%"
|
|
395
|
+
},
|
|
315
396
|
{
|
|
316
397
|
"key": "accessories[].disableLogging",
|
|
317
398
|
"flex": "0 1 33%"
|
|
@@ -361,10 +442,25 @@
|
|
|
361
442
|
]
|
|
362
443
|
},
|
|
363
444
|
{
|
|
364
|
-
"
|
|
445
|
+
"type": "div",
|
|
446
|
+
"displayFlex": true,
|
|
447
|
+
"flex-direction": "row",
|
|
365
448
|
"condition": {
|
|
366
449
|
"functionBody": "return model.accessories?.[arguments[1]]?.schedule?.type === 'CRON';"
|
|
367
|
-
}
|
|
450
|
+
},
|
|
451
|
+
"items": [
|
|
452
|
+
{
|
|
453
|
+
"key": "accessories[].schedule.cron",
|
|
454
|
+
"flex": "1 1 33%"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"key": "accessories[].schedule.cronCustom",
|
|
458
|
+
"flex": "1 1 67%",
|
|
459
|
+
"condition": {
|
|
460
|
+
"functionBody": "return model.accessories?.[arguments[1]]?.schedule?.cron === 'CRON_CUSTOM';"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
]
|
|
368
464
|
},
|
|
369
465
|
{
|
|
370
466
|
"key": "accessories[].schedule.random",
|
package/dist/accessory/base.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PlatformAccessory, Service } from 'homebridge';
|
|
2
2
|
import { SensorAccessory } from './sensor.js';
|
|
3
|
-
import { AccessoryType
|
|
3
|
+
import { AccessoryType } from '../model/enums.js';
|
|
4
|
+
import { CharacteristicType, DummyConfig, ServiceType } from '../model/types.js';
|
|
5
|
+
import { Webhook } from '../model/webhook.js';
|
|
4
6
|
import { Log } from '../tools/log.js';
|
|
5
7
|
export declare abstract class DummyAccessory<C extends DummyConfig> {
|
|
6
8
|
protected readonly Service: ServiceType;
|
|
@@ -20,7 +22,9 @@ export declare abstract class DummyAccessory<C extends DummyConfig> {
|
|
|
20
22
|
protected abstract reset(): Promise<void>;
|
|
21
23
|
get subtype(): string | undefined;
|
|
22
24
|
teardown(): void;
|
|
25
|
+
abstract webhooks(): Webhook[];
|
|
23
26
|
protected get identifier(): string;
|
|
27
|
+
protected get name(): string;
|
|
24
28
|
protected get isStateful(): boolean;
|
|
25
29
|
protected get defaultStateStorageKey(): string;
|
|
26
30
|
protected startTimer(): void;
|
package/dist/accessory/base.js
CHANGED
|
@@ -2,7 +2,7 @@ import { exec } from 'child_process';
|
|
|
2
2
|
import { PLATFORM_NAME, PLUGIN_ALIAS } from '../homebridge/settings.js';
|
|
3
3
|
import { SensorAccessory } from './sensor.js';
|
|
4
4
|
import { strings } from '../i18n/i18n.js';
|
|
5
|
-
import { AccessoryType } from '../model/
|
|
5
|
+
import { AccessoryType } from '../model/enums.js';
|
|
6
6
|
import { Schedule } from '../timeout/schedule.js';
|
|
7
7
|
import { Timer } from '../timeout/timer.js';
|
|
8
8
|
import { STORAGE_KEY_SUFFIX_DEFAULT_STATE } from '../tools/storage.js';
|
|
@@ -28,7 +28,7 @@ export class DummyAccessory {
|
|
|
28
28
|
this.config = config;
|
|
29
29
|
this.log = log;
|
|
30
30
|
this.persistPath = persistPath;
|
|
31
|
-
this.sensor = SensorAccessory.new(Service, Characteristic, accessory, this.
|
|
31
|
+
this.sensor = SensorAccessory.new(Service, Characteristic, accessory, this.name, log, this.config.disableLogging === true, config.sensor);
|
|
32
32
|
if (config.timer) {
|
|
33
33
|
this._timer = Timer.new(config.timer, config.name, log, config.disableLogging === true);
|
|
34
34
|
}
|
|
@@ -70,6 +70,9 @@ export class DummyAccessory {
|
|
|
70
70
|
get identifier() {
|
|
71
71
|
return DummyAccessory.identifier(this.config);
|
|
72
72
|
}
|
|
73
|
+
get name() {
|
|
74
|
+
return this.config.name;
|
|
75
|
+
}
|
|
73
76
|
get isStateful() {
|
|
74
77
|
return this._timer === undefined && this._schedule === undefined && !this.config.resetOnRestart;
|
|
75
78
|
}
|
|
@@ -85,10 +88,10 @@ export class DummyAccessory {
|
|
|
85
88
|
executeCommand(command) {
|
|
86
89
|
exec(command, (_error, stdout, stderr) => {
|
|
87
90
|
if (stderr) {
|
|
88
|
-
this.log.error(`${strings.accessory.command.error}: %s\n%s`, this.
|
|
91
|
+
this.log.error(`${strings.accessory.command.error}: %s\n%s`, this.name, command, stderr);
|
|
89
92
|
}
|
|
90
93
|
else {
|
|
91
|
-
this.logIfDesired(`${strings.accessory.command.executed}: %s\n%s`, this.
|
|
94
|
+
this.logIfDesired(`${strings.accessory.command.executed}: %s\n%s`, this.name, command, stdout);
|
|
92
95
|
}
|
|
93
96
|
});
|
|
94
97
|
}
|
|
@@ -96,7 +99,7 @@ export class DummyAccessory {
|
|
|
96
99
|
if (this.config.disableLogging) {
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
99
|
-
this.log.always(message, ...parameters);
|
|
102
|
+
this.log.always(message, this.name, ...parameters);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/accessory/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/accessory/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAE7C,MAAM,OAAgB,cAAc;IAcb;IACA;IACA;IACA;IACA;IACA;IAjBX,MAAM,CAAmB;IAE5B,MAAM,CAAC,UAAU,CAAC,MAAmB;QAC1C,OAAO,M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AM,CAAC,CAAC;YAC3F,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACjG,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAES,YAAY,CAAC,OAAe,EAAE,GAAG,UAA+B;QAExE,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,15 +1,10 @@
|
|
|
1
1
|
import { PlatformAccessory } from 'homebridge';
|
|
2
2
|
import { CharacteristicType, GroupConfig, ServiceType } from '../model/types.js';
|
|
3
|
+
import { WebhookManager } from '../model/webhook.js';
|
|
3
4
|
import { Log } from '../tools/log.js';
|
|
4
5
|
export declare class GroupAccessory {
|
|
5
|
-
protected readonly Service: ServiceType;
|
|
6
|
-
protected readonly Characteristic: CharacteristicType;
|
|
7
|
-
protected readonly accessory: PlatformAccessory;
|
|
8
|
-
protected readonly config: GroupConfig;
|
|
9
|
-
protected readonly log: Log;
|
|
10
|
-
protected readonly persistPath: string;
|
|
11
6
|
static identifier(groupName: string): string;
|
|
12
7
|
private readonly accessories;
|
|
13
|
-
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: GroupConfig, log: Log, persistPath: string);
|
|
8
|
+
constructor(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: GroupConfig, log: Log, persistPath: string, webhookManager: WebhookManager);
|
|
14
9
|
teardown(): void;
|
|
15
10
|
}
|
package/dist/accessory/group.js
CHANGED
|
@@ -2,23 +2,11 @@ import { createDummyAccessory } from './helpers.js';
|
|
|
2
2
|
import { PLATFORM_NAME, PLUGIN_ALIAS } from '../homebridge/settings.js';
|
|
3
3
|
import getVersion from '../tools/version.js';
|
|
4
4
|
export class GroupAccessory {
|
|
5
|
-
Service;
|
|
6
|
-
Characteristic;
|
|
7
|
-
accessory;
|
|
8
|
-
config;
|
|
9
|
-
log;
|
|
10
|
-
persistPath;
|
|
11
5
|
static identifier(groupName) {
|
|
12
6
|
return `${PLATFORM_NAME}:Group:${groupName.replace(/\s+/g, '')})}`;
|
|
13
7
|
}
|
|
14
8
|
accessories = [];
|
|
15
|
-
constructor(Service, Characteristic, accessory, config, log, persistPath) {
|
|
16
|
-
this.Service = Service;
|
|
17
|
-
this.Characteristic = Characteristic;
|
|
18
|
-
this.accessory = accessory;
|
|
19
|
-
this.config = config;
|
|
20
|
-
this.log = log;
|
|
21
|
-
this.persistPath = persistPath;
|
|
9
|
+
constructor(Service, Characteristic, accessory, config, log, persistPath, webhookManager) {
|
|
22
10
|
accessory.getService(Service.AccessoryInformation)
|
|
23
11
|
.setCharacteristic(Characteristic.Manufacturer, PLUGIN_ALIAS)
|
|
24
12
|
.setCharacteristic(Characteristic.Model, GroupAccessory.name)
|
|
@@ -26,10 +14,13 @@ export class GroupAccessory {
|
|
|
26
14
|
.setCharacteristic(Characteristic.FirmwareRevision, getVersion());
|
|
27
15
|
const keepSubtypes = new Set();
|
|
28
16
|
for (const dummyConfig of config.accessories) {
|
|
29
|
-
const dummyAccessory = createDummyAccessory(
|
|
17
|
+
const dummyAccessory = createDummyAccessory(Service, Characteristic, accessory, dummyConfig, log, persistPath, true);
|
|
30
18
|
if (!dummyAccessory) {
|
|
31
19
|
continue;
|
|
32
20
|
}
|
|
21
|
+
if (dummyConfig.enableWebook) {
|
|
22
|
+
webhookManager.registerAccessory(dummyAccessory);
|
|
23
|
+
}
|
|
33
24
|
keepSubtypes.add(dummyAccessory.subtype);
|
|
34
25
|
this.accessories.push(dummyAccessory);
|
|
35
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/accessory/group.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/accessory/group.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAE7C,MAAM,OAAO,cAAc;IAElB,MAAM,CAAC,UAAU,CAAC,SAAiB;QACxC,OAAO,GAAG,aAAa,UAAU,SAAS,CAAC,OAAO,CAAC,MAAM,EAAC,EAAE,CAAC,IAAI,CAAC;IACpE,CAAC;IAEgB,WAAW,GAAoC,EAAE,CAAC;IAEnE,YACE,OAAoB,EACpB,cAAkC,EAClC,SAA4B,EAC5B,MAAmB,EACnB,GAAQ,EACR,WAAmB,EACnB,cAA8B;QAG9B,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAE;aAChD,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC;aAC5D,iBAAiB,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC;aAC5D,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC;aAC9D,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;QAEpE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;QAEvC,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YAE7C,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;YACrH,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,SAAS;YACX,CAAC;YAED,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC;gBAC7B,cAAc,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;YACnD,CAAC;YAED,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,OAAQ,CAAC,CAAC;YAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC;QAAA,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9C,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1D,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,WAAW,CAAC,OAAO,CAAE,SAAS,CAAC,EAAE;YACpC,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlatformAccessory } from 'homebridge';
|
|
2
2
|
import { DummyAccessory } from './base.js';
|
|
3
|
-
import
|
|
3
|
+
import { CharacteristicType, DummyConfig, ServiceType } from '../model/types.js';
|
|
4
4
|
import { Log } from '../tools/log.js';
|
|
5
|
-
export declare function createDummyAccessory(Service:
|
|
5
|
+
export declare function createDummyAccessory(Service: ServiceType, Characteristic: CharacteristicType, accessory: PlatformAccessory, config: DummyConfig, log: Log, persistPath: string, isGrouped?: boolean): DummyAccessory<DummyConfig> | null;
|
|
@@ -7,24 +7,24 @@ import { SwitchAccessory } from './onoff/switch.js';
|
|
|
7
7
|
import { ThermostatAccessory } from './thermostat.js';
|
|
8
8
|
import { WindowAccessory } from './position/window.js';
|
|
9
9
|
import { strings } from '../i18n/i18n.js';
|
|
10
|
-
import
|
|
10
|
+
import { AccessoryType } from '../model/enums.js';
|
|
11
11
|
export function createDummyAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped = false) {
|
|
12
12
|
switch (config.type) {
|
|
13
|
-
case
|
|
13
|
+
case AccessoryType.Door:
|
|
14
14
|
return new DoorAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
15
|
-
case
|
|
15
|
+
case AccessoryType.Lightbulb:
|
|
16
16
|
return new LightbulbAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
17
|
-
case
|
|
17
|
+
case AccessoryType.LockMechanism:
|
|
18
18
|
return new LockAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
19
|
-
case
|
|
19
|
+
case AccessoryType.Outlet:
|
|
20
20
|
return new OutletAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
21
|
-
case
|
|
21
|
+
case AccessoryType.Switch:
|
|
22
22
|
return new SwitchAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
23
|
-
case
|
|
23
|
+
case AccessoryType.Thermostat:
|
|
24
24
|
return new ThermostatAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
25
|
-
case
|
|
25
|
+
case AccessoryType.Window:
|
|
26
26
|
return new WindowAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
27
|
-
case
|
|
27
|
+
case AccessoryType.WindowCovering:
|
|
28
28
|
return new BlindAccessory(Service, Characteristic, accessory, config, log, persistPath, isGrouped);
|
|
29
29
|
default:
|
|
30
30
|
log.error(strings.startup.unsupportedType, `'${config.type}'`);
|