homebridge-tasmota 0.2.0-beta.5 → 0.2.0-beta.7
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/dist/TasmotaService.d.ts +1 -2
- package/dist/TasmotaService.js +5 -6
- package/dist/TasmotaService.js.map +1 -1
- package/dist/lib/CustomHomeKitTypes.d.mts +32 -0
- package/dist/lib/CustomHomeKitTypes.mjs +112 -0
- package/dist/lib/CustomHomeKitTypes.mjs.map +1 -0
- package/dist/lib/EveHomeKitTypes.d.mts +4 -0
- package/dist/lib/EveHomeKitTypes.mjs +406 -0
- package/dist/lib/EveHomeKitTypes.mjs.map +1 -0
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +2 -2
- package/dist/platform.js.map +1 -1
- package/dist/tasmotaBinarySensorService.js +9 -10
- package/dist/tasmotaBinarySensorService.js.map +1 -1
- package/dist/tasmotaSensorService.js +5 -6
- package/dist/tasmotaSensorService.js.map +1 -1
- package/package.json +4 -3
- package/dist/lib/CustomCharacteristics.d.ts +0 -51
- package/dist/lib/CustomCharacteristics.js +0 -166
- package/dist/lib/CustomCharacteristics.js.map +0 -1
- package/dist/lib/CustomCharacteristics.spec.d.ts +0 -1
- package/dist/lib/CustomCharacteristics.spec.js +0 -141
- package/dist/lib/CustomCharacteristics.spec.js.map +0 -1
- package/hbconfig/config.json +0 -84
package/dist/TasmotaService.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Characteristic, PlatformAccessory, Service } from 'homebridge';
|
|
2
|
-
import { CustomCharacteristics } from './lib/CustomCharacteristics';
|
|
3
2
|
import { tasmotaPlatform } from './platform';
|
|
4
3
|
interface Subscription {
|
|
5
4
|
event: string;
|
|
@@ -20,7 +19,7 @@ export declare class TasmotaService {
|
|
|
20
19
|
constructor(platform: tasmotaPlatform, accessory: PlatformAccessory, uniq_id: string);
|
|
21
20
|
enableFakegato(): void;
|
|
22
21
|
enableStatus(): void;
|
|
23
|
-
deviceClassToHKCharacteristic(device_class: string):
|
|
22
|
+
deviceClassToHKCharacteristic(device_class: string): any;
|
|
24
23
|
refresh(): void;
|
|
25
24
|
statusUpdate(topic: any, message: any): void;
|
|
26
25
|
availabilityUpdate(topic: any, message: any): void;
|
package/dist/TasmotaService.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.isTrue = isTrue;
|
|
|
8
8
|
const node_os_1 = __importDefault(require("node:os"));
|
|
9
9
|
const debug_1 = __importDefault(require("debug"));
|
|
10
10
|
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
11
|
-
const CustomCharacteristics_1 = require("./lib/CustomCharacteristics");
|
|
12
11
|
const debug = (0, debug_1.default)('Tasmota:Service');
|
|
13
12
|
class TasmotaService {
|
|
14
13
|
constructor(platform, accessory, uniq_id) {
|
|
@@ -71,16 +70,16 @@ class TasmotaService {
|
|
|
71
70
|
switch (device_class) {
|
|
72
71
|
case '-dt24-amp':
|
|
73
72
|
case '_energy_current':
|
|
74
|
-
return (
|
|
73
|
+
return (this.platform.CustomTypes.Characteristics.ElectricCurrent);
|
|
75
74
|
case '_energy_voltage':
|
|
76
75
|
case '-dt24-volt':
|
|
77
|
-
return (
|
|
76
|
+
return (this.platform.CustomTypes.Characteristics.Voltage);
|
|
78
77
|
case '_energy_power':
|
|
79
78
|
case '-dt24-watt':
|
|
80
|
-
return (
|
|
79
|
+
return (this.platform.CustomTypes.Characteristics.CurrentConsumption);
|
|
81
80
|
case '_energy_total':
|
|
82
81
|
case '-dt24-watt-hour':
|
|
83
|
-
return (
|
|
82
|
+
return (this.platform.CustomTypes.Characteristics.TotalConsumption);
|
|
84
83
|
break;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -92,7 +91,7 @@ class TasmotaService {
|
|
|
92
91
|
}
|
|
93
92
|
statusUpdate(topic, message) {
|
|
94
93
|
var _a, _b;
|
|
95
|
-
debug('statusUpdate', this.service.displayName, topic, message.toString());
|
|
94
|
+
debug('statusUpdate for "%s" on topic "%s" ->', this.service.displayName, topic, message.toString());
|
|
96
95
|
this.accessory.context.timeout = this.platform.autoCleanup(this.accessory);
|
|
97
96
|
try {
|
|
98
97
|
let value = this.parseValue(this.accessory.context.device[this.uniq_id].val_tpl, message.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TasmotaService.js","sourceRoot":"","sources":["../src/TasmotaService.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"TasmotaService.js","sourceRoot":"","sources":["../src/TasmotaService.ts"],"names":[],"mappings":";;;;;;AAmOA,wBAeC;AAlPD,sDAAyB;AACzB,kDAAgC;AAQhC,wDAAgC;AAGhC,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,iBAAiB,CAAC,CAAC;AAc7C,MAAa,cAAc;IAUzB,YACkB,QAAyB,EACzB,SAA4B,EACzB,OAAe;QAFlB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,cAAS,GAAT,SAAS,CAAmB;QACzB,YAAO,GAAP,OAAO,CAAQ;QAElC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;QACrG,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;QAEnE,IAAI,CAAC,mBAAmB,GAAG,IAAI,kBAAQ,CAAC,WAAW,EAAE,CAAC;QAItD,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE;YAE3D,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACrB,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAChB,CAAC;iBAAM,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AAnMD,wCAmMC;AAED,SAAS,KAAK,CAAC,GAAG;IAChB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,MAAM,CAAC,KAAgC;IACrD,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;QAChC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,CAAC;IACD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,IAAI,CAAC;QACV,KAAK,MAAM,CAAC;QACZ,KAAK,CAAC,CAAC;QACP,KAAK,GAAG,CAAC;QACT,KAAK,IAAI,CAAC;QACV,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class CustomHomeKitTypes {
|
|
2
|
+
static uuid(id: string, suffix?: string | null): string;
|
|
3
|
+
constructor(homebridge: API);
|
|
4
|
+
_Services: {};
|
|
5
|
+
_Characteristics: {};
|
|
6
|
+
readonly get Access(): {
|
|
7
|
+
[x: string]: Characteristic.Access;
|
|
8
|
+
};
|
|
9
|
+
readonly get Formats(): {
|
|
10
|
+
[x: string]: Format;
|
|
11
|
+
};
|
|
12
|
+
readonly get Perms(): {
|
|
13
|
+
[x: string]: Perm;
|
|
14
|
+
};
|
|
15
|
+
readonly get Units(): {
|
|
16
|
+
[x: string]: Unit;
|
|
17
|
+
};
|
|
18
|
+
readonly get Characteristics(): {
|
|
19
|
+
[x: string]: Class;
|
|
20
|
+
};
|
|
21
|
+
readonly get Services(): {
|
|
22
|
+
[x: string]: Class;
|
|
23
|
+
};
|
|
24
|
+
readonly get hapCharacteristics(): {
|
|
25
|
+
[x: string]: Class;
|
|
26
|
+
};
|
|
27
|
+
readonly get hapServices(): {
|
|
28
|
+
[x: string]: Class;
|
|
29
|
+
};
|
|
30
|
+
createCharacteristicClass(key: string, uuid: string, props: Props, displayName?: string): Class;
|
|
31
|
+
createServiceClass(key: string, uuid: string, Characteristics: Class[], OptionalCharacteristics?: Class[]): Class;
|
|
32
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const regExps = {
|
|
2
|
+
uuid: /^[0-9A-F]{8}-[0-9A-F]{4}-[1-5][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/,
|
|
3
|
+
uuidPrefix: /^[0-9A-F]{1,8}$/,
|
|
4
|
+
uuidSuffix: /^-[0-9A-F]{4}-[1-5][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/
|
|
5
|
+
};
|
|
6
|
+
let hap;
|
|
7
|
+
let hapCharacteristics;
|
|
8
|
+
let hapServices;
|
|
9
|
+
class CustomHomeKitTypes {
|
|
10
|
+
constructor(homebridge) {
|
|
11
|
+
hap = homebridge.hap;
|
|
12
|
+
this._Services = {};
|
|
13
|
+
this._Characteristics = {};
|
|
14
|
+
}
|
|
15
|
+
get Access() { return Object.freeze(Object.assign({}, hap.Access)); }
|
|
16
|
+
get Formats() { return Object.freeze(Object.assign({}, hap.Formats)); }
|
|
17
|
+
get Perms() { return Object.freeze(Object.assign({}, hap.Perms)); }
|
|
18
|
+
get Units() { return Object.freeze(Object.assign({}, hap.Units)); }
|
|
19
|
+
get Characteristics() { return this._Characteristics; }
|
|
20
|
+
get Services() { return this._Services; }
|
|
21
|
+
get hapCharacteristics() {
|
|
22
|
+
if (hapCharacteristics == null) {
|
|
23
|
+
hapCharacteristics = {};
|
|
24
|
+
Object.keys(hap.Characteristic).sort().filter((key) => {
|
|
25
|
+
return regExps.uuid.test(hap.Characteristic[key].UUID);
|
|
26
|
+
}).forEach((key) => {
|
|
27
|
+
hapCharacteristics[key] = hap.Characteristic[key];
|
|
28
|
+
});
|
|
29
|
+
Object.freeze(hapCharacteristics);
|
|
30
|
+
}
|
|
31
|
+
return hapCharacteristics;
|
|
32
|
+
}
|
|
33
|
+
get hapServices() {
|
|
34
|
+
if (hapServices == null) {
|
|
35
|
+
hapServices = {};
|
|
36
|
+
Object.keys(hap.Service).sort().filter((key) => {
|
|
37
|
+
return regExps.uuid.test(hap.Service[key].UUID);
|
|
38
|
+
}).forEach((key) => {
|
|
39
|
+
hapServices[key] = hap.Service[key];
|
|
40
|
+
});
|
|
41
|
+
Object.freeze(hapServices);
|
|
42
|
+
}
|
|
43
|
+
return hapServices;
|
|
44
|
+
}
|
|
45
|
+
createCharacteristicClass(key, uuid, props, displayName = key) {
|
|
46
|
+
if (typeof key !== 'string') {
|
|
47
|
+
throw new TypeError('key: not a string');
|
|
48
|
+
}
|
|
49
|
+
if (key === '') {
|
|
50
|
+
throw new RangeError('key: invalid empty string');
|
|
51
|
+
}
|
|
52
|
+
if (this._Characteristics[key] != null) {
|
|
53
|
+
throw new SyntaxError(`${key}: duplicate key`);
|
|
54
|
+
}
|
|
55
|
+
if (!regExps.uuid.test(uuid)) {
|
|
56
|
+
throw new RangeError(`uuid: ${uuid}: invalid UUID`);
|
|
57
|
+
}
|
|
58
|
+
this._Characteristics[key] = class extends hap.Characteristic {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(displayName, uuid);
|
|
61
|
+
this.setProps(props);
|
|
62
|
+
this.value = this.getDefaultValue();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
this._Characteristics[key].UUID = uuid;
|
|
66
|
+
return this._Characteristics[key];
|
|
67
|
+
}
|
|
68
|
+
createServiceClass(key, uuid, Characteristics, OptionalCharacteristics = []) {
|
|
69
|
+
if (typeof key !== 'string') {
|
|
70
|
+
throw new TypeError('key: not a string');
|
|
71
|
+
}
|
|
72
|
+
if (key === '') {
|
|
73
|
+
throw new RangeError('key: invalid empty string');
|
|
74
|
+
}
|
|
75
|
+
if (this._Services[key] != null) {
|
|
76
|
+
throw new SyntaxError(`${key}: duplicate key`);
|
|
77
|
+
}
|
|
78
|
+
if (!regExps.uuid.test(uuid)) {
|
|
79
|
+
throw new RangeError(`uuid: ${uuid}: invalid UUID`);
|
|
80
|
+
}
|
|
81
|
+
this._Services[key] = class extends hap.Service {
|
|
82
|
+
constructor(displayName, subtype) {
|
|
83
|
+
super(displayName, uuid, subtype);
|
|
84
|
+
for (const Characteristic of Characteristics) {
|
|
85
|
+
this.addCharacteristic(Characteristic);
|
|
86
|
+
}
|
|
87
|
+
for (const Characteristic of OptionalCharacteristics) {
|
|
88
|
+
this.addOptionalCharacteristic(Characteristic);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
this._Services[key].UUID = uuid;
|
|
93
|
+
return this._Services[key];
|
|
94
|
+
}
|
|
95
|
+
static uuid(id, suffix = '-0000-1000-8000-0026BB765291') {
|
|
96
|
+
if (typeof id !== 'string') {
|
|
97
|
+
throw new TypeError('id: not a string');
|
|
98
|
+
}
|
|
99
|
+
if (!regExps.uuidPrefix.test(id)) {
|
|
100
|
+
throw new RangeError(`id: ${id}: invalid id`);
|
|
101
|
+
}
|
|
102
|
+
if (typeof suffix !== 'string') {
|
|
103
|
+
throw new TypeError('suffix: not a string');
|
|
104
|
+
}
|
|
105
|
+
if (!regExps.uuidSuffix.test(suffix)) {
|
|
106
|
+
throw new RangeError(`suffix: ${suffix}: invalid suffix`);
|
|
107
|
+
}
|
|
108
|
+
return ('00000000' + id).slice(-8) + suffix;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export { CustomHomeKitTypes };
|
|
112
|
+
//# sourceMappingURL=CustomHomeKitTypes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomHomeKitTypes.mjs","sourceRoot":"","sources":["../../src/lib/CustomHomeKitTypes.mjs"],"names":[],"mappings":"AAKA,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,2EAA2E;IACjF,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,gEAAgE;CAC7E,CAAA;AAED,IAAI,GAAG,CAAA;AACP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AAM,CAAA;IAC7C,CAAC;CACF;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { CustomHomeKitTypes } from 'homebridge-lib/CustomHomeKitTypes';
|
|
2
|
+
function uuid(id) {
|
|
3
|
+
if (typeof id !== 'string' || id.length !== 3) {
|
|
4
|
+
throw new TypeError(`${id}: illegal id`);
|
|
5
|
+
}
|
|
6
|
+
return `E863F${id}-079E-48FF-8F27-9C2605A29F52`;
|
|
7
|
+
}
|
|
8
|
+
class EveHomeKitTypes extends CustomHomeKitTypes {
|
|
9
|
+
static get epoch() { return new Date('2001-01-01T00:00:00Z') / 1000; }
|
|
10
|
+
constructor(homebridge) {
|
|
11
|
+
super(homebridge);
|
|
12
|
+
this.createCharacteristicClass('Voltage', uuid('10A'), {
|
|
13
|
+
format: this.Formats.FLOAT,
|
|
14
|
+
unit: 'V',
|
|
15
|
+
minValue: 0,
|
|
16
|
+
maxValue: 380,
|
|
17
|
+
minStep: 0.1,
|
|
18
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
19
|
+
});
|
|
20
|
+
this.createCharacteristicClass('AirParticulateDensity', uuid('10B'), {
|
|
21
|
+
format: this.Formats.FLOAT,
|
|
22
|
+
unit: 'ppm',
|
|
23
|
+
minValue: 0,
|
|
24
|
+
maxValue: 5000,
|
|
25
|
+
minStep: 1,
|
|
26
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
27
|
+
}, 'VOC Level');
|
|
28
|
+
this.createCharacteristicClass('VOCLevel', uuid('10B'), {
|
|
29
|
+
format: this.Formats.INT16,
|
|
30
|
+
unit: 'ppb',
|
|
31
|
+
minValue: 5,
|
|
32
|
+
maxValue: 5000,
|
|
33
|
+
minStep: 5,
|
|
34
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
35
|
+
}, 'VOC Level');
|
|
36
|
+
this.createCharacteristicClass('TotalConsumption', uuid('10C'), {
|
|
37
|
+
format: this.Formats.FLOAT,
|
|
38
|
+
unit: 'kWh',
|
|
39
|
+
minValue: 0,
|
|
40
|
+
maxValue: 1000000,
|
|
41
|
+
minStep: 0.01,
|
|
42
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
43
|
+
}, 'Total Consumption');
|
|
44
|
+
this.createCharacteristicClass('Consumption', uuid('10D'), {
|
|
45
|
+
format: this.Formats.FLOAT,
|
|
46
|
+
unit: 'W',
|
|
47
|
+
minValue: 0,
|
|
48
|
+
maxValue: 12000,
|
|
49
|
+
minStep: 0.1,
|
|
50
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
51
|
+
}, 'Consumption');
|
|
52
|
+
this.createCharacteristicClass('CurrentConsumption', uuid('10D'), {
|
|
53
|
+
format: this.Formats.FLOAT,
|
|
54
|
+
unit: 'W',
|
|
55
|
+
minValue: 0,
|
|
56
|
+
maxValue: 12000,
|
|
57
|
+
minStep: 0.1,
|
|
58
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
59
|
+
}, 'Consumption');
|
|
60
|
+
this.createCharacteristicClass('AirPressure', uuid('10F'), {
|
|
61
|
+
format: this.Formats.FLOAT,
|
|
62
|
+
unit: 'hPa',
|
|
63
|
+
minValue: 700,
|
|
64
|
+
maxValue: 1100,
|
|
65
|
+
minStep: 0.1,
|
|
66
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
67
|
+
}, 'Air Pressure');
|
|
68
|
+
this.createCharacteristicClass('ResetTotal', uuid('112'), {
|
|
69
|
+
format: this.Formats.UINT32,
|
|
70
|
+
unit: this.Units.seconds,
|
|
71
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE],
|
|
72
|
+
adminOnlyAccess: [this.Access.WRITE]
|
|
73
|
+
}, 'Reset Total');
|
|
74
|
+
this.createCharacteristicClass('HistoryStatus', uuid('116'), {
|
|
75
|
+
format: this.Formats.DATA,
|
|
76
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.HIDDEN]
|
|
77
|
+
}, 'History Status');
|
|
78
|
+
this.createCharacteristicClass('HistoryEntries', uuid('117'), {
|
|
79
|
+
format: this.Formats.DATA,
|
|
80
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.HIDDEN]
|
|
81
|
+
}, 'History Entries');
|
|
82
|
+
this.createCharacteristicClass('OpenDuration', uuid('118'), {
|
|
83
|
+
format: this.Formats.UINT32,
|
|
84
|
+
unit: this.Units.SECONDS,
|
|
85
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
86
|
+
}, 'Open Duration');
|
|
87
|
+
this.createCharacteristicClass('ClosedDuration', uuid('119'), {
|
|
88
|
+
format: this.Formats.UINT32,
|
|
89
|
+
unit: this.Units.SECONDS,
|
|
90
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
91
|
+
}, 'Closed Duration');
|
|
92
|
+
this.createCharacteristicClass('LastActivation', uuid('11A'), {
|
|
93
|
+
format: this.Formats.UINT32,
|
|
94
|
+
unit: this.Units.SECONDS,
|
|
95
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
96
|
+
}, 'Last Activation');
|
|
97
|
+
this.createCharacteristicClass('HistoryRequest', uuid('11C'), {
|
|
98
|
+
format: this.Formats.DATA,
|
|
99
|
+
perms: [this.Perms.PAIRED_WRITE, this.Perms.HIDDEN]
|
|
100
|
+
}, 'History Request');
|
|
101
|
+
this.createCharacteristicClass('ConfigCommand', uuid('11D'), {
|
|
102
|
+
format: this.Formats.DATA,
|
|
103
|
+
perms: [this.Perms.PAIRED_WRITE, this.Perms.HIDDEN]
|
|
104
|
+
}, 'Config Command');
|
|
105
|
+
this.createCharacteristicClass('Char11E', uuid('11E'), {
|
|
106
|
+
format: this.Formats.DATA,
|
|
107
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.PAIRED_WRITE, this.Perms.HIDDEN]
|
|
108
|
+
}, 'Eve 11E');
|
|
109
|
+
this.createCharacteristicClass('Sensitivity', uuid('120'), {
|
|
110
|
+
format: this.Formats.UINT8,
|
|
111
|
+
minValue: 0,
|
|
112
|
+
maxValue: 7,
|
|
113
|
+
validValues: [0, 4, 7],
|
|
114
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE],
|
|
115
|
+
adminOnlyAccess: [this.Access.WRITE]
|
|
116
|
+
});
|
|
117
|
+
this.Characteristics.Sensitivity.HIGH = 0;
|
|
118
|
+
this.Characteristics.Sensitivity.MEDIUM = 4;
|
|
119
|
+
this.Characteristics.Sensitivity.LOW = 7;
|
|
120
|
+
this.createCharacteristicClass('SetTime', uuid('121'), {
|
|
121
|
+
format: this.Formats.DATA,
|
|
122
|
+
perms: [this.Perms.PAIRED_WRITE, this.Perms.HIDDEN]
|
|
123
|
+
});
|
|
124
|
+
this.createCharacteristicClass('ElectricCurrent', uuid('126'), {
|
|
125
|
+
format: this.Formats.FLOAT,
|
|
126
|
+
unit: 'A',
|
|
127
|
+
minValue: 0,
|
|
128
|
+
maxValue: 48,
|
|
129
|
+
minStep: 0.01,
|
|
130
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
131
|
+
}, 'Electric Current');
|
|
132
|
+
this.createCharacteristicClass('TimesOpened', uuid('129'), {
|
|
133
|
+
format: this.Formats.UINT32,
|
|
134
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
135
|
+
}, 'Times Opened');
|
|
136
|
+
this.createCharacteristicClass('ProgramCommand', uuid('12C'), {
|
|
137
|
+
format: this.Formats.DATA,
|
|
138
|
+
perms: [this.Perms.PAIRED_WRITE]
|
|
139
|
+
}, 'Program Command');
|
|
140
|
+
this.createCharacteristicClass('Duration', uuid('12D'), {
|
|
141
|
+
format: this.Formats.UINT16,
|
|
142
|
+
unit: this.Units.SECONDS,
|
|
143
|
+
minValue: 5,
|
|
144
|
+
maxValue: 15 * 3600,
|
|
145
|
+
validValues: [
|
|
146
|
+
5, 10, 20, 30,
|
|
147
|
+
1 * 60, 2 * 60, 3 * 60, 5 * 60, 10 * 60, 20 * 60, 30 * 60,
|
|
148
|
+
1 * 3600, 2 * 3600, 3 * 3600, 5 * 3600, 10 * 3600, 12 * 3600, 15 * 3600
|
|
149
|
+
],
|
|
150
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE],
|
|
151
|
+
adminOnlyAccess: [this.Access.WRITE]
|
|
152
|
+
});
|
|
153
|
+
this.Characteristics.Duration.VALID_VALUES = [
|
|
154
|
+
5, 10, 20, 30,
|
|
155
|
+
1 * 60, 2 * 60, 3 * 60, 5 * 60, 10 * 60, 20 * 60, 30 * 60,
|
|
156
|
+
1 * 3600, 2 * 3600, 3 * 3600, 5 * 3600, 10 * 3600, 12 * 3600, 15 * 3600
|
|
157
|
+
];
|
|
158
|
+
this.createCharacteristicClass('ValvePosition', uuid('12E'), {
|
|
159
|
+
format: this.Formats.UINT8,
|
|
160
|
+
unit: this.Units.PERCENTAGE,
|
|
161
|
+
minValue: 0,
|
|
162
|
+
maxValue: 100,
|
|
163
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
164
|
+
}, 'Valve Position');
|
|
165
|
+
this.createCharacteristicClass('ProgramData', uuid('12F'), {
|
|
166
|
+
format: this.Formats.DATA,
|
|
167
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
168
|
+
}, 'Program Data');
|
|
169
|
+
this.createCharacteristicClass('Elevation', uuid('130'), {
|
|
170
|
+
format: this.Formats.INT,
|
|
171
|
+
unit: 'm',
|
|
172
|
+
minValue: -450,
|
|
173
|
+
maxValue: 9000,
|
|
174
|
+
minStep: 1,
|
|
175
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE],
|
|
176
|
+
adminOnlyAccess: [this.Access.WRITE]
|
|
177
|
+
});
|
|
178
|
+
this.createCharacteristicClass('ConfigData', uuid('131'), {
|
|
179
|
+
format: this.Formats.DATA,
|
|
180
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
181
|
+
}, 'Config Data');
|
|
182
|
+
this.createCharacteristicClass('ElgatoDeviceStatus', uuid('134'), {
|
|
183
|
+
format: this.Formats.UINT32,
|
|
184
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
185
|
+
});
|
|
186
|
+
this.Characteristics.ElgatoDeviceStatus.SMOKE_DETECTED = 1 << 0;
|
|
187
|
+
this.Characteristics.ElgatoDeviceStatus.HEAT_DETECTED = 1 << 1;
|
|
188
|
+
this.Characteristics.ElgatoDeviceStatus.ALARM_TEST_ACTIVE = 1 << 2;
|
|
189
|
+
this.Characteristics.ElgatoDeviceStatus.SMOKE_CHAMBER = 1 << 9;
|
|
190
|
+
this.Characteristics.ElgatoDeviceStatus.SMOKE_SENSOR_DEACTIVATED = 1 << 14;
|
|
191
|
+
this.Characteristics.ElgatoDeviceStatus.FLASH_STATUS_LED = 1 << 15;
|
|
192
|
+
this.Characteristics.ElgatoDeviceStatus.ALARM_PAUSED = 1 << 24;
|
|
193
|
+
this.Characteristics.ElgatoDeviceStatus.ALARM_MUTED = 1 << 25;
|
|
194
|
+
this.createCharacteristicClass('WeatherTrend', uuid('136'), {
|
|
195
|
+
format: this.Formats.UINT8,
|
|
196
|
+
minValue: 0,
|
|
197
|
+
maxValue: 15,
|
|
198
|
+
minStep: 1,
|
|
199
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
200
|
+
}, 'Weather Trend');
|
|
201
|
+
this.Characteristics.WeatherTrend.BLANK = 0;
|
|
202
|
+
this.Characteristics.WeatherTrend.SUN = 1;
|
|
203
|
+
this.Characteristics.WeatherTrend.CLOUDS_SUN = 3;
|
|
204
|
+
this.Characteristics.WeatherTrend.RAIN = 4;
|
|
205
|
+
this.Characteristics.WeatherTrend.RAIN_WIND = 12;
|
|
206
|
+
this.createCharacteristicClass('Char158', uuid('158'), {
|
|
207
|
+
format: this.Formats.DATA,
|
|
208
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.PAIRED_WRITE, this.Perms.HIDDEN]
|
|
209
|
+
}, 'Eve 158');
|
|
210
|
+
this.createCharacteristicClass('Clouds', '64392FED-1401-4F7A-9ADB-1710DD6E3897', {
|
|
211
|
+
format: this.Formats.UINT8,
|
|
212
|
+
unit: this.Units.PERCENTAGE,
|
|
213
|
+
minValue: 0,
|
|
214
|
+
maxValue: 100,
|
|
215
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
216
|
+
});
|
|
217
|
+
this.createCharacteristicClass('ColorTemperature', 'E887EF67-509A-552D-A138-3DA215050F46', {
|
|
218
|
+
format: this.Formats.UINT16,
|
|
219
|
+
unit: 'mired',
|
|
220
|
+
minValue: 153,
|
|
221
|
+
maxValue: 500,
|
|
222
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
223
|
+
}, 'Color Temperature');
|
|
224
|
+
this.createCharacteristicClass('ColorTemperatureKelvin', 'A18E5901-CFA1-4D37-A10F-0071CEEEEEBD', {
|
|
225
|
+
format: this.Formats.UINT16,
|
|
226
|
+
unit: 'K',
|
|
227
|
+
minValue: 2000,
|
|
228
|
+
maxValue: 6536,
|
|
229
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
|
|
230
|
+
}, 'Color Temperature');
|
|
231
|
+
this.createCharacteristicClass('Condition', 'CD65A9AB-85AD-494A-B2BD-2F380084134D', {
|
|
232
|
+
format: this.Formats.STRING,
|
|
233
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
234
|
+
});
|
|
235
|
+
this.createCharacteristicClass('ConditionCategory', 'CD65A9AB-85AD-494A-B2BD-2F380084134C', {
|
|
236
|
+
format: this.Formats.UINT16,
|
|
237
|
+
mavValue: 999,
|
|
238
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
239
|
+
}, 'Condition Category');
|
|
240
|
+
this.createCharacteristicClass('CurrentTemperature', this.hapCharacteristics.CurrentTemperature.UUID, {
|
|
241
|
+
format: this.Formats.FLOAT,
|
|
242
|
+
unit: this.Units.CELSIUS,
|
|
243
|
+
minValue: -40,
|
|
244
|
+
maxValue: 100,
|
|
245
|
+
minStep: 0.1,
|
|
246
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
247
|
+
}, 'Current Temperature');
|
|
248
|
+
this.createCharacteristicClass('Day', '57F1D4B2-0E7E-4307-95B5-808750E2C1C7', {
|
|
249
|
+
format: this.Formats.STRING,
|
|
250
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
251
|
+
});
|
|
252
|
+
this.createCharacteristicClass('DewPoint', '095C46E2-278E-4E3C-B9E7-364622A0F501', {
|
|
253
|
+
format: this.Formats.FLOAT,
|
|
254
|
+
unit: this.Units.CELSIUS,
|
|
255
|
+
minValue: -40,
|
|
256
|
+
maxValue: 100,
|
|
257
|
+
minStep: 0.1,
|
|
258
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
259
|
+
}, 'Dew Point');
|
|
260
|
+
this.createCharacteristicClass('MaximumWindSpeed', '6B8861E5-D6F3-425C-83B6-069945FFD1F1', {
|
|
261
|
+
format: this.Formats.FLOAT,
|
|
262
|
+
unit: 'm/s',
|
|
263
|
+
minValue: 0,
|
|
264
|
+
maxValue: 150,
|
|
265
|
+
minStep: 0.1,
|
|
266
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
267
|
+
}, 'Maximum Wind Speed');
|
|
268
|
+
this.createCharacteristicClass('MinimumTemperature', '707B78CA-51AB-4DC9-8630-80A58F07E419', {
|
|
269
|
+
format: this.Formats.FLOAT,
|
|
270
|
+
unit: this.Units.CELSIUS,
|
|
271
|
+
minValue: -40,
|
|
272
|
+
maxValue: 100,
|
|
273
|
+
minStep: 0.1,
|
|
274
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
275
|
+
}, 'Minimum Temperature');
|
|
276
|
+
this.createCharacteristicClass('ObservationTime', '234FD9F1-1D33-4128-B622-D052F0C402AF', {
|
|
277
|
+
format: this.Formats.STRING,
|
|
278
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
279
|
+
}, 'Observation Time');
|
|
280
|
+
this.createCharacteristicClass('Ozone', 'BBEFFDDD-1BCD-4D75-B7CD-B57A90A04D13', {
|
|
281
|
+
format: this.Formats.UINT16,
|
|
282
|
+
unit: 'DU',
|
|
283
|
+
minValue: 0,
|
|
284
|
+
maxValue: 500,
|
|
285
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
286
|
+
});
|
|
287
|
+
this.createCharacteristicClass('Rain', 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7', {
|
|
288
|
+
format: this.Formats.BOOL,
|
|
289
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
290
|
+
});
|
|
291
|
+
this.createCharacteristicClass('Rain1h', '10C88F40-7EC4-478C-8D5A-BD0C3CCE14B7', {
|
|
292
|
+
format: this.Formats.UINT16,
|
|
293
|
+
unit: 'mm',
|
|
294
|
+
minValue: 0,
|
|
295
|
+
maxValue: 200,
|
|
296
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
297
|
+
}, 'Rain Last Hour');
|
|
298
|
+
this.createCharacteristicClass('Rain24h', 'CCC04890-565B-4376-B39A-3113341D9E0F', {
|
|
299
|
+
format: this.Formats.UINT16,
|
|
300
|
+
unit: 'mm',
|
|
301
|
+
minValue: 0,
|
|
302
|
+
maxValue: 2000,
|
|
303
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
304
|
+
}, 'Total Rain');
|
|
305
|
+
this.createCharacteristicClass('RainProbability', 'FC01B24F-CF7E-4A74-90DB-1B427AF1FFA3', {
|
|
306
|
+
format: this.Formats.UINT8,
|
|
307
|
+
unit: this.Units.PERCENTAGE,
|
|
308
|
+
minValue: 0,
|
|
309
|
+
maxValue: 100,
|
|
310
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
311
|
+
}, 'Rain Probabiliy');
|
|
312
|
+
this.createCharacteristicClass('Snow', 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD', {
|
|
313
|
+
format: this.Formats.BOOL,
|
|
314
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
315
|
+
});
|
|
316
|
+
this.createCharacteristicClass('UvIndex', '05BA0FE0-B848-4226-906D-5B64272E05CE', {
|
|
317
|
+
format: this.Formats.UINT8,
|
|
318
|
+
minValue: 0,
|
|
319
|
+
maxValue: 10,
|
|
320
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
321
|
+
}, 'UV Index');
|
|
322
|
+
this.createCharacteristicClass('Visibility', 'D24ECC1E-6FAD-4FB5-8137-5AF88BD5E857', {
|
|
323
|
+
format: this.Formats.UINT8,
|
|
324
|
+
minValue: 0,
|
|
325
|
+
maxValue: 100,
|
|
326
|
+
unit: 'km',
|
|
327
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
328
|
+
});
|
|
329
|
+
this.createCharacteristicClass('WindDirection', '46F1284C-1912-421B-82F5-EB75008B167E', {
|
|
330
|
+
format: this.Formats.STRING,
|
|
331
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
332
|
+
}, 'Wind Direction');
|
|
333
|
+
this.createCharacteristicClass('WindSpeed', '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41', {
|
|
334
|
+
format: this.Formats.FLOAT,
|
|
335
|
+
unit: 'm/s',
|
|
336
|
+
minValue: 0,
|
|
337
|
+
maxValue: 150,
|
|
338
|
+
minStep: 0.1,
|
|
339
|
+
perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY]
|
|
340
|
+
}, 'Wind Speed');
|
|
341
|
+
this.createServiceClass('Weather', uuid('001'), [
|
|
342
|
+
this.Characteristics.CurrentTemperature
|
|
343
|
+
], [
|
|
344
|
+
this.hapCharacteristics.CurrentRelativeHumidity,
|
|
345
|
+
this.Characteristics.AirPressure
|
|
346
|
+
]);
|
|
347
|
+
this.createServiceClass('History', uuid('007'), [
|
|
348
|
+
this.Characteristics.HistoryStatus,
|
|
349
|
+
this.Characteristics.HistoryEntries,
|
|
350
|
+
this.Characteristics.HistoryRequest,
|
|
351
|
+
this.Characteristics.SetTime
|
|
352
|
+
], [
|
|
353
|
+
this.Characteristics.ResetTotal
|
|
354
|
+
]);
|
|
355
|
+
this.createServiceClass('Consumption', uuid('008'), [], [
|
|
356
|
+
this.Characteristics.Voltage,
|
|
357
|
+
this.Characteristics.TotalConsumption,
|
|
358
|
+
this.Characteristics.Consumption,
|
|
359
|
+
this.Characteristics.ElectricCurrent,
|
|
360
|
+
this.hapCharacteristics.StatusFault,
|
|
361
|
+
this.hapCharacteristics.LockPhysicalControls
|
|
362
|
+
]);
|
|
363
|
+
this.createServiceClass('AirPressureSensor', uuid('00A'), [
|
|
364
|
+
this.Characteristics.AirPressure,
|
|
365
|
+
this.Characteristics.Elevation
|
|
366
|
+
]);
|
|
367
|
+
this.createServiceClass('ContactSensor', this.hapServices.ContactSensor.UUID, [
|
|
368
|
+
this.hapCharacteristics.ContactSensorState,
|
|
369
|
+
this.Characteristics.TimesOpened,
|
|
370
|
+
this.Characteristics.OpenDuration,
|
|
371
|
+
this.Characteristics.ClosedDuration,
|
|
372
|
+
this.Characteristics.LastActivation
|
|
373
|
+
]);
|
|
374
|
+
this.createServiceClass('MotionSensor', this.hapServices.MotionSensor.UUID, [
|
|
375
|
+
this.hapCharacteristics.MotionDetected,
|
|
376
|
+
this.Characteristics.Sensitivity,
|
|
377
|
+
this.Characteristics.Duration,
|
|
378
|
+
this.Characteristics.LastActivation
|
|
379
|
+
]);
|
|
380
|
+
this.createServiceClass('Outlet', this.hapServices.Outlet.UUID, [
|
|
381
|
+
this.hapCharacteristics.On,
|
|
382
|
+
this.hapCharacteristics.InUse,
|
|
383
|
+
this.Characteristics.Voltage,
|
|
384
|
+
this.Characteristics.ElectricCurrent,
|
|
385
|
+
this.Characteristics.Consumption,
|
|
386
|
+
this.Characteristics.TotalConsumption
|
|
387
|
+
]);
|
|
388
|
+
this.createServiceClass('TemperatureSensor', this.hapServices.TemperatureSensor.UUID, [
|
|
389
|
+
this.Characteristics.CurrentTemperature,
|
|
390
|
+
this.hapCharacteristics.TemperatureDisplayUnits
|
|
391
|
+
]);
|
|
392
|
+
this.createServiceClass('Thermostat', this.hapServices.Thermostat.UUID, [
|
|
393
|
+
this.hapCharacteristics.CurrentHeatingCoolingState,
|
|
394
|
+
this.hapCharacteristics.TargetHeatingCoolingState,
|
|
395
|
+
this.Characteristics.CurrentTemperature,
|
|
396
|
+
this.hapCharacteristics.TargetTemperature,
|
|
397
|
+
this.hapCharacteristics.TemperatureDisplayUnits,
|
|
398
|
+
this.Characteristics.ValvePosition
|
|
399
|
+
], [
|
|
400
|
+
this.Characteristics.ProgramCommand,
|
|
401
|
+
this.Characteristics.ProgramData
|
|
402
|
+
]);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
export { EveHomeKitTypes };
|
|
406
|
+
//# sourceMappingURL=EveHomeKitTypes.mjs.map
|