hoffmation-base 2.22.17 → 2.23.0

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.
@@ -12,7 +12,7 @@ export declare class DaikinService {
12
12
  static getDevice(name: string): DaikinAC | undefined;
13
13
  static initialize(): Promise<void>;
14
14
  static setAll(on: boolean, force?: boolean): void;
15
- static reconnect(name: string, ip: string): Promise<DaikinAC | undefined>;
15
+ static reconnect(name: string, ip: string, mac?: string): Promise<DaikinAC | undefined>;
16
16
  private static reconstructDaikinAc;
17
17
  private static initializeDevice;
18
18
  }
@@ -85,13 +85,18 @@ class DaikinService {
85
85
  }
86
86
  }
87
87
  }
88
- static async reconnect(name, ip) {
88
+ static async reconnect(name, ip, mac) {
89
89
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Reconnecting Daikin AC "${name}"`);
90
90
  const router = network_1.Router.getRouter();
91
91
  if (router === undefined) {
92
92
  return this.reconstructDaikinAc(ip, name);
93
93
  }
94
- await router.reconnectDeviceByIp(ip);
94
+ if (mac !== undefined) {
95
+ await router.reconnectDeviceByMac(mac);
96
+ }
97
+ else {
98
+ await router.reconnectDeviceByIp(ip);
99
+ }
95
100
  await utils_1.Utils.delay(5000);
96
101
  return this.reconstructDaikinAc(ip, name);
97
102
  }
@@ -3,13 +3,14 @@ import { AcDevice } from './ac-device';
3
3
  import { AcMode } from './ac-mode';
4
4
  import { DeviceType } from '../../devices';
5
5
  export declare class OwnDaikinDevice extends AcDevice {
6
+ private _device;
7
+ private _mac;
6
8
  desiredState: boolean;
7
9
  desiredHum: number | 'AUTO';
8
10
  desiredMode: number;
9
11
  deviceType: DeviceType;
10
12
  private _on;
11
- constructor(name: string, roomName: string, ip: string, device: DaikinAC | undefined);
12
- private _device;
13
+ constructor(name: string, roomName: string, ip: string, _device: DaikinAC | undefined, _mac?: string | undefined);
13
14
  get device(): DaikinAC | undefined;
14
15
  get on(): boolean;
15
16
  set device(device: DaikinAC | undefined);
@@ -16,14 +16,15 @@ const acDeviceType_1 = require("./acDeviceType");
16
16
  const devices_1 = require("../../devices");
17
17
  const lodash_1 = __importDefault(require("lodash"));
18
18
  class OwnDaikinDevice extends ac_device_1.AcDevice {
19
- constructor(name, roomName, ip, device) {
19
+ constructor(name, roomName, ip, _device, _mac = undefined) {
20
20
  super(name, roomName, ip, acDeviceType_1.AcDeviceType.Daikin);
21
+ this._device = _device;
22
+ this._mac = _mac;
21
23
  this.desiredState = daikin_controller_1.Power.OFF;
22
24
  this.desiredHum = 'AUTO';
23
25
  this.desiredMode = daikin_controller_1.Mode.COLD;
24
26
  this.deviceType = devices_1.DeviceType.Daikin;
25
27
  this._on = false;
26
- this._device = device;
27
28
  }
28
29
  get device() {
29
30
  return this._device;
@@ -138,11 +139,15 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
138
139
  }
139
140
  handleDeviceUnreach() {
140
141
  this.log(models_1.LogLevel.Warn, `Detected EHOSTUNREACH for ${this.name}(${this.ip}), will try reconecting`);
141
- daikin_service_1.DaikinService.reconnect(this.name, this.ip).then((device) => {
142
+ daikin_service_1.DaikinService.reconnect(this.name, this.ip, this._mac)
143
+ .then((device) => {
142
144
  this.device = device;
143
145
  utils_1.Utils.guardedTimeout(() => {
144
146
  this.setDesiredInfo(true);
145
147
  }, 5000, this);
148
+ })
149
+ .catch((err) => {
150
+ this.log(models_1.LogLevel.Error, `Reconnecting failed for ${this.name}(${this.ip}): ${err}`);
146
151
  });
147
152
  }
148
153
  handleParamNg(changeObject) {