node-red-contrib-homekit-bridged 2.0.0-dev.0 → 2.0.0-dev.2

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.
Files changed (45) hide show
  1. package/build/lib/HAPHostNode.js +59 -64
  2. package/build/lib/HAPServiceNode.js +91 -95
  3. package/build/lib/HAPServiceNode2.js +93 -97
  4. package/build/lib/Storage.d.ts +3 -3
  5. package/build/lib/Storage.js +2 -2
  6. package/build/lib/api.js +26 -29
  7. package/build/lib/hap/HAPCharacteristic.d.ts +1 -1
  8. package/build/lib/hap/HAPService.d.ts +1 -1
  9. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +1 -1
  10. package/build/lib/hap/eve-app/EveCharacteristics.js +10 -10
  11. package/build/lib/types/CustomCharacteristicType.d.ts +1 -1
  12. package/build/lib/types/HAPHostConfigType.d.ts +4 -4
  13. package/build/lib/types/HAPHostNodeType.d.ts +4 -4
  14. package/build/lib/types/HAPService2ConfigType.d.ts +2 -2
  15. package/build/lib/types/HAPService2NodeType.d.ts +3 -3
  16. package/build/lib/types/HAPServiceConfigType.d.ts +3 -3
  17. package/build/lib/types/HAPServiceNodeType.d.ts +10 -10
  18. package/build/lib/types/HAPStatusConfigType.d.ts +1 -1
  19. package/build/lib/types/HAPStatusNodeType.d.ts +5 -5
  20. package/build/lib/types/NodeType.d.ts +1 -1
  21. package/build/lib/types/storage/SerializedHostType.d.ts +2 -2
  22. package/build/lib/utils/AccessoryUtils.js +15 -15
  23. package/build/lib/utils/BridgeUtils.js +5 -5
  24. package/build/lib/utils/CharacteristicUtils.js +6 -6
  25. package/build/lib/utils/CharacteristicUtils2.js +6 -6
  26. package/build/lib/utils/NodeStatusUtils.d.ts +2 -2
  27. package/build/lib/utils/NodeStatusUtils.js +2 -2
  28. package/build/lib/utils/ServiceUtils.js +39 -38
  29. package/build/lib/utils/ServiceUtils2.js +39 -37
  30. package/build/lib/utils/index.js +2 -2
  31. package/build/nodes/nrchkb.js +2 -2
  32. package/build/nodes/status.js +15 -16
  33. package/examples/demo/01 - ALL Demos single import.json +64 -318
  34. package/examples/demo/02 - Air Purifier.json +279 -328
  35. package/examples/demo/03 - Air Quality sensor with Battery.json +254 -282
  36. package/examples/demo/04 - Dimmable Bulb.json +172 -189
  37. package/examples/demo/05 - Color Bulb (HSV).json +195 -216
  38. package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -265
  39. package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -192
  40. package/examples/demo/08 - CO2 detector.json +224 -255
  41. package/examples/demo/09 - CO (carbon monoxide) example.json +255 -290
  42. package/examples/demo/10 - Door window contact sensor.json +234 -265
  43. package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -607
  44. package/examples/switch/01 - Plain Switch.json +7 -27
  45. package/package.json +83 -81
