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

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.
@@ -71,6 +71,10 @@ class DoorDevice extends RoomBaseDevice_1.RoomBaseDevice {
71
71
  });
72
72
  }
73
73
  onNewDingActiveValue(newValue) {
74
+ if (this._dingActive && newValue && utils_1.Utils.nowMS() - this._lastDing < 5000) {
75
+ // Ignore duplicate dings
76
+ return;
77
+ }
74
78
  this.log(enums_1.LogLevel.Debug, `Update for DingActive to value: ${newValue}`);
75
79
  this._dingActive = newValue;
76
80
  if (newValue) {
@@ -31,6 +31,7 @@ class OwnUnifiDoor extends DoorDevice_1.DoorDevice {
31
31
  const event = packet.data;
32
32
  if (((_a = event._source.authentication) === null || _a === void 0 ? void 0 : _a.credential_provider) === 'BUTTON_DOOR_BELL' &&
33
33
  event._source.event.type === 'access.door.unlock') {
34
+ // this.log(LogLevel.Debug, `Ding Event details: ${Util.inspect(event, false, 5)}`);
34
35
  this.onNewDingActiveValue(true);
35
36
  }
36
37
  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) {