node-red-contrib-homekit-bridged 1.5.0-dev.1 → 1.5.0-dev.11

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.
@@ -1,15 +1,24 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
5
14
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const HostType_1 = __importDefault(require("./types/HostType"));
7
- const preload_1 = __importDefault(require("semver/preload"));
15
+ const logger_1 = require("@nrchkb/logger");
8
16
  const hap_nodejs_1 = require("hap-nodejs");
9
- const HapCategories_1 = __importDefault(require("./types/HapCategories"));
10
17
  const semver_1 = require("semver");
11
- const logger_1 = require("@nrchkb/logger");
18
+ const preload_1 = __importDefault(require("semver/preload"));
12
19
  const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
20
+ const HapCategories_1 = __importDefault(require("./types/HapCategories"));
21
+ const HostType_1 = __importDefault(require("./types/HostType"));
13
22
  module.exports = (RED, hostType) => {
14
23
  const MdnsUtils = require('./utils/MdnsUtils')();
15
24
  const init = function (config) {
@@ -99,14 +108,18 @@ module.exports = (RED, hostType) => {
99
108
  return true;
100
109
  };
101
110
  self.on('close', function (removed, done) {
102
- if (removed) {
103
- self.host.destroy();
104
- }
105
- else {
106
- self.host.unpublish();
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ if (removed) {
113
+ log.debug('This node has been deleted');
114
+ yield self.host.destroy();
115
+ }
116
+ else {
117
+ log.debug('This node is being restarted');
118
+ yield self.host.unpublish();
119
+ }
107
120
  self.published = false;
108
- }
109
- done();
121
+ done();
122
+ });
110
123
  });