@@ -1,13 +1,13 @@
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';
4
- import { NodeAPI } from 'node-red';
5
- import { NodeStatusUtils } from '../utils/NodeStatusUtils';
6
- import HAPHostNodeType from './HAPHostNodeType';
7
- import HAPService2NodeType from './HAPService2NodeType';
8
- import HAPServiceConfigType from './HAPServiceConfigType';
9
- import NodeType from './NodeType';
10
- import PublishTimersType from './PublishTimersType';
1
+ import type { Accessory, AdaptiveLightingController, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from '@homebridge/hap-nodejs';
2
+ import type { CharacteristicContext } from '@homebridge/hap-nodejs/dist/lib/Characteristic';
3
+ import type { HAPConnection } from '@homebridge/hap-nodejs/dist/lib/util/eventedhttp';
4
+ import type { NodeAPI } from 'node-red';
5
+ import type { NodeStatusUtils } from '../utils/NodeStatusUtils';
6
+ import type HAPHostNodeType from './HAPHostNodeType';
7
+ import type HAPService2NodeType from './HAPService2NodeType';
8
+ import type HAPServiceConfigType from './HAPServiceConfigType';
9
+ import type NodeType from './NodeType';
10
+ import type PublishTimersType from './PublishTimersType';
11
11
  type HAPServiceNodeType = NodeType & {
12
12
  config: HAPServiceConfigType;
13
13
  RED: NodeAPI;
@@ -1,4 +1,4 @@
1
- import { NodeDef } from 'node-red';
1
+ import type { NodeDef } from 'node-red';
2
2
  type HAPStatusConfigType = NodeDef & {
3
3
  serviceNodeId: string;
4
4
  };
@@ -1,8 +1,8 @@
1
- import { NodeAPI } from 'node-red';
2
- import { NodeStatusUtils } from '../utils/NodeStatusUtils';
3
- import HAPServiceNodeType from './HAPServiceNodeType';
4
- import HAPStatusConfigType from './HAPStatusConfigType';
5
- import NodeType from './NodeType';
1
+ import type { NodeAPI } from 'node-red';
2
+ import type { NodeStatusUtils } from '../utils/NodeStatusUtils';
3
+ import type HAPServiceNodeType from './HAPServiceNodeType';
4
+ import type HAPStatusConfigType from './HAPStatusConfigType';
5
+ import type NodeType from './NodeType';
6
6
  type HAPStatusNodeType = NodeType & {
7
7
  config: HAPStatusConfigType;
8
8
  RED: NodeAPI;
@@ -1,3 +1,3 @@
1
- import { Node } from 'node-red';
1
+ import type { Node } from 'node-red';
2
2
  type NodeType = Node;
3
3
  export default NodeType;
@@ -1,5 +1,5 @@
1
- import { SerializedAccessory } from '@homebridge/hap-nodejs';
1
+ import type { SerializedAccessory } from '@homebridge/hap-nodejs';
2
2
  type SerializedHostType = {
3
3
  _isBridge: boolean;
4
4
  } & SerializedAccessory;
5
- export { SerializedHostType };
5
+ export type { SerializedHostType };
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const logger_1 = require("@nrchkb/logger");
4
- module.exports = function (node) {
4
+ module.exports = (node) => {
5
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;
9
9
  const log = (0, logger_1.logger)('NRCHKB', 'AccessoryUtils', node.config.name, node);
10
- const getOrCreate = function (host, accessoryInformation, subtypeUUID) {
10
+ const getOrCreate = (host, accessoryInformation, subtypeUUID) => {
11
+ var _a, _b, _c;
11
12
  let accessory;
12
13
  const services = [];
13
14
  log.debug(`Looking for accessory with service subtype ${subtypeUUID} ...`);
@@ -21,8 +22,10 @@ module.exports = function (node) {
21
22
  const accessoryInformationService = accessory.getService(Service.AccessoryInformation) ||
22
23
  accessory.addService(Service.AccessoryInformation);
23
24
  if (accessoryInformationService.getCharacteristic(Characteristic.Manufacturer).value !== accessoryInformation.manufacturer ||
24
- accessoryInformationService.getCharacteristic(Characteristic.Model).value !== accessoryInformation.model ||
25
- accessoryInformationService.getCharacteristic(Characteristic.Name).value !== accessoryInformation.name ||
25
+ accessoryInformationService.getCharacteristic(Characteristic.Model)
26
+ .value !== accessoryInformation.model ||
27
+ accessoryInformationService.getCharacteristic(Characteristic.Name)
28
+ .value !== accessoryInformation.name ||
26
29
  accessoryInformationService.getCharacteristic(Characteristic.SerialNumber).value !== accessoryInformation.serialNo) {
27
30
  log.debug('... Manufacturer, Model, Name or Serial Number changed! Replacing it.');
28
31
  accessory.services
@@ -53,16 +56,13 @@ module.exports = function (node) {
53
56
  (accessory === null || accessory === void 0 ? void 0 : accessory.addService(Service.AccessoryInformation));
54
57
  accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(Characteristic.Name, accessoryInformation.name).setCharacteristic(Characteristic.Manufacturer, accessoryInformation.manufacturer).setCharacteristic(Characteristic.SerialNumber, accessoryInformation.serialNo).setCharacteristic(Characteristic.Model, accessoryInformation.model);
55
58
  const revisionRegex = /\d+\.\d+\.\d+/;
56
- if (accessoryInformation.firmwareRev &&
57
- accessoryInformation.firmwareRev.match(revisionRegex)) {
59
+ if ((_a = accessoryInformation.firmwareRev) === null || _a === void 0 ? void 0 : _a.match(revisionRegex)) {
58
60
  accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(Characteristic.FirmwareRevision, accessoryInformation.firmwareRev);
59
61
  }
60
- if (accessoryInformation.hardwareRev &&
61
- accessoryInformation.hardwareRev.match(revisionRegex)) {
62
+ if ((_b = accessoryInformation.hardwareRev) === null || _b === void 0 ? void 0 : _b.match(revisionRegex)) {
62
63
  accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(Characteristic.HardwareRevision, accessoryInformation.hardwareRev);
63
64
  }
64
- if (accessoryInformation.softwareRev &&
65
- accessoryInformation.softwareRev.match(revisionRegex)) {
65
+ if ((_c = accessoryInformation.softwareRev) === null || _c === void 0 ? void 0 : _c.match(revisionRegex)) {
66
66
  accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(Characteristic.SoftwareRevision, accessoryInformation.softwareRev);
67
67
  }
68
68
  host.addBridgedAccessories([accessory]);
@@ -76,7 +76,7 @@ module.exports = function (node) {
76
76
  log.debug(`Bridge now has ${host.bridgedAccessories.length} accessories.`);
77
77
  return accessory;
78
78
  };
79
- const onIdentify = function (paired, callback) {
79
+ const onIdentify = (paired, callback) => {
80
80
  var _a;
81
81
  if (paired) {
82
82
  log.debug(`Identify called on paired Accessory ${node.accessory.displayName}`);
@@ -92,14 +92,14 @@ module.exports = function (node) {
92
92
  const msg = {
93
93
  payload: { Identify: 1 },
94
94
  name: nodes[i].name,
95
- topic: topic,
95
+ topic: topic
96
96
  };
97
97
  const statusId = nodes[i].nodeStatusUtils.setStatus({
98
98
  fill: 'yellow',
99
99
  shape: 'dot',
100
- text: 'Identify : 1',
100
+ text: 'Identify : 1'
101
101
  });
102
- setTimeout(function () {
102
+ setTimeout(() => {
103
103
  nodes[i].nodeStatusUtils.clearStatus(statusId);
104
104
  }, 3000);
105
105
  nodes[i].send([msg, msg]);
@@ -108,6 +108,6 @@ module.exports = function (node) {
108
108
  };
109
109
  return {
110
110
  getOrCreate,
111
- onIdentify,
111
+ onIdentify
112
112
  };
113
113
  };
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const logger_1 = require("@nrchkb/logger");
7
7
  const HostType_1 = __importDefault(require("../types/HostType"));
8
- module.exports = function () {
9
- const delayedPublish = function (node) {
8
+ module.exports = () => {
9
+ const delayedPublish = (node) => {
10
10
  const log = (0, logger_1.logger)('NRCHKB', 'BridgeUtils', node.config.name, node);
11
11
  if (!node.hostNode.published) {
12
12
  if (node.publishTimers[node.hostNode.id] !== undefined) {
@@ -15,7 +15,7 @@ module.exports = function () {
15
15
  const hostTypeName = node.hostNode.hostType == HostType_1.default.BRIDGE
16
16
  ? 'Bridge'
17
17
  : 'Standalone Accessory';
18
- node.publishTimers[node.hostNode.id] = setTimeout(function () {
18
+ node.publishTimers[node.hostNode.id] = setTimeout(() => {
19
19
  try {
20
20
  if (!node.hostNode.published) {
21
21
  const published = node.hostNode.publish();
@@ -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
  };
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const hap_nodejs_1 = require("@homebridge/hap-nodejs");
4
4
  const logger_1 = require("@nrchkb/logger");
5
- module.exports = function (node) {
5
+ module.exports = (node) => {
6
6
  const log = (0, logger_1.logger)('NRCHKB', 'CharacteristicUtils', node.config.name, node);
7
7
  const ServiceUtils = require('./ServiceUtils')(node);
8
- const load = function (service, config) {
8
+ const load = (service, config) => {
9
9
  let characteristicProperties = {};
10
10
  if (config.characteristicProperties &&
11
11
  config.characteristicProperties.length > 0) {
@@ -15,7 +15,7 @@ module.exports = function (node) {
15
15
  log.trace('Evaluated as:');
16
16
  log.trace(JSON.stringify(characteristicProperties));
17
17
  for (const key in characteristicProperties) {
18
- if (!characteristicProperties.hasOwnProperty(key))
18
+ if (!Object.hasOwn(characteristicProperties, key))
19
19
  continue;
20
20
  const characteristic = service.getCharacteristic(hap_nodejs_1.Characteristic[key]);
21
21
  if (characteristic && characteristicProperties[key]) {
@@ -26,13 +26,13 @@ module.exports = function (node) {
26
26
  }
27
27
  return characteristicProperties;
28
28
  };
29
- const subscribeAndGetSupported = function (service) {
29
+ const subscribeAndGetSupported = (service) => {
30
30
  const supported = [];
31
31
  const allCharacteristics = service.characteristics.concat(service.optionalCharacteristics);
32
32
  node.onCharacteristicGet = ServiceUtils.onCharacteristicGet;
33
33
  node.onCharacteristicSet = ServiceUtils.onCharacteristicSet(service.characteristics);
34
34
  node.onCharacteristicChange = ServiceUtils.onCharacteristicChange(service.characteristics);
35
- allCharacteristics.map((characteristic) => {
35
+ allCharacteristics.forEach((characteristic) => {
36
36
  const cKey = characteristic.constructor.name;
37
37
  supported.push(cKey);
38
38
  characteristic.on('get', node.onCharacteristicGet);
@@ -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
  };
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const hap_nodejs_1 = require("@homebridge/hap-nodejs");
4
4
  const logger_1 = require("@nrchkb/logger");
5
- module.exports = function (node) {
5
+ module.exports = (node) => {
6
6
  const log = (0, logger_1.logger)('NRCHKB', 'CharacteristicUtils', node.config.name, node);
7
7
  const ServiceUtils = require('./ServiceUtils2')(node);
8
- const load = function (service, config) {
8
+ const load = (service, config) => {
9
9
  let characteristicProperties = {};
10
10
  if (config.characteristicProperties &&
11
11
  config.characteristicProperties.length > 0) {
@@ -15,7 +15,7 @@ module.exports = function (node) {
15
15
  log.trace('Evaluated as:');
16
16
  log.trace(JSON.stringify(characteristicProperties));
17
17
  for (const key in characteristicProperties) {
18
- if (!characteristicProperties.hasOwnProperty(key))
18
+ if (!Object.hasOwn(characteristicProperties, key))
19
19
  continue;
20
20
  const characteristic = service.getCharacteristic(hap_nodejs_1.Characteristic[key]);
21
21
  if (characteristic && characteristicProperties[key]) {
@@ -26,13 +26,13 @@ module.exports = function (node) {
26
26
  }
27
27
  return characteristicProperties;
28
28
  };
29
- const subscribeAndGetSupported = function (service) {
29
+ const subscribeAndGetSupported = (service) => {
30
30
  const supported = [];
31
31
  const allCharacteristics = service.characteristics.concat(service.optionalCharacteristics);
32
32
  node.onCharacteristicGet = ServiceUtils.onCharacteristicGet(service.characteristics);
33
33
  node.onCharacteristicSet = ServiceUtils.onCharacteristicSet(service.characteristics);
34
34
  node.onCharacteristicChange = ServiceUtils.onCharacteristicChange(service.characteristics);
35
- allCharacteristics.map((characteristic) => {
35
+ allCharacteristics.forEach((characteristic) => {
36
36
  const cKey = characteristic.constructor.name;
37
37
  supported.push(cKey);
38
38
  characteristic.on('get', node.onCharacteristicGet);
@@ -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,5 +1,5 @@
1
- import { NodeStatus } from '@node-red/registry';
2
- import NodeType from '../types/NodeType';
1
+ import type { NodeStatus } from '@node-red/registry';
2
+ import type NodeType from '../types/NodeType';
3
3
  type StatusType = 'NO_RESPONSE' | 'MSG';
4
4
  type NodeStatusWithType = NodeStatus & {
5
5
  type?: StatusType;
@@ -9,7 +9,7 @@ class NodeStatusUtils {
9
9
  setStatus(status, timeout) {
10
10
  var _a;
11
11
  this.node.status(status);
12
- const newStatusId = new Date().getTime();
12
+ const newStatusId = Date.now();
13
13
  this.lastStatusId = newStatusId;
14
14
  if (typeof status !== 'string') {
15
15
  this.lastStatusType = (_a = status.type) !== null && _a !== void 0 ? _a : DEFAULT_STATUS_TYPE;
@@ -31,7 +31,7 @@ class NodeStatusUtils {
31
31
  if (statusId !== undefined) {
32
32
  if (statusId === this.lastStatusId) {
33
33
  if (timeout) {
34
- setTimeout(function (nodeStatusUtil) {
34
+ setTimeout((nodeStatusUtil) => {
35
35
  nodeStatusUtil.clearStatus(statusId);
36
36
  }, timeout, this);
37
37
  }
@@ -40,7 +40,7 @@ const util = __importStar(require("node:util"));
40
40
  const hap_nodejs_1 = require("@homebridge/hap-nodejs");
41
41
  const logger_1 = require("@nrchkb/logger");
42
42
  const NRCHKBError_1 = __importDefault(require("../NRCHKBError"));
43
- module.exports = function (node) {
43
+ module.exports = (node) => {
44
44
  const log = (0, logger_1.logger)('NRCHKB', 'ServiceUtils', node.config.name, node);
45
45
  const HapNodeJS = require('@homebridge/hap-nodejs');
46
46
  const Service = HapNodeJS.Service;
@@ -54,7 +54,7 @@ module.exports = function (node) {
54
54
  username: connection.username,
55
55
  remoteAddress: connection.remoteAddress,
56
56
  localAddress: connection.localAddress,
57
- httpPort: connection.remotePort,
57
+ httpPort: connection.remotePort
58
58
  };
59
59
  hap.context = {};
60
60
  }
@@ -93,27 +93,29 @@ module.exports = function (node) {
93
93
  msg.hap.reachable = (_a = node.reachable) !== null && _a !== void 0 ? _a : (_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.reachable;
94
94
  if (msg.hap.reachable === false) {
95
95
  ;
96
- [node, ...((_c = node.childNodes) !== null && _c !== void 0 ? _c : [])].forEach((n) => n.nodeStatusUtils.setStatus({
97
- fill: 'red',
98
- shape: 'ring',
99
- text: 'Not reachable',
100
- type: 'NO_RESPONSE',
101
- }));
96
+ [node, ...((_c = node.childNodes) !== null && _c !== void 0 ? _c : [])].forEach((n) => {
97
+ n.nodeStatusUtils.setStatus({
98
+ fill: 'red',
99
+ shape: 'ring',
100
+ text: 'Not reachable',
101
+ type: 'NO_RESPONSE'
102
+ });
103
+ });
102
104
  }
103
105
  else {
104
106
  msg.hap.newValue = newValue;
105
107
  node.nodeStatusUtils.setStatus({
106
108
  fill: 'yellow',
107
109
  shape: 'dot',
108
- text: key + ': ' + newValue,
110
+ text: `${key}: ${newValue}`
109
111
  }, 3000);
110
- (_d = node.childNodes) === null || _d === void 0 ? void 0 : _d.forEach((n) => n.nodeStatusUtils.clearStatusByType('NO_RESPONSE'));
112
+ (_d = node.childNodes) === null || _d === void 0 ? void 0 : _d.forEach((n) => {
113
+ n.nodeStatusUtils.clearStatusByType('NO_RESPONSE');
114
+ });
111
115
  (_e = node.parentNode) === null || _e === void 0 ? void 0 : _e.nodeStatusUtils.clearStatusByType('NO_RESPONSE');
112
116
  }
113
117
  log.debug(`${node.name} received ${key} : ${newValue}`);
114
- if (connection ||
115
- context ||
116
- node.hostNode.config.allowMessagePassthrough) {
118
+ if (connection || context || node.hostNode.config.allowMessagePassthrough) {
117
119
  if (outputNumber === 0) {
118
120
  node.send(msg);
119
121
  }
@@ -136,7 +138,7 @@ module.exports = function (node) {
136
138
  catch (_) { }
137
139
  onValueChange.call(this, allCharacteristics, 1, {
138
140
  newValue,
139
- context,
141
+ context
140
142
  }, connection);
141
143
  };
142
144
  const onCharacteristicChange = (allCharacteristics) => function (change) {
@@ -144,15 +146,15 @@ module.exports = function (node) {
144
146
  const { oldValue, newValue, context, originator, reason } = change;
145
147
  log.debug(`onCharacteristicChange with reason: ${reason}, oldValue: ${oldValue}, newValue: ${newValue}, reachability is ${((_a = node.parentNode) !== null && _a !== void 0 ? _a : node).reachable}
146
148
  with context ${util.inspect(context)} on connection ${originator === null || originator === void 0 ? void 0 : originator.sessionID}`);
147
- if (oldValue != newValue) {
149
+ if (oldValue !== newValue) {
148
150
  onValueChange.call(this, allCharacteristics, 0, {
149
151
  oldValue,
150
152
  newValue,
151
- context,
153
+ context
152
154
  }, originator);
153
155
  }
154
156
  };
155
- const onInput = function (msg) {
157
+ const onInput = (msg) => {
156
158
  var _a, _b;
157
159
  if (msg.payload) {
158
160
  const type = typeof msg.payload;
@@ -176,7 +178,7 @@ module.exports = function (node) {
176
178
  delete msg.payload.Context;
177
179
  }
178
180
  node.topic_in = (_b = msg.topic) !== null && _b !== void 0 ? _b : '';
179
- Object.keys(msg.payload).map((key) => {
181
+ Object.keys(msg.payload).forEach((key) => {
180
182
  var _a, _b, _c, _d;
181
183
  if (node.supported.indexOf(key) < 0) {
182
184
  if (key === 'AdaptiveLightingController' &&
@@ -205,9 +207,9 @@ module.exports = function (node) {
205
207
  }
206
208
  });
207
209
  };
208
- const onClose = function (removed, done) {
210
+ const onClose = (removed, done) => {
209
211
  const characteristics = node.service.characteristics.concat(node.service.optionalCharacteristics);
210
- characteristics.forEach(function (characteristic) {
212
+ characteristics.forEach((characteristic) => {
211
213
  characteristic.removeListener('get', node.onCharacteristicGet);
212
214
  characteristic.removeListener('set', node.onCharacteristicSet);
213
215
  characteristic.removeListener('change', node.onCharacteristicChange);
@@ -227,7 +229,7 @@ module.exports = function (node) {
227
229
  }
228
230
  done();
229
231
  };
230
- const getOrCreate = function (accessory, serviceInformation, parentService) {
232
+ const getOrCreate = (accessory, serviceInformation, parentService) => {
231
233
  const newService = new Service[serviceInformation.serviceName](serviceInformation.name, serviceInformation.UUID);
232
234
  log.debug(`Looking for service with UUID ${serviceInformation.UUID} ...`);
233
235
  let service = accessory.services.find((service) => {
@@ -265,7 +267,7 @@ module.exports = function (node) {
265
267
  }
266
268
  return service;
267
269
  };
268
- const configureCameraSource = function (_accessory, _service, config) {
270
+ const configureCameraSource = (_accessory, _service, config) => {
269
271
  if (config.cameraConfigSource) {
270
272
  log.debug('Configuring Camera Source');
271
273
  if (!config.cameraConfigVideoProcessor) {
@@ -284,11 +286,11 @@ module.exports = function (node) {
284
286
  node.nodeStatusUtils.setStatus({
285
287
  fill: 'blue',
286
288
  shape: 'dot',
287
- text: 'Waiting for Parent Service',
289
+ text: 'Waiting for Parent Service'
288
290
  });
289
291
  const checkAndWait = () => {
290
292
  const parentNode = node.RED.nodes.getNode(node.config.parentService);
291
- if (parentNode && parentNode.configured) {
293
+ if (parentNode === null || parentNode === void 0 ? void 0 : parentNode.configured) {
292
294
  resolve(parentNode);
293
295
  }
294
296
  else {
@@ -305,9 +307,9 @@ module.exports = function (node) {
305
307
  if (node.setupDone) {
306
308
  return;
307
309
  }
308
- if (msg.hasOwnProperty('payload') &&
309
- msg.payload.hasOwnProperty('nrchkb') &&
310
- msg.payload.nrchkb.hasOwnProperty('setup')) {
310
+ if (Object.hasOwn(msg, 'payload') &&
311
+ Object.hasOwn(msg.payload, 'nrchkb') &&
312
+ Object.hasOwn(msg.payload.nrchkb, 'setup')) {
311
313
  node.setupDone = true;
312
314
  const newConfig = Object.assign(Object.assign({}, config), msg.payload.nrchkb.setup);
313
315
  node.removeListener('input', node.handleWaitForSetup);
@@ -329,9 +331,8 @@ module.exports = function (node) {
329
331
  : 1,
330
332
  customTemperatureAdjustment: node.config
331
333
  .adaptiveLightingOptionsCustomTemperatureAdjustment
332
- ? +node.config
333
- .adaptiveLightingOptionsCustomTemperatureAdjustment
334
- : undefined,
334
+ ? +node.config.adaptiveLightingOptionsCustomTemperatureAdjustment
335
+ : undefined
335
336
  };
336
337
  log.trace(`Configuring Adaptive Lighting with options: ${options}`);
337
338
  const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(node.service, options);
@@ -342,24 +343,24 @@ module.exports = function (node) {
342
343
  transitionCurve: adaptiveLightingController.getAdaptiveLightingTransitionCurve(),
343
344
  brightnessAdjustmentRange: adaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange(),
344
345
  updateInterval: adaptiveLightingController.getAdaptiveLightingUpdateInterval(),
345
- notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold(),
346
+ notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold()
346
347
  };
347
348
  node.send({
348
349
  payload: {
349
350
  AdaptiveLightingController: {
350
351
  event: 'update',
351
- data: activeAdaptiveLightingTransition,
352
- },
353
- },
352
+ data: activeAdaptiveLightingTransition
353
+ }
354
+ }
354
355
  });
355
356
  });
356
357
  adaptiveLightingController.on('disable', () => {
357
358
  node.send({
358
359
  payload: {
359
360
  AdaptiveLightingController: {
360
- event: 'disable',
361
- },
362
- },
361
+ event: 'disable'
362
+ }
363
+ }
363
364
  });
364
365
  });
365
366
  node.accessory.configureController(adaptiveLightingController);
@@ -379,6 +380,6 @@ module.exports = function (node) {
379
380
  onClose,
380
381
  waitForParent,
381
382
  handleWaitForSetup,
382
- configureAdaptiveLightning,
383
+ configureAdaptiveLightning
383
384
  };
384
385
  };