node-red-contrib-homekit-bridged 1.7.0-dev.3 → 1.7.0-dev.4
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/build/lib/api.js +11 -10
- package/build/lib/hap/HAPCharacteristic.d.ts +9 -0
- package/build/lib/hap/HAPCharacteristic.js +6 -0
- package/build/lib/hap/HAPService.d.ts +6 -0
- package/build/lib/hap/HAPService.js +6 -0
- package/build/lib/hap/eve-app/EveCharacteristics.d.ts +20 -0
- package/build/lib/hap/eve-app/EveCharacteristics.js +89 -0
- package/build/lib/hap/eve-app/EveServices.d.ts +5 -0
- package/build/lib/hap/eve-app/EveServices.js +20 -0
- package/package.json +1 -1
package/build/lib/api.js
CHANGED
|
@@ -25,6 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const logger_1 = require("@nrchkb/logger");
|
|
27
27
|
const hap_nodejs_1 = require("hap-nodejs");
|
|
28
|
+
const EveCharacteristics_1 = __importDefault(require("./hap/eve-app/EveCharacteristics"));
|
|
28
29
|
const Storage_1 = require("./Storage");
|
|
29
30
|
const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
|
|
30
31
|
const version = require('../../package.json').version.trim();
|
|
@@ -127,9 +128,9 @@ module.exports = function (RED) {
|
|
|
127
128
|
});
|
|
128
129
|
};
|
|
129
130
|
const _initNRCHKBCustomCharacteristicsAPI = () => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
const getCustomCharacteristics = () => {
|
|
131
|
-
|
|
132
|
-
.
|
|
131
|
+
const getCustomCharacteristics = () => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
try {
|
|
133
|
+
const value = yield Storage_1.Storage.loadCustomCharacteristics();
|
|
133
134
|
log.trace('loadCustomCharacteristics()');
|
|
134
135
|
log.trace(value);
|
|
135
136
|
if (Array.isArray(value)) {
|
|
@@ -137,14 +138,14 @@ module.exports = function (RED) {
|
|
|
137
138
|
}
|
|
138
139
|
else {
|
|
139
140
|
log.debug('customCharacteristics is not Array, returning empty value');
|
|
140
|
-
return
|
|
141
|
+
return EveCharacteristics_1.default;
|
|
141
142
|
}
|
|
142
|
-
}
|
|
143
|
-
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
144
145
|
log.error(`Failed to get customCharacteristics in nrchkbStorage due to ${error}`);
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
};
|
|
146
|
+
return EveCharacteristics_1.default;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
148
149
|
const characteristicNameToKey = (name) => {
|
|
149
150
|
return name.replace(' ', '');
|
|
150
151
|
};
|
|
@@ -260,7 +261,7 @@ module.exports = function (RED) {
|
|
|
260
261
|
});
|
|
261
262
|
}));
|
|
262
263
|
RED.httpAdmin.post('/nrchkb/config', RED.auth.needsPermission('nrchkb.write'), (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
263
|
-
const customCharacteristics = req.body.customCharacteristics ||
|
|
264
|
+
const customCharacteristics = req.body.customCharacteristics || EveCharacteristics_1.default;
|
|
264
265
|
Storage_1.Storage.saveCustomCharacteristics(customCharacteristics)
|
|
265
266
|
.then(() => {
|
|
266
267
|
res.sendStatus(200);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Characteristic } from 'hap-nodejs';
|
|
2
|
+
import { EveS2R1, EveS2R2, EveS2W1, EveS2W2 } from './eve-app/EveCharacteristics';
|
|
3
|
+
declare class HAPCharacteristic extends Characteristic {
|
|
4
|
+
static EveS2R1: typeof EveS2R1;
|
|
5
|
+
static EveS2R2: typeof EveS2R2;
|
|
6
|
+
static EveS2W1: typeof EveS2W1;
|
|
7
|
+
static EveS2W2: typeof EveS2W2;
|
|
8
|
+
}
|
|
9
|
+
export default HAPCharacteristic;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import CustomCharacteristicType from '../../types/CustomCharacteristicType';
|
|
2
|
+
import HAPCharacteristic from '../HAPCharacteristic';
|
|
3
|
+
declare const EveCharacteristics: CustomCharacteristicType[];
|
|
4
|
+
export declare class EveS2R1 extends HAPCharacteristic {
|
|
5
|
+
static readonly UUID: string;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare class EveS2R2 extends HAPCharacteristic {
|
|
9
|
+
static readonly UUID: string;
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export declare class EveS2W1 extends HAPCharacteristic {
|
|
13
|
+
static readonly UUID: string;
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
export declare class EveS2W2 extends HAPCharacteristic {
|
|
17
|
+
static readonly UUID: string;
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
20
|
+
export default EveCharacteristics;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EveS2W2 = exports.EveS2W1 = exports.EveS2R2 = exports.EveS2R1 = void 0;
|
|
7
|
+
const HAPCharacteristic_1 = __importDefault(require("../HAPCharacteristic"));
|
|
8
|
+
const EveCharacteristics = [
|
|
9
|
+
{
|
|
10
|
+
UUID: 'E863F10A-079E-48FF-8F27-9C2605A29F52',
|
|
11
|
+
name: 'Eve-Volt',
|
|
12
|
+
format: "float",
|
|
13
|
+
perms: ["pr"],
|
|
14
|
+
description: 'Volt (V) value. Used by Eve.app.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
UUID: 'E863F126-079E-48FF-8F27-9C2605A29F52',
|
|
18
|
+
name: 'Eve-Ampere',
|
|
19
|
+
format: "float",
|
|
20
|
+
perms: ["pr"],
|
|
21
|
+
description: 'Ampere (A) value. Used by Eve.app.',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
UUID: 'E863F10D-079E-48FF-8F27-9C2605A29F52',
|
|
25
|
+
name: 'Eve-Watt',
|
|
26
|
+
format: "float",
|
|
27
|
+
perms: ["pr"],
|
|
28
|
+
description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
UUID: 'E863F10C-079E-48FF-8F27-9C2605A29F52',
|
|
32
|
+
name: 'Eve-Kilowatt-hour',
|
|
33
|
+
format: "float",
|
|
34
|
+
perms: ["pr"],
|
|
35
|
+
description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
UUID: 'E863F110-079E-48FF-8F27-9C2605A29F52',
|
|
39
|
+
name: 'Eve-Volt-Ampere',
|
|
40
|
+
format: "uint16",
|
|
41
|
+
perms: ["pr"],
|
|
42
|
+
description: 'Volt-Ampere (VA) value. Used by Eve.app.',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
class EveS2R1 extends HAPCharacteristic_1.default {
|
|
46
|
+
constructor() {
|
|
47
|
+
super('Eve-S2R1', EveS2R1.UUID, {
|
|
48
|
+
format: "data",
|
|
49
|
+
perms: ["pr", "ev", "hd"],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.EveS2R1 = EveS2R1;
|
|
54
|
+
EveS2R1.UUID = 'E863F116-079E-48FF-8F27-9C2605A29F52';
|
|
55
|
+
HAPCharacteristic_1.default.EveS2R1 = EveS2R1;
|
|
56
|
+
class EveS2R2 extends HAPCharacteristic_1.default {
|
|
57
|
+
constructor() {
|
|
58
|
+
super('Eve-S2R2', EveS2R2.UUID, {
|
|
59
|
+
format: "data",
|
|
60
|
+
perms: ["pr", "ev", "hd"],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.EveS2R2 = EveS2R2;
|
|
65
|
+
EveS2R2.UUID = 'E863F117-079E-48FF-8F27-9C2605A29F52';
|
|
66
|
+
HAPCharacteristic_1.default.EveS2R2 = EveS2R2;
|
|
67
|
+
class EveS2W1 extends HAPCharacteristic_1.default {
|
|
68
|
+
constructor() {
|
|
69
|
+
super('Eve-S2W1', EveS2W1.UUID, {
|
|
70
|
+
format: "data",
|
|
71
|
+
perms: ["pw", "hd"],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.EveS2W1 = EveS2W1;
|
|
76
|
+
EveS2W1.UUID = 'E863F11C-079E-48FF-8F27-9C2605A29F52';
|
|
77
|
+
HAPCharacteristic_1.default.EveS2W1 = EveS2W1;
|
|
78
|
+
class EveS2W2 extends HAPCharacteristic_1.default {
|
|
79
|
+
constructor() {
|
|
80
|
+
super('Eve-S2W2', EveS2W2.UUID, {
|
|
81
|
+
format: "data",
|
|
82
|
+
perms: ["pw", "hd"],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.EveS2W2 = EveS2W2;
|
|
87
|
+
EveS2W2.UUID = 'E863F121-079E-48FF-8F27-9C2605A29F52';
|
|
88
|
+
HAPCharacteristic_1.default.EveS2W2 = EveS2W2;
|
|
89
|
+
exports.default = EveCharacteristics;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EveHistoryData = void 0;
|
|
7
|
+
const HAPCharacteristic_1 = __importDefault(require("../HAPCharacteristic"));
|
|
8
|
+
const HAPService_1 = __importDefault(require("../HAPService"));
|
|
9
|
+
class EveHistoryData extends HAPService_1.default {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('EveHistoryData', EveHistoryData.UUID);
|
|
12
|
+
this.addCharacteristic(HAPCharacteristic_1.default.EveS2R1);
|
|
13
|
+
this.addCharacteristic(HAPCharacteristic_1.default.EveS2R2);
|
|
14
|
+
this.addCharacteristic(HAPCharacteristic_1.default.EveS2W1);
|
|
15
|
+
this.addCharacteristic(HAPCharacteristic_1.default.EveS2W2);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.EveHistoryData = EveHistoryData;
|
|
19
|
+
EveHistoryData.UUID = 'E863F007-079E-48FF-8F27-9C2605A29F52';
|
|
20
|
+
HAPService_1.default.EveHistoryData = EveHistoryData;
|