homebridge-dummy 0.9.1-beta.1 → 0.9.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 +9 -5
- package/README.md +5 -0
- package/dist/homebridge/index.d.ts +2 -0
- package/dist/homebridge/index.js +83 -88
- package/dist/homebridge/index.js.map +1 -1
- package/dist/i18n/en.d.ts +19 -1
- package/dist/i18n/en.js +19 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/i18n.d.ts +19 -1
- package/dist/i18n/template.d.ts +19 -1
- package/dist/i18n/zz.d.ts +19 -1
- package/dist/tools/storage.d.ts +0 -2
- package/dist/tools/storage.js +0 -2
- package/dist/tools/storage.js.map +1 -1
- package/package.json +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to homebridge-dummy will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## 0.9.1 (
|
|
5
|
+
## 0.9.1 (2025-06-25)
|
|
6
6
|
|
|
7
|
-
⚠️ Plugin has a new maintainer and will undergo significant cleanup and modernization in the near term. If you experience issues you can always downgrade to the last stable version v0.9.0
|
|
7
|
+
⚠️ Plugin has a new owner/maintainer and will undergo significant cleanup and modernization in the near term. If you experience issues you can always downgrade to the last stable version v0.9.0
|
|
8
8
|
|
|
9
|
-
Please report any issues you
|
|
9
|
+
Please report any issues you encounter here: https://github.com/mpatfield/homebridge-dummy/issues
|
|
10
10
|
|
|
11
11
|
### ⚠️ BREAKING
|
|
12
|
-
- node-persist updated from major version 2 to 4 so stateful and dimmer switches
|
|
12
|
+
- node-persist updated from major version 2 to 4, so stateful and dimmer switches may lose their previously saved states
|
|
13
13
|
|
|
14
14
|
### Changed
|
|
15
|
-
- Migrated to
|
|
15
|
+
- Migrated plugin to TypeScript
|
|
16
|
+
|
|
17
|
+
## 0.9.0 (2023-01-23)
|
|
18
|
+
|
|
19
|
+
- Last stable release by @nfarina before transfer of ownership to @mpatfield
|
package/README.md
CHANGED
|
@@ -118,3 +118,8 @@ A random period within one hour is defined as follows in your config.json:
|
|
|
118
118
|
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
## Credits
|
|
122
|
+
|
|
123
|
+
Special thanks to [@nfarina](https://github.com/nfarina) for creating the original version of this plugin and maintaining it for almost 10\(!!!\) years
|
|
124
|
+
|
|
125
|
+
And to the amazing creators/contributors of [Homebridge](https://homebridge.io) who made this plugin possible!
|
package/dist/homebridge/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { PLUGIN_ALIAS, PLUGIN_NAME } from './settings.js';
|
|
2
|
-
import {
|
|
2
|
+
import { strings } from '../i18n/i18n.js';
|
|
3
|
+
import { storageGet, storageSet } from '../tools/storage.js';
|
|
3
4
|
import getVersion from '../tools/version.js';
|
|
4
5
|
const init = (api) => {
|
|
5
6
|
api.registerAccessory(PLUGIN_NAME, PLUGIN_ALIAS, DummySwitch);
|
|
6
7
|
};
|
|
7
8
|
export default init;
|
|
9
|
+
export const SUFFIX_BRIGHTNESS = '_brightness';
|
|
10
|
+
export const SUFFIX_STATE = '_state';
|
|
8
11
|
class DummySwitch {
|
|
9
|
-
api;
|
|
10
12
|
log;
|
|
13
|
+
Service;
|
|
14
|
+
Characteristic;
|
|
11
15
|
service;
|
|
12
16
|
infoService;
|
|
13
17
|
persistPath;
|
|
@@ -15,128 +19,119 @@ class DummySwitch {
|
|
|
15
19
|
isDimmer;
|
|
16
20
|
isStateful;
|
|
17
21
|
isReverse;
|
|
18
|
-
brightness;
|
|
19
22
|
isRandom;
|
|
20
23
|
isResettable;
|
|
24
|
+
brightness;
|
|
21
25
|
timeout;
|
|
22
26
|
timer = undefined;
|
|
23
27
|
constructor(log, config, api) {
|
|
24
|
-
this.
|
|
28
|
+
this.log = config.disableLogging ? undefined : log;
|
|
29
|
+
this.Service = api.hap.Service;
|
|
30
|
+
this.Characteristic = api.hap.Characteristic;
|
|
25
31
|
this.persistPath = api.user.persistPath();
|
|
26
32
|
this.name = config.name;
|
|
27
|
-
this.isDimmer = config.dimmer;
|
|
28
|
-
this.isReverse = config.reverse;
|
|
29
|
-
this.isStateful = config.stateful;
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.isResettable = config.resettable;
|
|
33
|
+
this.isDimmer = config.dimmer ?? false;
|
|
34
|
+
this.isReverse = config.reverse ?? false;
|
|
35
|
+
this.isStateful = config.stateful ?? false;
|
|
36
|
+
this.isRandom = config.random ?? false;
|
|
37
|
+
this.isResettable = config.resettable ?? false;
|
|
33
38
|
this.timeout = config.time;
|
|
34
|
-
this.
|
|
35
|
-
let
|
|
39
|
+
this.brightness = config.brightness ?? 0;
|
|
40
|
+
let model;
|
|
36
41
|
if (this.isDimmer) {
|
|
37
|
-
this.service = new
|
|
38
|
-
|
|
42
|
+
this.service = new this.Service.Lightbulb(this.name);
|
|
43
|
+
model = strings.info.dimmer;
|
|
39
44
|
}
|
|
40
45
|
else {
|
|
41
|
-
this.service = new
|
|
42
|
-
|
|
46
|
+
this.service = new this.Service.Switch(this.name);
|
|
47
|
+
model = strings.info.switch;
|
|
43
48
|
}
|
|
44
|
-
this.infoService = new
|
|
49
|
+
this.infoService = new this.Service.AccessoryInformation();
|
|
45
50
|
this.infoService
|
|
46
|
-
.setCharacteristic(
|
|
47
|
-
.setCharacteristic(
|
|
48
|
-
.setCharacteristic(
|
|
49
|
-
.setCharacteristic(
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
51
|
+
.setCharacteristic(this.Characteristic.Manufacturer, strings.info.homebridge)
|
|
52
|
+
.setCharacteristic(this.Characteristic.Model, model)
|
|
53
|
+
.setCharacteristic(this.Characteristic.FirmwareRevision, getVersion())
|
|
54
|
+
.setCharacteristic(this.Characteristic.SerialNumber, 'Dummy-' + this.name.replace(/\s/g, '-'));
|
|
55
|
+
this.finishSetup();
|
|
56
|
+
}
|
|
57
|
+
getServices() {
|
|
58
|
+
return [this.infoService, this.service];
|
|
59
|
+
}
|
|
60
|
+
async finishSetup() {
|
|
57
61
|
if (this.isReverse) {
|
|
58
|
-
this.service.setCharacteristic(this.
|
|
62
|
+
this.service.setCharacteristic(this.Characteristic.On, true);
|
|
59
63
|
}
|
|
60
64
|
if (this.isStateful) {
|
|
61
|
-
storageGet(this.persistPath, this.storageKey(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
65
|
+
const state = await storageGet(this.persistPath, this.storageKey(SUFFIX_STATE));
|
|
66
|
+
if (!state) {
|
|
67
|
+
this.service.setCharacteristic(this.Characteristic.On, false);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.service.setCharacteristic(this.Characteristic.On, true);
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
if (this.isDimmer) {
|
|
71
|
-
storageGet(this.persistPath, this.storageKey(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
const brightness = await storageGet(this.persistPath, this.storageKey(SUFFIX_BRIGHTNESS));
|
|
75
|
+
if (brightness) {
|
|
76
|
+
this.brightness = Number(brightness);
|
|
77
|
+
this.service.setCharacteristic(this.Characteristic.Brightness, Number(this.brightness));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.service.setCharacteristic(this.Characteristic.Brightness, 0);
|
|
81
|
+
}
|
|
82
|
+
this.service.getCharacteristic(this.Characteristic.Brightness)
|
|
83
|
+
.onGet(this._getBrightness.bind(this))
|
|
84
|
+
.onSet(this._setBrightness.bind(this));
|
|
81
85
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return [this.infoService, this.service];
|
|
86
|
+
this.service.getCharacteristic(this.Characteristic.On)
|
|
87
|
+
.onSet(this._setOn.bind(this));
|
|
85
88
|
}
|
|
86
89
|
storageKey(suffix) {
|
|
87
90
|
return this.name.replace(/\s/g, '_').toLowerCase() + suffix;
|
|
88
91
|
}
|
|
89
92
|
randomize(timeout) {
|
|
90
|
-
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
return Math.floor(Math.random() * (timeout + 1));
|
|
93
|
+
return timeout ? Math.floor(Math.random() * (timeout + 1)) : undefined;
|
|
94
94
|
}
|
|
95
95
|
async _getBrightness() {
|
|
96
|
-
|
|
97
|
-
return this.brightness || 0;
|
|
96
|
+
return this.brightness;
|
|
98
97
|
}
|
|
99
98
|
async _setBrightness(brightness) {
|
|
100
|
-
|
|
101
|
-
this.log?.(msg);
|
|
99
|
+
this.log?.(strings.brightness.set, brightness);
|
|
102
100
|
this.brightness = brightness;
|
|
103
|
-
await storageSet(this.persistPath, this.storageKey(
|
|
101
|
+
await storageSet(this.persistPath, this.storageKey(SUFFIX_BRIGHTNESS), brightness.toString());
|
|
104
102
|
}
|
|
105
103
|
;
|
|
106
104
|
async _setOn(value) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (this.isRandom && !this.isStateful) {
|
|
110
|
-
if (value && !this.isReverse || !value && this.isReverse) {
|
|
111
|
-
msg = msg + ' (random delay ' + delay + 'ms)';
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
this.log?.(msg);
|
|
115
|
-
if (value && !this.isReverse && !this.isStateful) {
|
|
116
|
-
if (this.isResettable && this.timer) {
|
|
117
|
-
clearTimeout(this.timer);
|
|
118
|
-
this.timer = undefined;
|
|
119
|
-
}
|
|
120
|
-
if (delay) {
|
|
121
|
-
this.timer = setTimeout(() => {
|
|
122
|
-
this.service.setCharacteristic(this.api.hap.Characteristic.On, false);
|
|
123
|
-
}, delay);
|
|
124
|
-
}
|
|
105
|
+
if (this.isDimmer) {
|
|
106
|
+
this.log?.('%s / %s', value ? strings.switch.on : strings.switch.off, this.brightness);
|
|
125
107
|
}
|
|
126
|
-
else
|
|
127
|
-
|
|
128
|
-
clearTimeout(this.timer);
|
|
129
|
-
this.timer = undefined;
|
|
130
|
-
}
|
|
131
|
-
if (delay) {
|
|
132
|
-
this.timer = setTimeout(() => {
|
|
133
|
-
this.service.setCharacteristic(this.api.hap.Characteristic.On, true);
|
|
134
|
-
}, delay);
|
|
135
|
-
}
|
|
108
|
+
else {
|
|
109
|
+
this.log?.(value ? strings.switch.on : strings.switch.off);
|
|
136
110
|
}
|
|
137
111
|
if (this.isStateful) {
|
|
138
|
-
storageSet(this.persistPath, this.storageKey(
|
|
112
|
+
await storageSet(this.persistPath, this.storageKey(SUFFIX_STATE), value.toString());
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (value === this.isReverse) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (this.isResettable) {
|
|
119
|
+
clearTimeout(this.timer);
|
|
120
|
+
this.timer = undefined;
|
|
121
|
+
}
|
|
122
|
+
const delay = this.isRandom ? this.randomize(this.timeout) : this.timeout;
|
|
123
|
+
if (!delay) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (delay % 1000 === 0) {
|
|
127
|
+
this.log?.(strings.switch.delay_s, delay / 1000);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.log?.(strings.switch.delay_ms, delay);
|
|
139
131
|
}
|
|
132
|
+
this.timer = setTimeout(() => {
|
|
133
|
+
this.service.setCharacteristic(this.Characteristic.On, this.isReverse);
|
|
134
|
+
}, delay);
|
|
140
135
|
}
|
|
141
136
|
;
|
|
142
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/homebridge/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/homeb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C;YACvB,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,SAAgC,CAAC,CAAC;QAChG,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC;IAAA,CAAC;CACH"}
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
declare const en: {
|
|
1
|
+
declare const en: {
|
|
2
|
+
brightness: {
|
|
3
|
+
set: string;
|
|
4
|
+
};
|
|
5
|
+
config: {
|
|
6
|
+
support: string;
|
|
7
|
+
};
|
|
8
|
+
info: {
|
|
9
|
+
dimmer: string;
|
|
10
|
+
homebridge: string;
|
|
11
|
+
switch: string;
|
|
12
|
+
};
|
|
13
|
+
switch: {
|
|
14
|
+
delay_ms: string;
|
|
15
|
+
delay_s: string;
|
|
16
|
+
off: string;
|
|
17
|
+
on: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
2
20
|
export default en;
|
package/dist/i18n/en.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
const en = {
|
|
1
|
+
const en = {
|
|
2
|
+
brightness: {
|
|
3
|
+
set: 'Brightness = %s',
|
|
4
|
+
},
|
|
5
|
+
config: {
|
|
6
|
+
support: 'For help and support please visit %s',
|
|
7
|
+
},
|
|
8
|
+
info: {
|
|
9
|
+
dimmer: 'Dummy Dimmer',
|
|
10
|
+
homebridge: 'Homebridge',
|
|
11
|
+
switch: 'Dummy Switch',
|
|
12
|
+
},
|
|
13
|
+
switch: {
|
|
14
|
+
delay_ms: 'Delaying %sms…',
|
|
15
|
+
delay_s: 'Delaying %ss…',
|
|
16
|
+
off: 'Off',
|
|
17
|
+
on: 'On',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
2
20
|
export default en;
|
|
3
21
|
//# sourceMappingURL=en.js.map
|
package/dist/i18n/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG;IAET,UAAU,EAAE;QACV,GAAG,EAAE,iBAAiB;KACvB;IAED,MAAM,EAAE;QACN,OAAO,EAAE,sCAAsC;KAChD;IAED,IAAI,EAAE;QACJ,MAAM,EAAE,cAAc;QACtB,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,cAAc;KACvB;IAED,MAAM,EAAE;QACN,QAAQ,EAAE,gBAAgB;QAC1B,OAAO,EAAE,eAAe;QACxB,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,IAAI;KACT;CACF,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/i18n/i18n.d.ts
CHANGED
|
@@ -7,5 +7,23 @@ export type Translation = typeof en;
|
|
|
7
7
|
export declare function getLanguage(): Language;
|
|
8
8
|
export declare function setLanguage(i18nLang: string): void;
|
|
9
9
|
export declare function getAllTranslations(): Translation;
|
|
10
|
-
declare const translations: {
|
|
10
|
+
declare const translations: {
|
|
11
|
+
brightness: {
|
|
12
|
+
set: string;
|
|
13
|
+
};
|
|
14
|
+
config: {
|
|
15
|
+
support: string;
|
|
16
|
+
};
|
|
17
|
+
info: {
|
|
18
|
+
dimmer: string;
|
|
19
|
+
homebridge: string;
|
|
20
|
+
switch: string;
|
|
21
|
+
};
|
|
22
|
+
switch: {
|
|
23
|
+
delay_ms: string;
|
|
24
|
+
delay_s: string;
|
|
25
|
+
off: string;
|
|
26
|
+
on: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
11
29
|
export { translations as strings };
|
package/dist/i18n/template.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
declare const REPLACE_THIS_WITH_ISO_CODE: {
|
|
1
|
+
declare const REPLACE_THIS_WITH_ISO_CODE: {
|
|
2
|
+
brightness: {
|
|
3
|
+
set: string;
|
|
4
|
+
};
|
|
5
|
+
config: {
|
|
6
|
+
support: string;
|
|
7
|
+
};
|
|
8
|
+
info: {
|
|
9
|
+
dimmer: string;
|
|
10
|
+
homebridge: string;
|
|
11
|
+
switch: string;
|
|
12
|
+
};
|
|
13
|
+
switch: {
|
|
14
|
+
delay_ms: string;
|
|
15
|
+
delay_s: string;
|
|
16
|
+
off: string;
|
|
17
|
+
on: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
2
20
|
export default REPLACE_THIS_WITH_ISO_CODE;
|
package/dist/i18n/zz.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
declare const zz: {
|
|
1
|
+
declare const zz: {
|
|
2
|
+
brightness: {
|
|
3
|
+
set: string;
|
|
4
|
+
};
|
|
5
|
+
config: {
|
|
6
|
+
support: string;
|
|
7
|
+
};
|
|
8
|
+
info: {
|
|
9
|
+
dimmer: string;
|
|
10
|
+
homebridge: string;
|
|
11
|
+
switch: string;
|
|
12
|
+
};
|
|
13
|
+
switch: {
|
|
14
|
+
delay_ms: string;
|
|
15
|
+
delay_s: string;
|
|
16
|
+
off: string;
|
|
17
|
+
on: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
2
20
|
export default zz;
|
package/dist/tools/storage.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare const STORAGE_KEY_SUFFIX_BRIGHTNESS = "_brightness";
|
|
2
|
-
export declare const STORAGE_KEY_SUFFIX_STATE = "_state";
|
|
3
1
|
export declare function storageGet(dir: string, key: string): Promise<string | null>;
|
|
4
2
|
export declare function storageSet(dir: string, key: string, value: string): Promise<void>;
|
package/dist/tools/storage.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import storage from 'node-persist';
|
|
2
2
|
import { PLUGIN_NAME } from '../homebridge/settings.js';
|
|
3
|
-
export const STORAGE_KEY_SUFFIX_BRIGHTNESS = '_brightness';
|
|
4
|
-
export const STORAGE_KEY_SUFFIX_STATE = '_state';
|
|
5
3
|
async function init(dir) {
|
|
6
4
|
await storage.init({ dir: dir, forgiveParseErrors: true });
|
|
7
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/tools/storage.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/tools/storage.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,KAAK,UAAU,IAAI,CAAC,GAAW;IAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,GAAW;IACvD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,IAAI,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,GAAW,EAAE,KAAa;IACtE,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,IAAI,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,UAAU;IACZ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-dummy",
|
|
3
3
|
"displayName": "Homebridge Dummy",
|
|
4
|
-
"version": "0.9.1
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "mpatfield"
|
|
7
7
|
},
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "rimraf ./dist && tsc",
|
|
22
|
-
"build:html": "mkdir ./dist/homebridge-ui/public && cp -r ./src/homebridge-ui/public/* ./dist/homebridge-ui/public/",
|
|
23
|
-
"build:ui": "esbuild src/homebridge-ui/ui.ts --bundle --outfile=dist/homebridge-ui/public/ui.js --minify",
|
|
24
22
|
"lint": "eslint . --max-warnings=0",
|
|
25
23
|
"prepublishOnly": "npm run lint && npm run build"
|
|
26
24
|
},
|
|
@@ -40,7 +38,6 @@
|
|
|
40
38
|
"url": "https://github.com/sponsors/mpatfield"
|
|
41
39
|
},
|
|
42
40
|
"dependencies": {
|
|
43
|
-
"@homebridge/plugin-ui-utils": "^2.0.2",
|
|
44
41
|
"homebridge-lib": "^7.1.4",
|
|
45
42
|
"lodash.merge": "^4.6.2",
|
|
46
43
|
"node-persist": "^4.0.4"
|
|
@@ -48,10 +45,8 @@
|
|
|
48
45
|
"devDependencies": {
|
|
49
46
|
"@types/lodash.merge": "^4.6.9",
|
|
50
47
|
"@types/node-persist": "^3.1.8",
|
|
51
|
-
"esbuild": "^0.25.5",
|
|
52
48
|
"eslint": "^9.27.0",
|
|
53
49
|
"homebridge": "^2.0.0-beta.0",
|
|
54
|
-
"jiti": "^2.4.2",
|
|
55
50
|
"rimraf": "^6.0.1",
|
|
56
51
|
"ts-node": "^10.9.2",
|
|
57
52
|
"typescript-eslint": "^8.24.1"
|