node-red-contrib-homekit-bridged 1.7.0-dev.3 → 1.7.0-dev.5
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/build/nodes/service.html +5 -6
- package/build/nodes/service2.html +5 -6
- 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;
|
package/build/nodes/service.html
CHANGED
|
@@ -203,13 +203,14 @@
|
|
|
203
203
|
<div class="form-row">
|
|
204
204
|
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
-
<option value="
|
|
206
|
+
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
|
+
<option value="1">AUTOMATIC</option>
|
|
207
208
|
<option value="2" disabled>MANUAL</option>
|
|
208
209
|
</select>
|
|
209
210
|
</div>
|
|
210
211
|
<div class="form-row">
|
|
211
212
|
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
-
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment" placeholder="0">
|
|
213
214
|
</div>
|
|
214
215
|
</div>
|
|
215
216
|
|
|
@@ -498,12 +499,10 @@
|
|
|
498
499
|
value: false,
|
|
499
500
|
},
|
|
500
501
|
adaptiveLightingOptionsMode: {
|
|
501
|
-
|
|
502
|
-
validate: RED.validators.number()
|
|
502
|
+
validate: RED.validators.number(true)
|
|
503
503
|
},
|
|
504
504
|
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
505
|
-
|
|
506
|
-
validate: RED.validators.number()
|
|
505
|
+
validate: RED.validators.number(true)
|
|
507
506
|
},
|
|
508
507
|
},
|
|
509
508
|
inputs: 1,
|
|
@@ -203,13 +203,14 @@
|
|
|
203
203
|
<div class="form-row">
|
|
204
204
|
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
-
<option value="
|
|
206
|
+
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
|
+
<option value="1">AUTOMATIC</option>
|
|
207
208
|
<option value="2" disabled>MANUAL</option>
|
|
208
209
|
</select>
|
|
209
210
|
</div>
|
|
210
211
|
<div class="form-row">
|
|
211
212
|
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
-
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment" placeholder="0">
|
|
213
214
|
</div>
|
|
214
215
|
</div>
|
|
215
216
|
|
|
@@ -508,12 +509,10 @@ if (nrchkbExperimental) {
|
|
|
508
509
|
value: false,
|
|
509
510
|
},
|
|
510
511
|
adaptiveLightingOptionsMode: {
|
|
511
|
-
|
|
512
|
-
validate: RED.validators.number()
|
|
512
|
+
validate: RED.validators.number(true)
|
|
513
513
|
},
|
|
514
514
|
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
515
|
-
|
|
516
|
-
validate: RED.validators.number()
|
|
515
|
+
validate: RED.validators.number(true)
|
|
517
516
|
},
|
|
518
517
|
},
|
|
519
518
|
inputs: 1,
|