homebridge-tydom 0.23.7 → 0.23.9

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/README.md CHANGED
@@ -213,8 +213,9 @@ You can override categories of devices (eg. some light switch used to manage a f
213
213
  }
214
214
  ```
215
215
 
216
- > `3` being the `Fan` number.
217
- > `8` being the `Switch` number.
216
+ > `3` being the `Categories.FAN` number.
217
+
218
+ You can find the [global list here](https://github.com/homebridge/HAP-NodeJS/blob/v0.11.0/src/lib/Accessory.ts#L87)
218
219
 
219
220
  ### Supported hardware
220
221
 
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateOutlet = exports.setupOutlet = void 0;
4
- const definitions_1 = require("hap-nodejs/dist/lib/definitions");
5
4
  const lodash_1 = require("lodash");
6
5
  const tydom_1 = require("../helpers/tydom");
7
6
  const utils_1 = require("../utils");
@@ -10,7 +9,7 @@ const accessory_1 = require("../helpers/accessory");
10
9
  const setupOutlet = (accessory, controller) => {
11
10
  const { context } = accessory;
12
11
  const { client } = controller;
13
- const { On } = hap_1.Characteristic;
12
+ const { On, OutletInUse } = hap_1.Characteristic;
14
13
  const { deviceId, endpointId } = context;
15
14
  (0, accessory_1.setupAccessoryInformationService)(accessory, controller);
16
15
  (0, accessory_1.setupAccessoryIdentifyHandler)(accessory, controller);
@@ -49,14 +48,14 @@ const setupOutlet = (accessory, controller) => {
49
48
  }
50
49
  });
51
50
  service
52
- .getCharacteristic(definitions_1.OutletInUse)
51
+ .getCharacteristic(OutletInUse)
53
52
  .on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
54
- (0, utils_1.debugGet)(definitions_1.OutletInUse, service);
53
+ (0, utils_1.debugGet)(OutletInUse, service);
55
54
  try {
56
55
  const data = await (0, tydom_1.getTydomDeviceData)(client, { deviceId, endpointId });
57
56
  const energyInstantTotElecP = (0, tydom_1.getTydomDataPropValue)(data, 'energyInstantTotElecP');
58
57
  const nextValue = energyInstantTotElecP > 0;
59
- (0, utils_1.debugGetResult)(definitions_1.OutletInUse, service, nextValue);
58
+ (0, utils_1.debugGetResult)(OutletInUse, service, nextValue);
60
59
  callback(null, nextValue);
61
60
  }
62
61
  catch (err) {
@@ -68,7 +67,7 @@ exports.setupOutlet = setupOutlet;
68
67
  const updateOutlet = (accessory, _controller, updates) => {
69
68
  updates.forEach((update) => {
70
69
  const { name, value } = update;
71
- const { On } = hap_1.Characteristic;
70
+ const { On, OutletInUse } = hap_1.Characteristic;
72
71
  switch (name) {
73
72
  case 'level': {
74
73
  const service = (0, accessory_1.getAccessoryService)(accessory, hap_1.Service.Outlet);
@@ -80,8 +79,8 @@ const updateOutlet = (accessory, _controller, updates) => {
80
79
  case 'energyInstantTotElecP': {
81
80
  const service = (0, accessory_1.getAccessoryService)(accessory, hap_1.Service.Outlet);
82
81
  const nextValue = (0, lodash_1.toNumber)(value) > 0;
83
- (0, utils_1.debugSetUpdate)(definitions_1.OutletInUse, service, nextValue);
84
- service.updateCharacteristic(definitions_1.OutletInUse, nextValue);
82
+ (0, utils_1.debugSetUpdate)(OutletInUse, service, nextValue);
83
+ service.updateCharacteristic(OutletInUse, nextValue);
85
84
  return;
86
85
  }
87
86
  default:
@@ -65,7 +65,7 @@ const getTydomAccessorySetup = (accessory, context) => {
65
65
  case 4 /* Categories.GARAGE_DOOR_OPENER */:
66
66
  return garageDoorOpener_1.setupGarageDoorOpener;
67
67
  case 8 /* Categories.SWITCH */:
68
- return ((_a = context.settings) === null || _a === void 0 ? void 0 : _a.trigger) ? switch_1.setupSwitch : triggerSwitch_1.setupTriggerSwitch;
68
+ return ((_a = context.settings) === null || _a === void 0 ? void 0 : _a.trigger) ? triggerSwitch_1.setupTriggerSwitch : switch_1.setupSwitch;
69
69
  case 14 /* Categories.WINDOW_COVERING */:
70
70
  return windowCovering_1.setupWindowCovering;
71
71
  case 11 /* Categories.SECURITY_SYSTEM */:
@@ -97,7 +97,7 @@ const getTydomAccessoryDataUpdate = (accessory, context) => {
97
97
  case 4 /* Categories.GARAGE_DOOR_OPENER */:
98
98
  return garageDoorOpener_1.updateGarageDoorOpener;
99
99
  case 8 /* Categories.SWITCH */:
100
- return ((_a = context.settings) === null || _a === void 0 ? void 0 : _a.trigger) ? switch_1.updateSwitch : triggerSwitch_1.updateTriggerSwitch;
100
+ return ((_a = context.settings) === null || _a === void 0 ? void 0 : _a.trigger) ? triggerSwitch_1.updateTriggerSwitch : switch_1.updateSwitch;
101
101
  case 14 /* Categories.WINDOW_COVERING */:
102
102
  return windowCovering_1.updateWindowCovering;
103
103
  case 11 /* Categories.SECURITY_SYSTEM */:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-tydom",
3
- "version": "0.23.7",
3
+ "version": "0.23.9",
4
4
  "description": "Homebridge plugin to manage Tydom devices by Delta Dore",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",