homebridge-dummy 1.2.0 → 1.3.0-beta.1
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 +13 -5
- package/README.md +61 -24
- package/config.schema.json +92 -0
- package/dist/accessory/base.d.ts +2 -2
- package/dist/accessory/base.js +12 -7
- package/dist/accessory/base.js.map +1 -1
- package/dist/accessory/group.d.ts +1 -1
- package/dist/accessory/group.js +2 -2
- package/dist/accessory/group.js.map +1 -1
- package/dist/accessory/helpers.d.ts +1 -1
- package/dist/accessory/helpers.js +9 -9
- package/dist/accessory/helpers.js.map +1 -1
- package/dist/accessory/lock.d.ts +1 -1
- package/dist/accessory/lock.js +22 -16
- package/dist/accessory/lock.js.map +1 -1
- package/dist/accessory/onoff/lightbulb.d.ts +1 -1
- package/dist/accessory/onoff/lightbulb.js +16 -11
- package/dist/accessory/onoff/lightbulb.js.map +1 -1
- package/dist/accessory/onoff/onoff.d.ts +1 -1
- package/dist/accessory/onoff/onoff.js +17 -14
- package/dist/accessory/onoff/onoff.js.map +1 -1
- package/dist/accessory/position/position.d.ts +1 -1
- package/dist/accessory/position/position.js +22 -16
- package/dist/accessory/position/position.js.map +1 -1
- package/dist/accessory/sensor.d.ts +0 -1
- package/dist/accessory/sensor.js +6 -4
- package/dist/accessory/sensor.js.map +1 -1
- package/dist/accessory/thermostat.d.ts +1 -1
- package/dist/accessory/thermostat.js +33 -20
- package/dist/accessory/thermostat.js.map +1 -1
- package/dist/homebridge/platform.js +4 -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 +94 -67
- package/dist/i18n/en.js +94 -67
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/i18n.d.ts +95 -69
- package/dist/i18n/i18n.js +0 -6
- package/dist/i18n/i18n.js.map +1 -1
- package/dist/i18n/template.d.ts +96 -69
- package/dist/i18n/template.js +2 -2
- package/dist/i18n/template.js.map +1 -1
- package/dist/model/enums.d.ts +17 -2
- package/dist/model/enums.js +30 -2
- package/dist/model/enums.js.map +1 -1
- package/dist/model/types.d.ts +8 -1
- package/dist/model/webhook.js +6 -1
- package/dist/model/webhook.js.map +1 -1
- package/dist/timeout/limiter.d.ts +18 -0
- package/dist/timeout/limiter.js +147 -0
- package/dist/timeout/limiter.js.map +1 -0
- package/dist/timeout/schedule.d.ts +0 -1
- package/dist/timeout/schedule.js +11 -6
- package/dist/timeout/schedule.js.map +1 -1
- package/dist/timeout/timeout.d.ts +6 -2
- package/dist/timeout/timeout.js +62 -58
- package/dist/timeout/timeout.js.map +1 -1
- package/dist/timeout/timer.d.ts +1 -1
- package/dist/timeout/timer.js +13 -5
- package/dist/timeout/timer.js.map +1 -1
- package/dist/tools/storage.d.ts +14 -5
- package/dist/tools/storage.js +35 -20
- package/dist/tools/storage.js.map +1 -1
- package/package.json +4 -8
- package/dist/i18n/zz.d.ts +0 -206
- package/dist/i18n/zz.js +0 -6
- package/dist/i18n/zz.js.map +0 -1
package/dist/tools/storage.js
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
import storage from 'node-persist';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const BUCKET_KEY = 'Storage.bucket';
|
|
3
|
+
export async function storageGet_Deprecated(key) {
|
|
4
|
+
if (!Storage.has(key)) {
|
|
5
|
+
const storable = await storage.get(key);
|
|
6
|
+
if (storable) {
|
|
7
|
+
await Storage.set(key, storable);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return Storage.get(key);
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
await init(dir);
|
|
12
|
-
|
|
12
|
+
export class Storage {
|
|
13
|
+
static bucket = new Map();
|
|
14
|
+
static async init(persistPath) {
|
|
15
|
+
await storage.init({ dir: persistPath, forgiveParseErrors: true });
|
|
16
|
+
const bucketJson = await storage.get(BUCKET_KEY);
|
|
17
|
+
if (bucketJson === undefined) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const bucketArray = JSON.parse(bucketJson);
|
|
22
|
+
for (const entry of bucketArray) {
|
|
23
|
+
Storage.bucket.set(entry[0], entry[1]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// ignore
|
|
28
|
+
}
|
|
13
29
|
}
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
static has(key) {
|
|
31
|
+
return Storage.bucket.has(key);
|
|
16
32
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export async function storageSet(dir, key, value) {
|
|
20
|
-
try {
|
|
21
|
-
await init(dir);
|
|
22
|
-
storage.set(key, value);
|
|
33
|
+
static get(key) {
|
|
34
|
+
return Storage.bucket.get(key);
|
|
23
35
|
}
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
static async set(key, storable) {
|
|
37
|
+
Storage.bucket.set(key, storable);
|
|
38
|
+
const bucketArray = Array.from(Storage.bucket.entries());
|
|
39
|
+
const bucketJson = JSON.stringify(bucketArray);
|
|
40
|
+
await storage.set(BUCKET_KEY, bucketJson);
|
|
26
41
|
}
|
|
27
42
|
}
|
|
28
43
|
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/tools/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/tools/storage.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,cAAc,CAAC;AAKnC,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAW;IAErD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,Q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,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAElC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "homebridge-dummy",
|
|
3
3
|
"platform": "HomebridgeDummy",
|
|
4
4
|
"displayName": "Homebridge Dummy",
|
|
5
|
-
"description": "Create
|
|
5
|
+
"description": "Create Homebridge accessories to help with automation and control — scheduling, delays, sensors, commands, webhooks, and more",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.3.0-beta.1",
|
|
8
8
|
"homepage": "https://github.com/mpatfield/homebridge-dummy#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -36,18 +36,14 @@
|
|
|
36
36
|
"automation",
|
|
37
37
|
"timer",
|
|
38
38
|
"delay",
|
|
39
|
-
"delay-switch",
|
|
40
39
|
"reset",
|
|
41
40
|
"schedule",
|
|
42
41
|
"command",
|
|
43
42
|
"cmd",
|
|
44
43
|
"cmdtrigger",
|
|
45
44
|
"http",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"contact",
|
|
49
|
-
"leak",
|
|
50
|
-
"occupancy"
|
|
45
|
+
"webhook",
|
|
46
|
+
"sensor"
|
|
51
47
|
],
|
|
52
48
|
"engines": {
|
|
53
49
|
"homebridge": "^1.8.0 || ^2.0.0-beta.0",
|
package/dist/i18n/zz.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
declare const zz: {
|
|
2
|
-
accessory: {
|
|
3
|
-
invalidCron: string;
|
|
4
|
-
missingRequired: string;
|
|
5
|
-
badValueType: string;
|
|
6
|
-
command: {
|
|
7
|
-
executed: string;
|
|
8
|
-
error: string;
|
|
9
|
-
};
|
|
10
|
-
lightbulb: {
|
|
11
|
-
brightness: string;
|
|
12
|
-
stateOn: string;
|
|
13
|
-
};
|
|
14
|
-
lock: {
|
|
15
|
-
secured: string;
|
|
16
|
-
unsecured: string;
|
|
17
|
-
};
|
|
18
|
-
onOff: {
|
|
19
|
-
stateOn: string;
|
|
20
|
-
stateOff: string;
|
|
21
|
-
};
|
|
22
|
-
position: {
|
|
23
|
-
closed: string;
|
|
24
|
-
open: string;
|
|
25
|
-
};
|
|
26
|
-
thermostat: {
|
|
27
|
-
auto: string;
|
|
28
|
-
cool: string;
|
|
29
|
-
heat: string;
|
|
30
|
-
off: string;
|
|
31
|
-
temperatureC: string;
|
|
32
|
-
temperatureF: string;
|
|
33
|
-
unsupportedFunction: string;
|
|
34
|
-
};
|
|
35
|
-
timer: {
|
|
36
|
-
cancel: string;
|
|
37
|
-
setMilliseconds: string;
|
|
38
|
-
setSeconds: string;
|
|
39
|
-
setMinutes: string;
|
|
40
|
-
setHours: string;
|
|
41
|
-
};
|
|
42
|
-
schedule: {
|
|
43
|
-
cron: string;
|
|
44
|
-
intervalMilliseconds: string;
|
|
45
|
-
intervalSeconds: string;
|
|
46
|
-
intervalMinutes: string;
|
|
47
|
-
intervalHours: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
config: {
|
|
51
|
-
migrate: string;
|
|
52
|
-
migrationDetails1: string;
|
|
53
|
-
migrationDetails2: string;
|
|
54
|
-
migrationDetails3: string;
|
|
55
|
-
migrationDetails4: string;
|
|
56
|
-
migrationDetails5: string;
|
|
57
|
-
migrationRestartTitle: string;
|
|
58
|
-
migrationRestartDescription: string;
|
|
59
|
-
support: string;
|
|
60
|
-
thankYou: string;
|
|
61
|
-
yes: string;
|
|
62
|
-
no: string;
|
|
63
|
-
description: {
|
|
64
|
-
commands: string;
|
|
65
|
-
cron: string;
|
|
66
|
-
random: string;
|
|
67
|
-
timerControlled: string;
|
|
68
|
-
timer: string;
|
|
69
|
-
schedule: string;
|
|
70
|
-
};
|
|
71
|
-
enumNames: {
|
|
72
|
-
auto: string;
|
|
73
|
-
carbonDioxideSensor: string;
|
|
74
|
-
carbonMonoxideSensor: string;
|
|
75
|
-
celsius: string;
|
|
76
|
-
closed: string;
|
|
77
|
-
contactSensor: string;
|
|
78
|
-
cool: string;
|
|
79
|
-
cron: string;
|
|
80
|
-
custom: string;
|
|
81
|
-
daily: string;
|
|
82
|
-
door: string;
|
|
83
|
-
fahrenheit: string;
|
|
84
|
-
heat: string;
|
|
85
|
-
hourly: string;
|
|
86
|
-
hours: string;
|
|
87
|
-
interval: string;
|
|
88
|
-
leakSensor: string;
|
|
89
|
-
lightbulb: string;
|
|
90
|
-
lockMechanism: string;
|
|
91
|
-
minutely: string;
|
|
92
|
-
monthly: string;
|
|
93
|
-
off: string;
|
|
94
|
-
occupancySensor: string;
|
|
95
|
-
on: string;
|
|
96
|
-
open: string;
|
|
97
|
-
outlet: string;
|
|
98
|
-
milliseconds: string;
|
|
99
|
-
minutes: string;
|
|
100
|
-
motionSensor: string;
|
|
101
|
-
secondly: string;
|
|
102
|
-
seconds: string;
|
|
103
|
-
secured: string;
|
|
104
|
-
smokeSensor: string;
|
|
105
|
-
switch: string;
|
|
106
|
-
thermostat: string;
|
|
107
|
-
unsecured: string;
|
|
108
|
-
weekdays: string;
|
|
109
|
-
weekends: string;
|
|
110
|
-
weekly: string;
|
|
111
|
-
window: string;
|
|
112
|
-
windowCovering: string;
|
|
113
|
-
yearly: string;
|
|
114
|
-
};
|
|
115
|
-
title: {
|
|
116
|
-
accessory: string;
|
|
117
|
-
commands: string;
|
|
118
|
-
commandClose: string;
|
|
119
|
-
commandOn: string;
|
|
120
|
-
commandOff: string;
|
|
121
|
-
commandOpen: string;
|
|
122
|
-
commandLock: string;
|
|
123
|
-
commandUnlock: string;
|
|
124
|
-
commandTemperature: string;
|
|
125
|
-
cron: string;
|
|
126
|
-
cronCustom: string;
|
|
127
|
-
defaultBrightness: string;
|
|
128
|
-
defaultPosition: string;
|
|
129
|
-
defaultState: string;
|
|
130
|
-
defaultTemperature: string;
|
|
131
|
-
delay: string;
|
|
132
|
-
disableLogging: string;
|
|
133
|
-
enableWebook: string;
|
|
134
|
-
groupName: string;
|
|
135
|
-
interval: string;
|
|
136
|
-
name: string;
|
|
137
|
-
preset: string;
|
|
138
|
-
resetOnRestart: string;
|
|
139
|
-
timer: string;
|
|
140
|
-
timerControlled: string;
|
|
141
|
-
schedule: string;
|
|
142
|
-
sensor: string;
|
|
143
|
-
type: string;
|
|
144
|
-
units: string;
|
|
145
|
-
random: string;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
sensor: {
|
|
149
|
-
carbonDioxide: {
|
|
150
|
-
active: string;
|
|
151
|
-
inactive: string;
|
|
152
|
-
};
|
|
153
|
-
carbonMonoxide: {
|
|
154
|
-
active: string;
|
|
155
|
-
inactive: string;
|
|
156
|
-
};
|
|
157
|
-
contact: {
|
|
158
|
-
active: string;
|
|
159
|
-
inactive: string;
|
|
160
|
-
};
|
|
161
|
-
leak: {
|
|
162
|
-
active: string;
|
|
163
|
-
inactive: string;
|
|
164
|
-
};
|
|
165
|
-
motion: {
|
|
166
|
-
active: string;
|
|
167
|
-
inactive: string;
|
|
168
|
-
};
|
|
169
|
-
occupancy: {
|
|
170
|
-
active: string;
|
|
171
|
-
inactive: string;
|
|
172
|
-
};
|
|
173
|
-
smoke: {
|
|
174
|
-
active: string;
|
|
175
|
-
inactive: string;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
startup: {
|
|
179
|
-
migrationBridge: string;
|
|
180
|
-
migrationComplete: string;
|
|
181
|
-
migrationNoAccessories: string;
|
|
182
|
-
migrationIgnore: string;
|
|
183
|
-
migrationFailed: string;
|
|
184
|
-
migrationRevert: string;
|
|
185
|
-
newAccessory: string;
|
|
186
|
-
removeAccessory: string;
|
|
187
|
-
restoringAccessory: string;
|
|
188
|
-
setupComplete: string;
|
|
189
|
-
unsupportedType: string;
|
|
190
|
-
welcome: string[];
|
|
191
|
-
};
|
|
192
|
-
webhook: {
|
|
193
|
-
missing: string;
|
|
194
|
-
received: string;
|
|
195
|
-
register: string;
|
|
196
|
-
started: string;
|
|
197
|
-
stopped: string;
|
|
198
|
-
stopping: string;
|
|
199
|
-
validRange: string;
|
|
200
|
-
validValues: string;
|
|
201
|
-
unregisteredCommand: string;
|
|
202
|
-
unsupportedCommand: string;
|
|
203
|
-
unregisteredId: string;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
export default zz;
|
package/dist/i18n/zz.js
DELETED
package/dist/i18n/zz.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zz.js","sourceRoot":"","sources":["../../src/i18n/zz.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,SAAS,GAAG,EACjB,CAAC;AAEF,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AAEpC,eAAe,EAAE,CAAC"}
|