node-red-contrib-homekit-bridged 1.7.3 → 2.0.0-dev.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/build/lib/HAPHostNode.js +11 -41
- package/build/lib/HAPServiceNode.js +6 -6
- package/build/lib/HAPServiceNode2.js +6 -6
- package/build/lib/Storage.d.ts +1 -1
- package/build/lib/api.js +20 -18
- package/build/lib/hap/HAPCharacteristic.d.ts +1 -1
- package/build/lib/hap/HAPCharacteristic.js +1 -1
- package/build/lib/hap/HAPService.d.ts +1 -1
- package/build/lib/hap/HAPService.js +1 -1
- package/build/lib/hap/eve-app/EveCharacteristics.js +10 -10
- package/build/lib/types/CustomCharacteristicType.d.ts +1 -1
- package/build/lib/types/HAPHostConfigType.d.ts +1 -9
- package/build/lib/types/HAPHostNodeType.d.ts +1 -3
- package/build/lib/types/HAPServiceConfigType.d.ts +1 -1
- package/build/lib/types/HAPServiceNodeType.d.ts +5 -4
- package/build/lib/types/storage/SerializedHostType.d.ts +1 -1
- package/build/lib/utils/AccessoryUtils.js +8 -6
- package/build/lib/utils/BridgeUtils.js +2 -2
- package/build/lib/utils/CharacteristicUtils.js +2 -2
- package/build/lib/utils/CharacteristicUtils2.js +2 -2
- package/build/lib/utils/ServiceUtils.js +21 -26
- package/build/lib/utils/ServiceUtils2.js +17 -20
- package/build/lib/utils/index.js +1 -3
- package/build/nodes/nrchkb.js +1 -1
- package/build/nodes/status.js +4 -4
- package/examples/demo/01 - ALL Demos single import.json +64 -318
- package/examples/demo/02 - Air Purifier.json +279 -328
- package/examples/demo/03 - Air Quality sensor with Battery.json +254 -282
- package/examples/demo/04 - Dimmable Bulb.json +172 -189
- package/examples/demo/05 - Color Bulb (HSV).json +195 -216
- package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -265
- package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -192
- package/examples/demo/08 - CO2 detector.json +224 -255
- package/examples/demo/09 - CO (carbon monoxide) example.json +255 -290
- package/examples/demo/10 - Door window contact sensor.json +234 -265
- package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -607
- package/examples/switch/01 - Plain Switch.json +7 -27
- package/package.json +82 -81
- package/build/lib/cameraSource/index.d.ts +0 -1
- package/build/lib/cameraSource/index.js +0 -477
- package/build/lib/types/hap-nodejs/BonjourMulticastOptions.d.ts +0 -10
- package/build/lib/types/hap-nodejs/BonjourMulticastOptions.js +0 -2
- package/build/lib/utils/MdnsUtils.d.ts +0 -1
- package/build/lib/utils/MdnsUtils.js +0 -93
package/build/lib/HAPHostNode.js
CHANGED
|
@@ -12,17 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
15
16
|
const logger_1 = require("@nrchkb/logger");
|
|
16
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
17
17
|
const semver_1 = require("semver");
|
|
18
18
|
const preload_1 = __importDefault(require("semver/preload"));
|
|
19
19
|
const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
|
|
20
20
|
const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
|
|
21
21
|
const HostType_1 = __importDefault(require("./types/HostType"));
|
|
22
22
|
module.exports = (RED, hostType) => {
|
|
23
|
-
const MdnsUtils = require('./utils/MdnsUtils')();
|
|
24
23
|
const init = function (config) {
|
|
25
|
-
var _a, _b, _c
|
|
24
|
+
var _a, _b, _c;
|
|
26
25
|
const self = this;
|
|
27
26
|
const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode', config.bridgeName, self);
|
|
28
27
|
self.hostType = hostType;
|
|
@@ -36,31 +35,6 @@ module.exports = (RED, hostType) => {
|
|
|
36
35
|
if (preload_1.default.parse(config.firmwareRev) == null) {
|
|
37
36
|
config.firmwareRev = new semver_1.SemVer('0.0.0');
|
|
38
37
|
}
|
|
39
|
-
if (!((_a = config.bind) === null || _a === void 0 ? void 0 : _a.length) && config.customMdnsConfig) {
|
|
40
|
-
log.error('Custom mdns config is deprecated, use bind instead!');
|
|
41
|
-
self.mdnsConfig = {};
|
|
42
|
-
if (MdnsUtils.checkMulticast(config.mdnsMulticast)) {
|
|
43
|
-
self.mdnsConfig.multicast = config.mdnsMulticast;
|
|
44
|
-
}
|
|
45
|
-
if (MdnsUtils.checkInterface(config.mdnsInterface)) {
|
|
46
|
-
self.mdnsConfig.interface = config.mdnsInterface;
|
|
47
|
-
}
|
|
48
|
-
if (MdnsUtils.checkPort(config.mdnsPort)) {
|
|
49
|
-
self.mdnsConfig.port = parseInt((_b = config.mdnsPort) === null || _b === void 0 ? void 0 : _b.toString());
|
|
50
|
-
}
|
|
51
|
-
if (MdnsUtils.checkIp(config.mdnsIp)) {
|
|
52
|
-
self.mdnsConfig.ip = config.mdnsIp;
|
|
53
|
-
}
|
|
54
|
-
if (MdnsUtils.checkTtl(config.mdnsTtl)) {
|
|
55
|
-
self.mdnsConfig.ttl = parseInt((_c = config.mdnsTtl) === null || _c === void 0 ? void 0 : _c.toString());
|
|
56
|
-
}
|
|
57
|
-
if (MdnsUtils.checkLoopback(config.mdnsLoopback)) {
|
|
58
|
-
self.mdnsConfig.loopback = config.mdnsLoopback;
|
|
59
|
-
}
|
|
60
|
-
if (MdnsUtils.checkReuseAddr(config.mdnsReuseAddr)) {
|
|
61
|
-
self.mdnsConfig.reuseAddr = config.mdnsReuseAddr;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
38
|
self.accessoryCategory = (self.hostType == HostType_1.default.BRIDGE
|
|
65
39
|
? HapCategories_1.default.BRIDGE
|
|
66
40
|
: self.config.accessoryCategory);
|
|
@@ -82,15 +56,14 @@ module.exports = (RED, hostType) => {
|
|
|
82
56
|
self.host = new hap_nodejs_1.Accessory(self.name, hostUUID);
|
|
83
57
|
}
|
|
84
58
|
self.publish = function () {
|
|
85
|
-
var _a, _b
|
|
59
|
+
var _a, _b;
|
|
86
60
|
if (self.hostType == HostType_1.default.BRIDGE) {
|
|
87
61
|
log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode} and ${self.host.bridgedAccessories.length} accessories`);
|
|
88
62
|
}
|
|
89
63
|
else {
|
|
90
64
|
log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode}`);
|
|
91
65
|
}
|
|
92
|
-
if (
|
|
93
|
-
(((_a = self.mdnsConfig) === null || _a === void 0 ? void 0 : _a.port) && ((_b = self.mdnsConfig) === null || _b === void 0 ? void 0 : _b.port) == 1880)) {
|
|
66
|
+
if (self.config.port && self.config.port == 1880) {
|
|
94
67
|
log.error(`Cannot publish on ${hostTypeName} port 1880 as it is reserved for node-red`);
|
|
95
68
|
self.published = false;
|
|
96
69
|
return false;
|
|
@@ -101,7 +74,7 @@ module.exports = (RED, hostType) => {
|
|
|
101
74
|
oldPinCode = `${oldPinCode.slice(0, 3)}-${oldPinCode.slice(3, 5)}-${oldPinCode.slice(5, 8)}`;
|
|
102
75
|
}
|
|
103
76
|
let bind;
|
|
104
|
-
if (((
|
|
77
|
+
if (((_a = self.config.bind) === null || _a === void 0 ? void 0 : _a.length) && self.config.bindType) {
|
|
105
78
|
if (self.config.bindType == 'str') {
|
|
106
79
|
bind = self.config.bind;
|
|
107
80
|
}
|
|
@@ -111,14 +84,11 @@ module.exports = (RED, hostType) => {
|
|
|
111
84
|
}
|
|
112
85
|
self.host.publish({
|
|
113
86
|
username: self.bridgeUsername,
|
|
114
|
-
port: self.config.port && !isNaN(self.config.port)
|
|
115
|
-
? self.config.port
|
|
116
|
-
: 0,
|
|
87
|
+
port: self.config.port && !isNaN(self.config.port) ? self.config.port : 0,
|
|
117
88
|
pincode: oldPinCode,
|
|
118
89
|
category: self.accessoryCategory,
|
|
119
|
-
mdns: self.mdnsConfig,
|
|
120
90
|
bind: bind,
|
|
121
|
-
advertiser: (
|
|
91
|
+
advertiser: (_b = self.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap"
|
|
122
92
|
}, self.config.allowInsecureRequest);
|
|
123
93
|
self.published = true;
|
|
124
94
|
return true;
|
|
@@ -152,9 +122,9 @@ module.exports = (RED, hostType) => {
|
|
|
152
122
|
.setCharacteristic(hap_nodejs_1.Characteristic.Manufacturer, self.config.manufacturer)
|
|
153
123
|
.setCharacteristic(hap_nodejs_1.Characteristic.SerialNumber, self.config.serialNo)
|
|
154
124
|
.setCharacteristic(hap_nodejs_1.Characteristic.Model, self.config.model)
|
|
155
|
-
.setCharacteristic(hap_nodejs_1.Characteristic.FirmwareRevision, (
|
|
156
|
-
.setCharacteristic(hap_nodejs_1.Characteristic.HardwareRevision, (
|
|
157
|
-
.setCharacteristic(hap_nodejs_1.Characteristic.SoftwareRevision, (
|
|
125
|
+
.setCharacteristic(hap_nodejs_1.Characteristic.FirmwareRevision, (_a = self.config.firmwareRev) === null || _a === void 0 ? void 0 : _a.toString())
|
|
126
|
+
.setCharacteristic(hap_nodejs_1.Characteristic.HardwareRevision, (_b = self.config.hardwareRev) === null || _b === void 0 ? void 0 : _b.toString())
|
|
127
|
+
.setCharacteristic(hap_nodejs_1.Characteristic.SoftwareRevision, (_c = self.config.softwareRev) === null || _c === void 0 ? void 0 : _c.toString());
|
|
158
128
|
};
|
|
159
129
|
const macify = (nodeId) => {
|
|
160
130
|
if (nodeId) {
|
|
@@ -177,6 +147,6 @@ module.exports = (RED, hostType) => {
|
|
|
177
147
|
};
|
|
178
148
|
return {
|
|
179
149
|
init,
|
|
180
|
-
macify
|
|
150
|
+
macify
|
|
181
151
|
};
|
|
182
152
|
};
|
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
6
7
|
const logger_1 = require("@nrchkb/logger");
|
|
7
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
8
8
|
const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
|
|
9
9
|
const HostType_1 = __importDefault(require("./types/HostType"));
|
|
10
10
|
const NodeStatusUtils_1 = require("./utils/NodeStatusUtils");
|
|
@@ -39,7 +39,7 @@ module.exports = (RED) => {
|
|
|
39
39
|
self.nodeStatusUtils.setStatus({
|
|
40
40
|
fill: 'blue',
|
|
41
41
|
shape: 'dot',
|
|
42
|
-
text: 'Waiting for Setup'
|
|
42
|
+
text: 'Waiting for Setup'
|
|
43
43
|
});
|
|
44
44
|
self.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(self.config, msg, resolve);
|
|
45
45
|
self.on('input', self.handleWaitForSetup);
|
|
@@ -145,7 +145,7 @@ module.exports = (RED) => {
|
|
|
145
145
|
model: self.config.model,
|
|
146
146
|
firmwareRev: self.config.firmwareRev,
|
|
147
147
|
hardwareRev: self.config.hardwareRev,
|
|
148
|
-
softwareRev: self.config.softwareRev
|
|
148
|
+
softwareRev: self.config.softwareRev
|
|
149
149
|
}, subtypeUUID);
|
|
150
150
|
self.onIdentify = AccessoryUtils.onIdentify;
|
|
151
151
|
self.accessory.on('identify', self.onIdentify);
|
|
@@ -159,7 +159,7 @@ module.exports = (RED) => {
|
|
|
159
159
|
name: self.name,
|
|
160
160
|
UUID: subtypeUUID,
|
|
161
161
|
serviceName: self.config.serviceName,
|
|
162
|
-
config: self.config
|
|
162
|
+
config: self.config
|
|
163
163
|
}, self.parentService);
|
|
164
164
|
self.characteristicProperties = CharacteristicUtils.load(self.service, self.config);
|
|
165
165
|
ServiceUtils.configureAdaptiveLightning();
|
|
@@ -169,7 +169,7 @@ module.exports = (RED) => {
|
|
|
169
169
|
self.nodeStatusUtils.setStatus({
|
|
170
170
|
fill: 'yellow',
|
|
171
171
|
shape: 'ring',
|
|
172
|
-
text: self.hostNode.config.pinCode
|
|
172
|
+
text: self.hostNode.config.pinCode
|
|
173
173
|
});
|
|
174
174
|
self.supported = CharacteristicUtils.subscribeAndGetSupported(self.service);
|
|
175
175
|
self.on('input', ServiceUtils.onInput);
|
|
@@ -177,6 +177,6 @@ module.exports = (RED) => {
|
|
|
177
177
|
};
|
|
178
178
|
return {
|
|
179
179
|
preInit,
|
|
180
|
-
init
|
|
180
|
+
init
|
|
181
181
|
};
|
|
182
182
|
};
|
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
6
7
|
const logger_1 = require("@nrchkb/logger");
|
|
7
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
8
8
|
const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
|
|
9
9
|
const HostType_1 = __importDefault(require("./types/HostType"));
|
|
10
10
|
const NodeStatusUtils_1 = require("./utils/NodeStatusUtils");
|
|
@@ -39,7 +39,7 @@ module.exports = (RED) => {
|
|
|
39
39
|
self.nodeStatusUtils.setStatus({
|
|
40
40
|
fill: 'blue',
|
|
41
41
|
shape: 'dot',
|
|
42
|
-
text: 'Waiting for Setup'
|
|
42
|
+
text: 'Waiting for Setup'
|
|
43
43
|
});
|
|
44
44
|
self.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(self.config, msg, resolve);
|
|
45
45
|
self.on('input', self.handleWaitForSetup);
|
|
@@ -145,7 +145,7 @@ module.exports = (RED) => {
|
|
|
145
145
|
model: self.config.model,
|
|
146
146
|
firmwareRev: self.config.firmwareRev,
|
|
147
147
|
hardwareRev: self.config.hardwareRev,
|
|
148
|
-
softwareRev: self.config.softwareRev
|
|
148
|
+
softwareRev: self.config.softwareRev
|
|
149
149
|
}, subtypeUUID);
|
|
150
150
|
self.onIdentify = AccessoryUtils.onIdentify;
|
|
151
151
|
self.accessory.on('identify', self.onIdentify);
|
|
@@ -159,7 +159,7 @@ module.exports = (RED) => {
|
|
|
159
159
|
name: self.name,
|
|
160
160
|
UUID: subtypeUUID,
|
|
161
161
|
serviceName: self.config.serviceName,
|
|
162
|
-
config: self.config
|
|
162
|
+
config: self.config
|
|
163
163
|
}, self.parentService);
|
|
164
164
|
self.characteristicProperties = CharacteristicUtils.load(self.service, self.config);
|
|
165
165
|
ServiceUtils.configureAdaptiveLightning();
|
|
@@ -169,7 +169,7 @@ module.exports = (RED) => {
|
|
|
169
169
|
self.nodeStatusUtils.setStatus({
|
|
170
170
|
fill: 'yellow',
|
|
171
171
|
shape: 'ring',
|
|
172
|
-
text: self.hostNode.config.pinCode
|
|
172
|
+
text: self.hostNode.config.pinCode
|
|
173
173
|
});
|
|
174
174
|
self.supported = CharacteristicUtils.subscribeAndGetSupported(self.service);
|
|
175
175
|
self.on('input', ServiceUtils.onInput);
|
|
@@ -177,6 +177,6 @@ module.exports = (RED) => {
|
|
|
177
177
|
};
|
|
178
178
|
return {
|
|
179
179
|
preInit,
|
|
180
|
-
init
|
|
180
|
+
init
|
|
181
181
|
};
|
|
182
182
|
};
|
package/build/lib/Storage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CharacteristicEventTypes, SerializedAccessory, SerializedService } from 'hap-nodejs';
|
|
1
|
+
import { CharacteristicEventTypes, SerializedAccessory, SerializedService } from '@homebridge/hap-nodejs';
|
|
2
2
|
import storage, { InitOptions } from 'node-persist';
|
|
3
3
|
import { SerializedHostType } from './types/storage/SerializedHostType';
|
|
4
4
|
import { StorageType } from './types/storage/StorageType';
|
package/build/lib/api.js
CHANGED
|
@@ -23,8 +23,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
26
27
|
const logger_1 = require("@nrchkb/logger");
|
|
27
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
28
28
|
const EveCharacteristics_1 = __importDefault(require("./hap/eve-app/EveCharacteristics"));
|
|
29
29
|
const Storage_1 = require("./Storage");
|
|
30
30
|
const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
|
|
@@ -35,29 +35,32 @@ module.exports = function (RED) {
|
|
|
35
35
|
log.debug('Initialize Service API');
|
|
36
36
|
const serviceData = {
|
|
37
37
|
BatteryService: {
|
|
38
|
-
nrchkbDisabledText: 'BatteryService (deprecated, replaced by Battery)'
|
|
38
|
+
nrchkbDisabledText: 'BatteryService (deprecated, replaced by Battery)'
|
|
39
39
|
},
|
|
40
40
|
BridgeConfiguration: {
|
|
41
|
-
nrchkbDisabledText: 'BridgeConfiguration (deprecated, unused)'
|
|
41
|
+
nrchkbDisabledText: 'BridgeConfiguration (deprecated, unused)'
|
|
42
42
|
},
|
|
43
43
|
BridgingState: {
|
|
44
|
-
nrchkbDisabledText: 'BridgingState (deprecated, unused)'
|
|
44
|
+
nrchkbDisabledText: 'BridgingState (deprecated, unused)'
|
|
45
|
+
},
|
|
46
|
+
CameraControl: {
|
|
47
|
+
nrchkbDisabledText: 'CameraControl (deprecated, replaced by)'
|
|
45
48
|
},
|
|
46
49
|
CameraEventRecordingManagement: {
|
|
47
|
-
nrchkbDisabledText: 'CameraEventRecordingManagement (deprecated, replaced by CameraRecordingManagement)'
|
|
50
|
+
nrchkbDisabledText: 'CameraEventRecordingManagement (deprecated, replaced by CameraRecordingManagement)'
|
|
48
51
|
},
|
|
49
52
|
Relay: {
|
|
50
|
-
nrchkbDisabledText: 'Relay (deprecated, replaced by CloudRelay)'
|
|
53
|
+
nrchkbDisabledText: 'Relay (deprecated, replaced by CloudRelay)'
|
|
51
54
|
},
|
|
52
55
|
Slat: {
|
|
53
|
-
nrchkbDisabledText: 'Slat (deprecated, replaced by Slats)'
|
|
56
|
+
nrchkbDisabledText: 'Slat (deprecated, replaced by Slats)'
|
|
54
57
|
},
|
|
55
58
|
TimeInformation: {
|
|
56
|
-
nrchkbDisabledText: 'TimeInformation (deprecated, unused)'
|
|
59
|
+
nrchkbDisabledText: 'TimeInformation (deprecated, unused)'
|
|
57
60
|
},
|
|
58
61
|
TunneledBTLEAccessoryService: {
|
|
59
|
-
nrchkbDisabledText: 'TunneledBTLEAccessoryService (deprecated, replaced by Tunnel)'
|
|
60
|
-
}
|
|
62
|
+
nrchkbDisabledText: 'TunneledBTLEAccessoryService (deprecated, replaced by Tunnel)'
|
|
63
|
+
}
|
|
61
64
|
};
|
|
62
65
|
Object.values(hap_nodejs_1.Service)
|
|
63
66
|
.filter((service) => service.prototype instanceof hap_nodejs_1.Service)
|
|
@@ -125,7 +128,7 @@ module.exports = function (RED) {
|
|
|
125
128
|
res.setHeader('Content-Type', 'application/json');
|
|
126
129
|
res.json({
|
|
127
130
|
version: xyzVersion,
|
|
128
|
-
experimental
|
|
131
|
+
experimental
|
|
129
132
|
});
|
|
130
133
|
});
|
|
131
134
|
};
|
|
@@ -198,7 +201,7 @@ module.exports = function (RED) {
|
|
|
198
201
|
super(name, CustomCharacteristic.UUID, Object.assign(Object.assign({}, validatedProps), { perms: (_a = validatedProps.perms) !== null && _a !== void 0 ? _a : [
|
|
199
202
|
"pr",
|
|
200
203
|
"pw",
|
|
201
|
-
"ev"
|
|
204
|
+
"ev"
|
|
202
205
|
] }));
|
|
203
206
|
this.value = this.getDefaultValue();
|
|
204
207
|
}
|
|
@@ -206,11 +209,11 @@ module.exports = function (RED) {
|
|
|
206
209
|
CustomCharacteristic.UUID = UUID;
|
|
207
210
|
Object.defineProperty(CustomCharacteristic, 'name', {
|
|
208
211
|
value: key,
|
|
209
|
-
configurable: true
|
|
212
|
+
configurable: true
|
|
210
213
|
});
|
|
211
214
|
Object.defineProperty(hap_nodejs_1.Characteristic, key, {
|
|
212
215
|
value: CustomCharacteristic,
|
|
213
|
-
configurable: true
|
|
216
|
+
configurable: true
|
|
214
217
|
});
|
|
215
218
|
customCharacteristicKeys.push(key);
|
|
216
219
|
}
|
|
@@ -242,8 +245,7 @@ module.exports = function (RED) {
|
|
|
242
245
|
if (customCharacteristicKeys.includes(key)) {
|
|
243
246
|
const characteristic = serviceNode.service
|
|
244
247
|
.getCharacteristic(hap_nodejs_1.Characteristic[key])
|
|
245
|
-
.setProps(serviceNode
|
|
246
|
-
.characteristicProperties[key]);
|
|
248
|
+
.setProps(serviceNode.characteristicProperties[key]);
|
|
247
249
|
serviceNode.supported.push(key);
|
|
248
250
|
characteristic.on('get', serviceNode.onCharacteristicGet);
|
|
249
251
|
characteristic.on('set', serviceNode.onCharacteristicSet);
|
|
@@ -260,7 +262,7 @@ module.exports = function (RED) {
|
|
|
260
262
|
RED.httpAdmin.get('/nrchkb/config', RED.auth.needsPermission('nrchkb.read'), (_req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
261
263
|
res.setHeader('Content-Type', 'application/json');
|
|
262
264
|
res.json({
|
|
263
|
-
customCharacteristics: yield getCustomCharacteristics()
|
|
265
|
+
customCharacteristics: yield getCustomCharacteristics()
|
|
264
266
|
});
|
|
265
267
|
}));
|
|
266
268
|
RED.httpAdmin.post('/nrchkb/config', RED.auth.needsPermission('nrchkb.write'), (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -301,6 +303,6 @@ module.exports = function (RED) {
|
|
|
301
303
|
};
|
|
302
304
|
return {
|
|
303
305
|
init,
|
|
304
|
-
stringifyVersion
|
|
306
|
+
stringifyVersion
|
|
305
307
|
};
|
|
306
308
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Characteristic } from 'hap-nodejs';
|
|
1
|
+
import { Characteristic } from '@homebridge/hap-nodejs';
|
|
2
2
|
import { EveS2R1, EveS2R2, EveS2W1, EveS2W2 } from './eve-app/EveCharacteristics';
|
|
3
3
|
declare class HAPCharacteristic extends Characteristic {
|
|
4
4
|
static EveS2R1: typeof EveS2R1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
3
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
4
4
|
class HAPCharacteristic extends hap_nodejs_1.Characteristic {
|
|
5
5
|
}
|
|
6
6
|
exports.default = HAPCharacteristic;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
3
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
4
4
|
class HAPService extends hap_nodejs_1.Service {
|
|
5
5
|
}
|
|
6
6
|
exports.default = HAPService;
|
|
@@ -11,42 +11,42 @@ const EveCharacteristics = [
|
|
|
11
11
|
name: 'Eve-Volt',
|
|
12
12
|
format: "float",
|
|
13
13
|
perms: ["pr"],
|
|
14
|
-
description: 'Volt (V) value. Used by Eve.app.'
|
|
14
|
+
description: 'Volt (V) value. Used by Eve.app.'
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
UUID: 'E863F126-079E-48FF-8F27-9C2605A29F52',
|
|
18
18
|
name: 'Eve-Ampere',
|
|
19
19
|
format: "float",
|
|
20
20
|
perms: ["pr"],
|
|
21
|
-
description: 'Ampere (A) value. Used by Eve.app.'
|
|
21
|
+
description: 'Ampere (A) value. Used by Eve.app.'
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
UUID: 'E863F10D-079E-48FF-8F27-9C2605A29F52',
|
|
25
25
|
name: 'Eve-Watt',
|
|
26
26
|
format: "float",
|
|
27
27
|
perms: ["pr"],
|
|
28
|
-
description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
|
|
28
|
+
description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
UUID: 'E863F10C-079E-48FF-8F27-9C2605A29F52',
|
|
32
32
|
name: 'Eve-Kilowatt-hour',
|
|
33
33
|
format: "float",
|
|
34
34
|
perms: ["pr"],
|
|
35
|
-
description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.'
|
|
35
|
+
description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.'
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
UUID: 'E863F110-079E-48FF-8F27-9C2605A29F52',
|
|
39
39
|
name: 'Eve-Volt-Ampere',
|
|
40
40
|
format: "uint16",
|
|
41
41
|
perms: ["pr"],
|
|
42
|
-
description: 'Volt-Ampere (VA) value. Used by Eve.app.'
|
|
43
|
-
}
|
|
42
|
+
description: 'Volt-Ampere (VA) value. Used by Eve.app.'
|
|
43
|
+
}
|
|
44
44
|
];
|
|
45
45
|
class EveS2R1 extends HAPCharacteristic_1.default {
|
|
46
46
|
constructor() {
|
|
47
47
|
super('Eve-S2R1', EveS2R1.UUID, {
|
|
48
48
|
format: "data",
|
|
49
|
-
perms: ["pr", "ev", "hd"]
|
|
49
|
+
perms: ["pr", "ev", "hd"]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -57,7 +57,7 @@ class EveS2R2 extends HAPCharacteristic_1.default {
|
|
|
57
57
|
constructor() {
|
|
58
58
|
super('Eve-S2R2', EveS2R2.UUID, {
|
|
59
59
|
format: "data",
|
|
60
|
-
perms: ["pr", "ev", "hd"]
|
|
60
|
+
perms: ["pr", "ev", "hd"]
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -68,7 +68,7 @@ class EveS2W1 extends HAPCharacteristic_1.default {
|
|
|
68
68
|
constructor() {
|
|
69
69
|
super('Eve-S2W1', EveS2W1.UUID, {
|
|
70
70
|
format: "data",
|
|
71
|
-
perms: ["pw", "hd"]
|
|
71
|
+
perms: ["pw", "hd"]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -79,7 +79,7 @@ class EveS2W2 extends HAPCharacteristic_1.default {
|
|
|
79
79
|
constructor() {
|
|
80
80
|
super('Eve-S2W2', EveS2W2.UUID, {
|
|
81
81
|
format: "data",
|
|
82
|
-
perms: ["pw", "hd"]
|
|
82
|
+
perms: ["pw", "hd"]
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MDNSAdvertiser } from 'hap-nodejs';
|
|
1
|
+
import { MDNSAdvertiser } from '@homebridge/hap-nodejs';
|
|
2
2
|
import { NodeDef } from 'node-red';
|
|
3
3
|
import { SemVer } from 'semver';
|
|
4
4
|
import HapCategories from './hap-nodejs/HapCategories';
|
|
@@ -15,14 +15,6 @@ type HAPHostConfigType = NodeDef & {
|
|
|
15
15
|
softwareRev: SemVer;
|
|
16
16
|
bind?: string;
|
|
17
17
|
bindType?: 'json' | 'str';
|
|
18
|
-
customMdnsConfig: boolean;
|
|
19
|
-
mdnsMulticast: boolean;
|
|
20
|
-
mdnsInterface: string;
|
|
21
|
-
mdnsPort: number;
|
|
22
|
-
mdnsIp: string;
|
|
23
|
-
mdnsTtl: number;
|
|
24
|
-
mdnsLoopback: boolean;
|
|
25
|
-
mdnsReuseAddr: boolean;
|
|
26
18
|
allowMessagePassthrough: boolean;
|
|
27
19
|
accessoryCategory: HapCategories;
|
|
28
20
|
advertiser: MDNSAdvertiser;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Accessory, Categories } from 'hap-nodejs';
|
|
2
|
-
import BonjourMulticastOptions from './hap-nodejs/BonjourMulticastOptions';
|
|
1
|
+
import { Accessory, Categories } from '@homebridge/hap-nodejs';
|
|
3
2
|
import HAPHostConfigType from './HAPHostConfigType';
|
|
4
3
|
import HostType from './HostType';
|
|
5
4
|
import NodeType from './NodeType';
|
|
6
5
|
type HAPHostNodeType = NodeType & {
|
|
7
6
|
config: HAPHostConfigType;
|
|
8
|
-
mdnsConfig: BonjourMulticastOptions;
|
|
9
7
|
accessoryCategory: Categories;
|
|
10
8
|
published: boolean;
|
|
11
9
|
bridgeUsername: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptiveLightingControllerMode } from 'hap-nodejs/dist/lib/controller/AdaptiveLightingController';
|
|
1
|
+
import { AdaptiveLightingControllerMode } from '@homebridge/hap-nodejs/dist/lib/controller/AdaptiveLightingController';
|
|
2
2
|
import { NodeDef } from 'node-red';
|
|
3
3
|
import CameraConfigType from './CameraConfigType';
|
|
4
4
|
type HAPServiceConfigType = NodeDef & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Accessory, AdaptiveLightingController, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
|
|
2
|
-
import {
|
|
1
|
+
import { Accessory, AdaptiveLightingController, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from '@homebridge/hap-nodejs';
|
|
2
|
+
import { CharacteristicContext } from '@homebridge/hap-nodejs/dist/lib/Characteristic';
|
|
3
|
+
import { HAPConnection } from '@homebridge/hap-nodejs/dist/lib/util/eventedhttp';
|
|
3
4
|
import { NodeAPI } from 'node-red';
|
|
4
5
|
import { NodeStatusUtils } from '../utils/NodeStatusUtils';
|
|
5
6
|
import HAPHostNodeType from './HAPHostNodeType';
|
|
@@ -26,8 +27,8 @@ type HAPServiceNodeType = NodeType & {
|
|
|
26
27
|
supported: string[];
|
|
27
28
|
publishTimers: PublishTimersType;
|
|
28
29
|
topic_in: string;
|
|
29
|
-
onCharacteristicGet: (this: Characteristic, callback: CharacteristicGetCallback, context:
|
|
30
|
-
onCharacteristicSet: (this: Characteristic,
|
|
30
|
+
onCharacteristicGet: (this: Characteristic, callback: CharacteristicGetCallback, context: CharacteristicContext, connection?: HAPConnection) => void;
|
|
31
|
+
onCharacteristicSet: (this: Characteristic, value: CharacteristicValue, callback: CharacteristicSetCallback, context: CharacteristicContext, connection?: HAPConnection) => void;
|
|
31
32
|
onCharacteristicChange: (this: Characteristic, change: CharacteristicChange) => void;
|
|
32
33
|
uniqueIdentifier: string;
|
|
33
34
|
reachable?: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const logger_1 = require("@nrchkb/logger");
|
|
4
4
|
module.exports = function (node) {
|
|
5
|
-
const HapNodeJS = require('hap-nodejs');
|
|
5
|
+
const HapNodeJS = require('@homebridge/hap-nodejs');
|
|
6
6
|
const Accessory = HapNodeJS.Accessory;
|
|
7
7
|
const Service = HapNodeJS.Service;
|
|
8
8
|
const Characteristic = HapNodeJS.Characteristic;
|
|
@@ -21,8 +21,10 @@ module.exports = function (node) {
|
|
|
21
21
|
const accessoryInformationService = accessory.getService(Service.AccessoryInformation) ||
|
|
22
22
|
accessory.addService(Service.AccessoryInformation);
|
|
23
23
|
if (accessoryInformationService.getCharacteristic(Characteristic.Manufacturer).value !== accessoryInformation.manufacturer ||
|
|
24
|
-
accessoryInformationService.getCharacteristic(Characteristic.Model)
|
|
25
|
-
|
|
24
|
+
accessoryInformationService.getCharacteristic(Characteristic.Model)
|
|
25
|
+
.value !== accessoryInformation.model ||
|
|
26
|
+
accessoryInformationService.getCharacteristic(Characteristic.Name)
|
|
27
|
+
.value !== accessoryInformation.name ||
|
|
26
28
|
accessoryInformationService.getCharacteristic(Characteristic.SerialNumber).value !== accessoryInformation.serialNo) {
|
|
27
29
|
log.debug('... Manufacturer, Model, Name or Serial Number changed! Replacing it.');
|
|
28
30
|
accessory.services
|
|
@@ -92,12 +94,12 @@ module.exports = function (node) {
|
|
|
92
94
|
const msg = {
|
|
93
95
|
payload: { Identify: 1 },
|
|
94
96
|
name: nodes[i].name,
|
|
95
|
-
topic: topic
|
|
97
|
+
topic: topic
|
|
96
98
|
};
|
|
97
99
|
const statusId = nodes[i].nodeStatusUtils.setStatus({
|
|
98
100
|
fill: 'yellow',
|
|
99
101
|
shape: 'dot',
|
|
100
|
-
text: 'Identify : 1'
|
|
102
|
+
text: 'Identify : 1'
|
|
101
103
|
});
|
|
102
104
|
setTimeout(function () {
|
|
103
105
|
nodes[i].nodeStatusUtils.clearStatus(statusId);
|
|
@@ -108,6 +110,6 @@ module.exports = function (node) {
|
|
|
108
110
|
};
|
|
109
111
|
return {
|
|
110
112
|
getOrCreate,
|
|
111
|
-
onIdentify
|
|
113
|
+
onIdentify
|
|
112
114
|
};
|
|
113
115
|
};
|
|
@@ -32,13 +32,13 @@ module.exports = function () {
|
|
|
32
32
|
node.nodeStatusUtils.setStatus({
|
|
33
33
|
fill: 'red',
|
|
34
34
|
shape: 'ring',
|
|
35
|
-
text: 'Error while publishing ' + hostTypeName
|
|
35
|
+
text: 'Error while publishing ' + hostTypeName
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}, 5000);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return {
|
|
42
|
-
delayedPublish: delayedPublish
|
|
42
|
+
delayedPublish: delayedPublish
|
|
43
43
|
};
|
|
44
44
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
3
4
|
const logger_1 = require("@nrchkb/logger");
|
|
4
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
5
5
|
module.exports = function (node) {
|
|
6
6
|
const log = (0, logger_1.logger)('NRCHKB', 'CharacteristicUtils', node.config.name, node);
|
|
7
7
|
const ServiceUtils = require('./ServiceUtils')(node);
|
|
@@ -46,6 +46,6 @@ module.exports = function (node) {
|
|
|
46
46
|
};
|
|
47
47
|
return {
|
|
48
48
|
load: load,
|
|
49
|
-
subscribeAndGetSupported: subscribeAndGetSupported
|
|
49
|
+
subscribeAndGetSupported: subscribeAndGetSupported
|
|
50
50
|
};
|
|
51
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hap_nodejs_1 = require("@homebridge/hap-nodejs");
|
|
3
4
|
const logger_1 = require("@nrchkb/logger");
|
|
4
|
-
const hap_nodejs_1 = require("hap-nodejs");
|
|
5
5
|
module.exports = function (node) {
|
|
6
6
|
const log = (0, logger_1.logger)('NRCHKB', 'CharacteristicUtils', node.config.name, node);
|
|
7
7
|
const ServiceUtils = require('./ServiceUtils2')(node);
|
|
@@ -46,6 +46,6 @@ module.exports = function (node) {
|
|
|
46
46
|
};
|
|
47
47
|
return {
|
|
48
48
|
load: load,
|
|
49
|
-
subscribeAndGetSupported: subscribeAndGetSupported
|
|
49
|
+
subscribeAndGetSupported: subscribeAndGetSupported
|
|
50
50
|
};
|
|
51
51
|
};
|