hoffmation-base 3.2.3-alpha.3 → 3.2.3-alpha.4

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,8 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = 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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.OwnUnifiDoor = void 0;
4
37
  const DoorDevice_1 = require("../DoorDevice");
5
38
  const enums_1 = require("../../enums");
39
+ const Util = __importStar(require("node:util"));
6
40
  class OwnUnifiDoor extends DoorDevice_1.DoorDevice {
7
41
  constructor(name, roomName, unifiDeviceName) {
8
42
  super(name, roomName);
@@ -31,6 +65,7 @@ class OwnUnifiDoor extends DoorDevice_1.DoorDevice {
31
65
  const event = packet.data;
32
66
  if (((_a = event._source.authentication) === null || _a === void 0 ? void 0 : _a.credential_provider) === 'BUTTON_DOOR_BELL' &&
33
67
  event._source.event.type === 'access.door.unlock') {
68
+ this.log(enums_1.LogLevel.Debug, `Ding Event details: ${Util.inspect(event, false, 5)}`);
34
69
  this.onNewDingActiveValue(true);
35
70
  }
36
71
  return;
@@ -19,7 +19,10 @@ class UnifiAccess {
19
19
  // We had an update within the last 3 minutes --> no need to reconnect
20
20
  return;
21
21
  }
22
- this.reconnect(settings);
22
+ this._api.logout();
23
+ utils_1.Utils.guardedTimeout(() => {
24
+ this.reconnect(settings);
25
+ }, 5000, this);
23
26
  }, 5 * 60 * 1000);
24
27
  }
25
28
  static addDevice(door) {
@@ -53,6 +56,7 @@ class UnifiAccess {
53
56
  for (const device of this._api.devices) {
54
57
  this.initializeDevice(device);
55
58
  }
59
+ this._api.off('message', this.onMessage.bind(this));
56
60
  this._api.on('message', this.onMessage.bind(this));
57
61
  }
58
62
  onMessage(packet) {