111
124
  self.host.on('identify', function (paired, callback) {
112
125
  if (paired) {
@@ -3,11 +3,11 @@ 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 HostType_1 = __importDefault(require("./types/HostType"));
7
- const hap_nodejs_1 = require("hap-nodejs");
8
6
  const logger_1 = require("@nrchkb/logger");
9
- const FlowType_1 = require("./types/FlowType");
7
+ const hap_nodejs_1 = require("hap-nodejs");
10
8
  const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
9
+ const FlowType_1 = require("./types/FlowType");
10
+ const HostType_1 = __importDefault(require("./types/HostType"));
11
11
  module.exports = (RED) => {
12
12
  const nrchkbConfigCompatibilityOverride = function () {
13
13
  const self = this;
@@ -3,11 +3,11 @@ 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 HostType_1 = __importDefault(require("./types/HostType"));
7
- const hap_nodejs_1 = require("hap-nodejs");
8
6
  const logger_1 = require("@nrchkb/logger");
9
- const FlowType_1 = require("./types/FlowType");
7
+ const hap_nodejs_1 = require("hap-nodejs");
10
8
  const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
9
+ const FlowType_1 = require("./types/FlowType");
10
+ const HostType_1 = __importDefault(require("./types/HostType"));
11
11
  module.exports = (RED) => {
12
12
  const nrchkbConfigCompatibilityOverride = function () {
13
13
  const self = this;
@@ -1,7 +1,7 @@
1
- import storage, { InitOptions } from 'node-persist';
2
- import { StorageType } from './types/storage/StorageType';
3
1
  import { CharacteristicEventTypes, SerializedAccessory, SerializedService } from 'hap-nodejs';
2
+ import storage, { InitOptions } from 'node-persist';
4
3
  import { SerializedHostType } from './types/storage/SerializedHostType';
4
+ import { StorageType } from './types/storage/StorageType';
5
5
  declare type EventCallback = {
6
6
  event: CharacteristicEventTypes;
7
7
  callback: (value?: any) => void;
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Storage = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const node_persist_1 = __importDefault(require("node-persist"));
9
- const StorageType_1 = require("./types/storage/StorageType");
10
7
  const logger_1 = require("@nrchkb/logger");
8
+ const node_persist_1 = __importDefault(require("node-persist"));
9
+ const path_1 = __importDefault(require("path"));
11
10
  const uuid_1 = require("uuid");
12
11
  const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
12
+ const StorageType_1 = require("./types/storage/StorageType");
13
13
  class Storage {
14
14
  static storagePath() {
15
15
  if (!Storage.storageInitialized) {
package/build/lib/api.js CHANGED
@@ -23,10 +23,10 @@ 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 HapCategories_1 = __importDefault(require("./types/HapCategories"));
27
- const hap_nodejs_1 = require("hap-nodejs");
28
26
  const logger_1 = require("@nrchkb/logger");
27
+ const hap_nodejs_1 = require("hap-nodejs");
29
28
  const Storage_1 = require("./Storage");
29
+ const HapCategories_1 = __importDefault(require("./types/HapCategories"));
30
30
  const version = require('../../package.json').version.trim();
31
31
  module.exports = function (RED) {
32
32
  const log = (0, logger_1.logger)('NRCHKB', 'API');
@@ -123,7 +123,7 @@ module.exports = function (RED) {
123
123
  const getCustomCharacteristics = () => {
124
124
  return Storage_1.Storage.loadCustomCharacteristics()
125
125
  .then((value) => {
126
- log.trace(`loadCustomCharacteristics()`);
126
+ log.trace('loadCustomCharacteristics()');
127
127
  log.trace(value);
128
128
  if (Array.isArray(value)) {
129
129
  return value;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -321,8 +325,7 @@ Camera.prototype.handleStreamRequest = function (request) {
321
325
  ' -r ' +
322
326
  fps +
323
327
  ' -f rawvideo' +
324
- ' ' +
325
- additionalCommandline +
328
+ (additionalCommandline ? ' ' + additionalCommandline : '') +
326
329
  (vf.length > 0 ? ' -vf ' + vf.join(',') : '') +
327
330
  ' -b:v ' +
328
331
  vbitrate +
@@ -1,7 +1,7 @@
1
+ import { MDNSAdvertiser } from 'hap-nodejs';
1
2
  import { NodeDef } from 'node-red';
2
3
  import { SemVer } from 'semver';
3
4
  import HapCategories from './HapCategories';
4
- import { MDNSAdvertiser } from 'hap-nodejs';
5
5
  declare type HAPHostConfigType = NodeDef & {
6
6
  bridgeName: string;
7
7
  pinCode: string;
@@ -1,8 +1,8 @@
1
- import NodeType from './NodeType';
2
- import HAPHostConfigType from './HAPHostConfigType';
1
+ import { MulticastOptions } from 'bonjour-hap';
3
2
  import { Accessory, Categories } from 'hap-nodejs';
3
+ import HAPHostConfigType from './HAPHostConfigType';
4
4
  import HostType from './HostType';
5
- import { MulticastOptions } from 'bonjour-hap';
5
+ import NodeType from './NodeType';
6
6
  declare type HAPHostNodeType = NodeType & {
7
7
  config: HAPHostConfigType;
8
8
  mdnsConfig: MulticastOptions;
@@ -1,12 +1,12 @@
1
- import NodeType from './NodeType';
2
- import { NodeAPI } from 'node-red';
3
- import HAPService2ConfigType from './HAPService2ConfigType';
4
1
  import { Accessory, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
2
+ import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
3
+ import { NodeAPI } from 'node-red';
5
4
  import HAPHostNodeType from './HAPHostNodeType';
5
+ import HAPService2ConfigType from './HAPService2ConfigType';
6
+ import HAPServiceNodeType from './HAPServiceNodeType';
7
+ import NodeType from './NodeType';
6
8
  import PublishTimersType from './PublishTimersType';
7
9
  import StatusUtilType from './StatusUtilType';
8
- import HAPServiceNodeType from './HAPServiceNodeType';
9
- import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
10
10
  declare type HAPService2NodeType = NodeType & {
11
11
  config: HAPService2ConfigType;
12
12
  RED: NodeAPI;
@@ -1,12 +1,12 @@
1
- import NodeType from './NodeType';
2
- import { NodeAPI } from 'node-red';
3
1
  import { Accessory, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
2
+ import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
3
+ import { NodeAPI } from 'node-red';
4
4
  import HAPHostNodeType from './HAPHostNodeType';
5
+ import HAPService2NodeType from './HAPService2NodeType';
6
+ import HAPServiceConfigType from './HAPServiceConfigType';
7
+ import NodeType from './NodeType';
5
8
  import PublishTimersType from './PublishTimersType';
6
9
  import StatusUtilType from './StatusUtilType';
7
- import HAPServiceConfigType from './HAPServiceConfigType';
8
- import HAPService2NodeType from './HAPService2NodeType';
9
- import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
10
10
  declare type HAPServiceNodeType = NodeType & {
11
11
  config: HAPServiceConfigType;
12
12
  RED: NodeAPI;
@@ -1,8 +1,8 @@
1
- import NodeType from './NodeType';
2
1
  import { NodeAPI } from 'node-red';
3
- import StatusUtilType from './StatusUtilType';
4
2
  import HAPServiceNodeType from './HAPServiceNodeType';
5
3
  import HAPStatusConfigType from './HAPStatusConfigType';
4
+ import NodeType from './NodeType';
5
+ import StatusUtilType from './StatusUtilType';
6
6
  declare type HAPStatusNodeType = NodeType & {
7
7
  config: HAPStatusConfigType;
8
8
  RED: NodeAPI;
@@ -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 HostType_1 = __importDefault(require("../types/HostType"));
7
6
  const logger_1 = require("@nrchkb/logger");
7
+ const HostType_1 = __importDefault(require("../types/HostType"));
8
8
  module.exports = function () {
9
9
  const delayedPublish = function (node) {
10
10
  const log = (0, logger_1.logger)('NRCHKB', 'BridgeUtils', node.config.name, node);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const hap_nodejs_1 = require("hap-nodejs");
4
3
  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);
@@ -42,7 +42,7 @@ module.exports = function (node) {
42
42
  characteristic.props.minValue = -100;
43
43
  }
44
44
  });
45
- return supported;
45
+ return [...new Set(supported)];
46
46
  };
47
47
  return {
48
48
  load: load,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const hap_nodejs_1 = require("hap-nodejs");
4
3
  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);
@@ -42,7 +42,7 @@ module.exports = function (node) {
42
42
  characteristic.props.minValue = -100;
43
43
  }
44
44
  });
45
- return supported;
45
+ return [...new Set(supported)];
46
46
  };
47
47
  return {
48
48
  load: load,
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -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("hap-nodejs");
7
6
  const logger_1 = require("@nrchkb/logger");
7
+ const hap_nodejs_1 = require("hap-nodejs");
8
8
  const NRCHKBError_1 = __importDefault(require("../NRCHKBError"));
9
9
  module.exports = function (node) {
10
10
  const log = (0, logger_1.logger)('NRCHKB', 'ServiceUtils', node.config.name, node);
@@ -49,21 +49,30 @@ module.exports = function (node) {
49
49
  msg.payload[key] = newValue;
50
50
  msg.hap = prepareHapData(context, connection);
51
51
  msg.hap.allChars = allCharacteristics.reduce((allChars, singleChar) => {
52
- allChars[singleChar.displayName] = singleChar.value;
52
+ const cKey = singleChar.constructor.name;
53
+ allChars[cKey] = singleChar.value;
53
54
  return allChars;
54
55
  }, {});
55
56
  if (oldValue !== undefined) {
56
57
  msg.hap.oldValue = oldValue;
57
58
  }
58
- msg.hap.newValue = newValue;
59
- const statusId = node.setStatus({
60
- fill: 'yellow',
61
- shape: 'dot',
62
- text: key + ': ' + newValue,
63
- });
64
- setTimeout(function () {
65
- node.clearStatus(statusId);
66
- }, 3000);
59
+ if (!node.reachable) {
60
+ msg.hap.reachable = false;
61
+ node.setStatus({
62
+ fill: 'yellow',
63
+ shape: 'dot',
64
+ text: 'Not reachable',
65
+ }, 3000);
66
+ }
67
+ else {
68
+ msg.hap.reachable = true;
69
+ msg.hap.newValue = newValue;
70
+ node.setStatus({
71
+ fill: 'yellow',
72
+ shape: 'dot',
73
+ text: key + ': ' + newValue,
74
+ }, 3000);
75
+ }
67
76
  log.debug(`${node.name} received ${key} : ${newValue}`);
68
77
  if (connection ||
69
78
  context ||
@@ -132,7 +141,7 @@ module.exports = function (node) {
132
141
  Object.keys(msg.payload).map((key) => {
133
142
  var _a, _b;
134
143
  if (node.supported.indexOf(key) < 0) {
135
- log.error(`Instead of ${key} try one of these characteristics: ${node.supported.join(', ')}`);
144
+ log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
136
145
  }
137
146
  else {
138
147
  const value = (_a = msg.payload) === null || _a === void 0 ? void 0 : _a[key];
@@ -3,10 +3,10 @@ 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("hap-nodejs");
7
6
  const logger_1 = require("@nrchkb/logger");
8
- const Storage_1 = require("../Storage");
7
+ const hap_nodejs_1 = require("hap-nodejs");
9
8
  const NRCHKBError_1 = __importDefault(require("../NRCHKBError"));
9
+ const Storage_1 = require("../Storage");
10
10
  module.exports = function (node) {
11
11
  const log = (0, logger_1.logger)('NRCHKB', 'ServiceUtils2', node.config.name, node);
12
12
  const HapNodeJS = require('hap-nodejs');
@@ -23,17 +23,32 @@ module.exports = function (node) {
23
23
  };
24
24
  msg.payload = {};
25
25
  msg.hap = {
26
- newValue,
27
26
  event: eventObject,
28
27
  allChars: allCharacteristics.reduce((allChars, singleChar) => {
29
- allChars[singleChar.displayName] = singleChar.value;
28
+ const cKey = singleChar.constructor.name;
29
+ allChars[cKey] = singleChar.value;
30
30
  return allChars;
31
31
  }, {}),
32
+ oldValue,
32
33
  };
33
- if (oldValue !== undefined) {
34
- msg.hap.oldValue = oldValue;
35
- }
36
34
  const key = this.constructor.name;
35
+ if (!node.reachable) {
36
+ msg.hap.reachable = false;
37
+ node.setStatus({
38
+ fill: 'yellow',
39
+ shape: 'dot',
40
+ text: 'Not reachable',
41
+ }, 3000);
42
+ }
43
+ else {
44
+ msg.hap.reachable = true;
45
+ msg.hap.newValue = newValue;
46
+ node.setStatus({
47
+ fill: 'yellow',
48
+ shape: 'dot',
49
+ text: `[${eventObject.name}] ${key}${newValue != undefined ? `: ${newValue}` : ''}`,
50
+ }, 3000);
51
+ }
37
52
  msg.payload[key] = newValue;
38
53
  if (connection) {
39
54
  msg.hap.session = {
@@ -44,11 +59,6 @@ module.exports = function (node) {
44
59
  httpPort: connection.remotePort,
45
60
  };
46
61
  }
47
- node.setStatus({
48
- fill: 'yellow',
49
- shape: 'dot',
50
- text: `[${eventObject.name}] ${key}${newValue != undefined ? `: ${newValue}` : ''}`,
51
- }, 3000);
52
62
  log.debug(`${node.name} received ${eventObject.name} ${key}: ${newValue}`);
53
63
  if (connection || node.hostNode.config.allowMessagePassthrough) {
54
64
  node.send(msg);
@@ -153,7 +163,7 @@ module.exports = function (node) {
153
163
  }
154
164
  }
155
165
  else {
156
- log.error(`Instead of ${key} try one of these characteristics: ${node.supported.join(', ')}`);
166
+ log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
157
167
  }
158
168
  }
159
169
  else {
@@ -12,6 +12,7 @@
12
12
  <select id="node-config-input-advertiser">
13
13
  <option value="bonjour-hap" selected="selected">BONJOUR</option>
14
14
  <option value="ciao">CIAO</option>
15
+ <option value="avahi">AVAHI</option>
15
16
  </select>
16
17
  </div>
17
18
  <div class="form-row">
@@ -98,7 +99,7 @@
98
99
  <ul>
99
100
  <li><strong>Pin Code</strong>: Specify the Pin for the pairing process.</li>
100
101
  <li><strong>Port</strong>: If you are behind a Firewall, you may want to specify a port. Cannot be 1880 as it is reserved for node-red. Otherwise, leave empty.</li>
101
- <li><strong>Advertiser</strong>: Which MDNS advertiser to use <em>ciao</em> (new, improved but not yet proved) or (good old) <em>bonjour</em>. Default <em>bonjour</em>.</li>
102
+ <li><strong>Advertiser</strong>: Which MDNS advertiser to use <em>ciao</em> (new, improved but not yet proved) or (good old) <em>bonjour</em> or experimental <em>avahi</em>. Default <em>bonjour</em>.</li>
102
103
  <li><strong>Allow Insecure Request</strong>: Should we allow insecure request? Default false.</li>
103
104
  <li><strong>Manufacturer, Model, Serial Number</strong>: Can be anything you want.</li>
104
105
  <li><strong>Firmware Revision</strong>: Should be a version number string in the form of <em>MAJOR.MINOR.REVISION</em> e.g. <em>1.2.0</em>. Other types of strings are ignored and won't be displayed.</li>
@@ -148,7 +149,7 @@
148
149
  value: 'bonjour-hap',
149
150
  required: false,
150
151
  validate: function (value) {
151
- if (value) return value === 'bonjour-hap' || value === 'ciao'
152
+ if (value) return value === 'bonjour-hap' || value === 'ciao' || value === 'avahi'
152
153
  else return true
153
154
  },
154
155
  },
@@ -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 HostType_1 = __importDefault(require("../lib/types/HostType"));
7
6
  const logger_1 = require("@nrchkb/logger");
7
+ const HostType_1 = __importDefault(require("../lib/types/HostType"));
8
8
  const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode');
9
9
  module.exports = (RED) => {
10
10
  const HAPHostNode = require('../lib/HAPHostNode')(RED, HostType_1.default.BRIDGE);
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -22,10 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
27
  };
24
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ const logger_1 = require("@nrchkb/logger");
30
+ const hap_nodejs_1 = require("hap-nodejs");
25
31
  const path = __importStar(require("path"));
26
32
  const semver_1 = __importDefault(require("semver"));
27
- const hap_nodejs_1 = require("hap-nodejs");
28
- const logger_1 = require("@nrchkb/logger");
29
33
  const Storage_1 = require("../lib/Storage");
30
34
  (0, logger_1.loggerSetup)({ timestampEnabled: 'NRCHKB' });
31
35
  const log = (0, logger_1.logger)('NRCHKB');
@@ -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 HostType_1 = __importDefault(require("../lib/types/HostType"));
7
6
  const logger_1 = require("@nrchkb/logger");
7
+ const HostType_1 = __importDefault(require("../lib/types/HostType"));
8
8
  const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode');
9
9
  module.exports = (RED) => {
10
10
  const HAPHostNode = require('../lib/HAPHostNode')(RED, HostType_1.default.STANDALONE);
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "node-red-contrib-homekit-bridged",
3
- "version": "1.5.0-dev.1",
3
+ "version": "1.5.0-dev.11",
4
4
  "description": "Node-RED nodes to simulate Apple HomeKit devices.",
5
5
  "main": "build/nodes/nrchkb.js",
6
6
  "scripts": {
7
- "build": "yarn clean && tsc",
7
+ "build": "npm run clean && tsc",
8
8
  "clean": "rimraf build/lib build/**/*.js",
9
- "test": "yarn build && mocha -r ts-node/register './src/**/*.test.[tj]s' --exit",
9
+ "test": "npm run build && mocha -r ts-node/register './src/**/*.test.[tj]s' --exit --timeout 30000",
10
10
  "prettier": "prettier --write \"**/*.{js,ts}\"",
11
- "_postinstall": "husky install",
12
- "prepublishOnly": "pinst --disable",
13
- "postpublish": "pinst --enable"
11
+ "eslint": "eslint \"**/*.ts\"",
12
+ "prepare": "husky install"
14
13
  },
15
14
  "repository": {
16
15
  "type": "git",
@@ -33,7 +32,8 @@
33
32
  "service": "build/nodes/service.js",
34
33
  "service2": "build/nodes/service2.js",
35
34
  "status": "build/nodes/status.js"
36
- }
35
+ },
36
+ "version": ">=1.3.7"
37
37
  },
38
38
  "author": {
39
39
  "name": "Tadeusz Wyrzykowski",
@@ -47,34 +47,36 @@
47
47
  "homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
48
48
  "dependencies": {
49
49
  "@nrchkb/logger": "^1.3.3",
50
- "hap-nodejs": "^0.9.7",
50
+ "hap-nodejs": "0.10.4",
51
51
  "node-persist": "^3.1.0",
52
- "semver": "^7.3.5",
53
- "uuid": "^8.3.2"
52
+ "semver": "^7.3.7",
53
+ "uuid": "^9.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@homebridge/ciao": "^1.1.3",
57
- "@node-red/registry": "^1.3.7",
58
- "@types/mocha": "^9.0.0",
59
- "@types/node": "^10.17.50",
60
- "@types/node-persist": "^3.1.2",
61
- "@types/node-red": "^1.1.1",
62
- "@types/semver": "^7.3.9",
63
- "@types/uuid": "^8.3.1",
64
- "@typescript-eslint/eslint-plugin": "^5.3.1",
65
- "@typescript-eslint/parser": "^5.3.1",
56
+ "@homebridge/ciao": "^1.1.5",
57
+ "@node-red/registry": "^2.2.3",
58
+ "@types/mocha": "^9.1.1",
59
+ "@types/node": "^10.17.60",
60
+ "@types/node-persist": "^3.1.3",
61
+ "@types/node-red": "^1.2.1",
62
+ "@types/node-red-node-test-helper": "^0.2.2",
63
+ "@types/semver": "^7.3.12",
64
+ "@types/uuid": "^8.3.4",
65
+ "@typescript-eslint/eslint-plugin": "^5.38.1",
66
+ "@typescript-eslint/parser": "^5.38.1",
66
67
  "babel-eslint": "^10.1.0",
67
- "eslint": "^8.2.0",
68
- "eslint-config-prettier": "^8.3.0",
69
- "eslint-plugin-prettier": "^4.0.0",
70
- "husky": "^7.0.4",
71
- "mocha": "^9.1.3",
72
- "node-red": "^1.3.7",
73
- "node-red-node-test-helper": "^0.2.7",
74
- "pinst": "^2.1.6",
75
- "prettier": "^2.4.1",
76
- "ts-node": "^10.4.0",
77
- "typescript": "^4.4.4"
68
+ "eslint": "^8.24.0",
69
+ "eslint-config-prettier": "^8.5.0",
70
+ "eslint-plugin-prettier": "^4.2.1",
71
+ "eslint-plugin-simple-import-sort": "^8.0.0",
72
+ "husky": "^8.0.1",
73
+ "mocha": "^10.0.0",
74
+ "node-red": "^2.2.3",
75
+ "node-red-node-test-helper": "^0.3.0",
76
+ "prettier": "^2.7.1",
77
+ "rimraf": "^3.0.2",
78
+ "ts-node": "^10.9.1",
79
+ "typescript": "^4.8.4"
78
80
  },
79
81
  "engines": {
80
82
  "node": ">=10.22.1"
package/CHANGELOG.md DELETED
@@ -1,349 +0,0 @@
1
- #### ⚠️ CAUTION ⚠️
2
-
3
- ##### Before upgrading make sure that you are using the latest version of [Node-RED](https://nodered.org/docs/getting-started/local) and latest LTS version of [Node.js](https://nodejs.org/en/download/)
4
-
5
- ###### Upgrading from versions 0.X to 1.X is a breaking change, all devices will be reset in the Home app. Please review the [release notes](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/releases/tag/v1.0.1) thoroughly before updating!
6
-
7
- # Changelog
8
-
9
- All notable changes to this project will be documented in this file.
10
-
11
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
12
- to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
13
-
14
- ## [1.5.0-dev.1]
15
-
16
- ### Fixed
17
-
18
- - Accessory could not be recovered from NO_RESPONSE using single Characteristic
19
-
20
- ### Changed
21
-
22
- - Updated hap-nodejs to [0.9.7](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.7) (bug fixes)
23
-
24
- ## [1.4.3]
25
-
26
- ### Added
27
-
28
- - Pass Characteristic key in event context for Service2
29
-
30
- ### Changed
31
-
32
- - Updated hap-nodejs to [0.9.6](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.6) (bug fixes and security
33
- fixes)
34
-
35
- ## [1.4.2]
36
-
37
- ### Fixed
38
-
39
- - Resolve issue with customCharacteristics not loading from file
40
- - Fixed publish process
41
-
42
- ## [1.4.1]
43
-
44
- ### Fixed
45
-
46
- - Fix readme appearance on `flows.nodered.org`
47
-
48
- ## [1.4.0]
49
-
50
- ### Fixed
51
-
52
- - Fixed customCharacteristics incorrect refresh in UI
53
- - Implemented static accessoryUUIDs for subflows Enables the use of nrchkb nodes in subflows with backwards
54
- compatibility #393 - thanks @kevinkub
55
- - Fixed Custom MDNS Configuration not showing in UI for Standalone Accessory
56
- - Stop components from clearing other component's node.status call
57
- - Add missing advertiser selector in UI for Standalone Accessory
58
- - Not naming the host node causes a crash #424
59
- - Do not output oldValue for onSet as it does not have access to old value
60
-
61
- ### Added
62
-
63
- - Notice during app launch: Node.js 10 will be deprecated in Node-RED 2.0.0
64
- - Event output in Service 2 which is available in NRCHKB_EXPERIMENTAL #392 #437
65
- - Status node to fetch Serialized Service #210
66
- - Support for environment variables in characteristic properties #217
67
-
68
- ### Changed
69
-
70
- - Updated hap-nodejs to [0.9.5](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.5) (added new iOS 15 Services
71
- and Characteristics)
72
- - Updated dependencies to latest versions
73
- - Changed `BatteryService` to `Battery` in demo examples as `BatteryService` is deprecated #381 - thanks @crxporter
74
- - Readme rework - thanks @crxporter
75
- - More descriptive error when incorrect Characteristic has been used in msg.payload
76
- - Add msg.hap.allChars to service nodes #438
77
-
78
- ## [1.3.6]
79
-
80
- ### Fixed
81
-
82
- - nrchkb complaining about validValues #52
83
-
84
- ## [1.3.5]
85
-
86
- ### Fixed
87
-
88
- - NO_RESPONSE not working
89
-
90
- ## [1.3.4]
91
-
92
- ### Fixed
93
-
94
- - onChange fired when value not changed #390 - thanks for reporting @Delphius7
95
-
96
- ## [1.3.3]
97
-
98
- ### Fixed
99
-
100
- - Resolve issues with incorrect Characteristics names used in node output
101
-
102
- ## [1.3.2]
103
-
104
- ### Fixed
105
-
106
- - Resolve issues with some Characteristics names not being accepted since hap-nodejs upgrade
107
-
108
- ## [1.3.1]
109
-
110
- ### Fixed
111
-
112
- - Fix allowMessagePassthrough=false not working for messages from Home.app
113
-
114
- ## [1.3.0]
115
-
116
- ### Fixed
117
-
118
- - There was a problem when mdnsConfig was
119
- empty [#322](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/322)
120
- - There was a problem when NRCHKB was updated without Node-RED
121
- restart [#363](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/363)
122
- - Linked service throws error during setup if parent waits for the setup message (thanks @AlexOwl)
123
- - . in Bridge name was causing it not being published without any feedback to user
124
-
125
- ### Added
126
-
127
- - More code tests
128
- - Verify if Node.js version criteria is met on start
129
- - Support fo9r Standalone Accessory mode (like in old
130
- times) [#310](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/310)
131
- - (Experimental) Support for Custom
132
- Characteristics [#52](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/52)
133
- - Add client IP address to onSet/onChange output
134
- message (`msg.hap.session`) [#328](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/328)
135
- - As of new mdns advertiser available now there is a possibility to choose which you want to use in Bridge Config:
136
- ciao (
137
- new, improved but not yet proved) or (good old) bonjour. Default bonjour
138
-
139
- ### Changed
140
-
141
- - Updated hap-nodejs to 0.9.4
142
- - Updated dependencies to latest versions
143
- - TypeScript-ify code
144
- - Generate random pin code for new Bridge nodes
145
-
146
- ## [1.2.0] - 2020.08.16
147
-
148
- ### Fixed
149
-
150
- - JS console error when opening a linked
151
- service [#278](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/278)
152
- - Fixed outputs number not being remembered by editor
153
- - Fixed saving Software Revision fo Service node
154
- - Fixed HAPStorage path on Windows
155
- - There was a translation issue, changed pilot to remote in README.
156
-
157
- ### Added
158
-
159
- - Added Firmware, Software and Hardware Revision fields to Bridge configuration
160
- - Now we have examples that you can import in node-red!
161
- - You can make Service node wait for setup message.
162
-
163
- ### Changed
164
-
165
- - Now Firmware, Software and Hardware Revision and Model fields are set by default to NRCHKB version, Manufacturer is
166
- NRCHKB by default
167
- - Updated hap-nodejs to 0.7.8
168
- - Updated dependencies to latest versions
169
- - Disallow using port 1880 for Bridge as that port is reserved for node-red
170
-
171
- ## [1.1.1] - 2020.06.30
172
-
173
- ### Added
174
-
175
- - Firmware Revision configuration option (
176
- optional) [#211](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/pull/211)
177
- - Hardware and Software Revision configuration option (optional)
178
- - Project now support typescript!
179
-
180
- ### Fixed
181
-
182
- - Error status is not passed to callback when "No response" was
183
- triggered [#227](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/pull/227) also discussed
184
- in [#185](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/pull/185)
185
-
186
- ### Changed
187
-
188
- - Some README.md rework
189
- - Updated hap-nodejs to 0.7.3
190
- - Updated dependencies to latest versions
191
- - Moved lint-staged config to main level and added minimum nodejs version
192
-
193
- ### Removed
194
-
195
- - Some unused code disappeared.
196
-
197
- ## [1.0.4] - 2020.03.03
198
-
199
- ### Fixed
200
-
201
- - Warn when trying to deploy node without bridge or parentService
202
- attached [#214](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/214#issuecomment-594084125)
203
- - Additional Command Line value in Camera Control is now
204
- optional [#214](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/214#issuecomment-593736115)
205
-
206
- ## [1.0.3] - 2020.03.01
207
-
208
- ### Fixed
209
-
210
- - Video Filter value in Camera Control is now optional in node-red editor
211
- too [#214](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/214)
212
-
213
- ## [1.0.2] - 2020.03.01
214
-
215
- ### Added
216
-
217
- - Warning about lost compatibility on README page.
218
-
219
- ## [1.0.0] - 2020.02.23
220
-
221
- Lost backward compatibility. In order to make it work read
222
- this [notice](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/pull/163#issuecomment-590108567).
223
-
224
- ### Fixed
225
-
226
- - Node id macify algorithm changed [#170](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/170)
227
- - Corrections regarding issue [#12](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/12) so that
228
- changes can be deployed without restarting node-red
229
- - Automatically creating a new service and replacing the old one if the service type changed
230
- - Automatically replacing an accessory with a new one if the accessory information changes (e.g., Name, Manufacturer,
231
- ...)
232
- - Video Filter value in Camera Control is now
233
- optional [#194](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/194) (can be empty, before it was
234
- generated if was empty)
235
- - Removed updateReachability as it is deprecated (and doesn't make a difference)
236
-
237
- ### Added
238
-
239
- - After Service selection in node configuration Category will be automatically set to default for Service
240
- - Interface Name for Camera Service configuration
241
- - Support for new TV Remote services
242
- - Now first output is for onChange, second for onSet and third for camera
243
- snapshot. [#200](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/200)
244
- - Sponsor Button on repository page
245
-
246
- ### Changed
247
-
248
- - Accessory Category in node configuration moved under Service selection
249
- - Clarify NO_RESPONSE in README
250
- - Update node-red version in dependencies
251
- - Camera Service source code to match the newest improvements in homebridge-camera-ffmpeg
252
- - Update to latest HAP-NodeJS
253
- - Removed unnecessary accessory category from service node
254
- - Removed fields Manufacturer, Serial Number and Model from linked service nodes
255
- - Moved eslint and prettier configuration to package.json
256
- - Added automatic linting on pre-commit
257
-
258
- ## [0.8.0] - 2019.10.14
259
-
260
- ### Added
261
-
262
- - Added greenkeeper
263
- - Added setting to Bridge configuration called Allow Message Passthrough
264
-
265
- ### Changed
266
-
267
- - Updated README
268
-
269
- ### Fixed
270
-
271
- - Revert hap.context in node output
272
-
273
- ## [0.7.1] - 2019.10.13
274
-
275
- ### Fixed
276
-
277
- - Added labels to node outputs as there are new output for camera snapshot
278
-
279
- ## [0.7.0] - 2019.10.12
280
-
281
- ### Added
282
-
283
- - CHANGELOG page introduction
284
- - Change from "characteristic-change" to "set" to listen to HAP-NodeJS events
285
- - Sorted Service Type list in UI
286
- - Camera support (RTSP, Video Doorbell and others)
287
- - RemoteKey value now appears in node output!
288
- - HAP-NodeJS version changed to latest (0.5.0)
289
- - Added Accessory Category field for Parent Service
290
- - More code refactoring
291
- - The Newest HomeKit Docs uploaded
292
- - Security hints
293
- - And more...
294
-
295
- ### Changed
296
-
297
- - MIT license
298
- - Better node-red tests
299
- - Prettified and linted code!
300
- - Support for node 8 and 10 only
301
- - GitHub Actions for automatic tests and publish
302
- - And more...
303
-
304
- ### Fixed
305
-
306
- - Removed read/write boundaries for Characteristics
307
- - And more...
308
-
309
- ## [0.6.2] - 2019.03.27
310
-
311
- ### Changed
312
-
313
- - Some minor changes in README
314
-
315
- ### Fixed
316
-
317
- - Hotfix for "NO_RESPONSE"
318
-
319
- ## [0.6.1] - 2019.03.21
320
-
321
- ### Added
322
-
323
- - Reintroduced DEBUG mode (DEBUG=NRCHKB node-red)
324
-
325
- ### Changed
326
-
327
- - Renaming organisation
328
- - Minor changes to process of finding Parent Service as Linked Service
329
-
330
- ### Fixed
331
-
332
- - Crash upon removing bridge from Home [#22](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/22)
333
- - Fix: "Error: This callback function has already been called by someone
334
- else..." [#66](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/66)
335
-
336
- ## [0.6.0] - 2019.03.16
337
-
338
- ### Added
339
-
340
- - Introduce Linked Services [#41](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/41)
341
- - MDNS Configuration [#44](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/44)
342
- - Filter on Topic
343
- - NO_RESPONSE trigger [#48](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/48)
344
- - onIdentify [#54](https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/54)
345
- - Added automatic tests for building project, code quality and finding vulnerabilities
346
-
347
- ### Changed
348
-
349
- - Redesigned README