hoffmation-base 2.18.3 → 2.18.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.
@@ -19,7 +19,7 @@ class DeviceUpdater {
19
19
  }
20
20
  }
21
21
  updateState(id, state, initial = false) {
22
- var _a, _b;
22
+ var _a;
23
23
  if (state === null) {
24
24
  // Ignore null states
25
25
  return;
@@ -27,10 +27,16 @@ class DeviceUpdater {
27
27
  const idSplit = IoBrokerDeviceInfo_1.IoBrokerDeviceInfo.idSplitter(id);
28
28
  if (idSplit.length < 2)
29
29
  return;
30
+ let classifier = idSplit[0];
31
+ let devId = idSplit[2];
30
32
  if (idSplit[0] == 'mqtt') {
31
33
  mqtt_1.MqttCoordinator.update(idSplit, state);
32
34
  }
33
- const device = (_a = devices_1.Devices.alLDevices[`${idSplit[0]}-${idSplit[2]}`]) !== null && _a !== void 0 ? _a : devices_1.Devices.alLDevices[`${idSplit[0]}-${idSplit[2].substring(2)}`];
35
+ else if (idSplit[0] == devices_1.Devices.IDENTIFIER_ZIGBEE2MQTT) {
36
+ classifier = devices_1.Devices.IDENTIFIER_ZIGBEE;
37
+ devId = idSplit[2].substring(2);
38
+ }
39
+ const device = devices_1.Devices.alLDevices[`${classifier}-${devId}`];
34
40
  if (typeof device === 'undefined' || device.update === undefined) {
35
41
  return;
36
42
  }
@@ -38,7 +44,7 @@ class DeviceUpdater {
38
44
  device.update(idSplit, state, initial, false);
39
45
  }
40
46
  catch (e) {
41
- services_1.ServerLogService.writeLog(models_1.LogLevel.Alert, `deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${(_b = e === null || e === void 0 ? void 0 : e.stack) !== null && _b !== void 0 ? _b : ''}`);
47
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Alert, `deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${(_a = e === null || e === void 0 ? void 0 : e.stack) !== null && _a !== void 0 ? _a : ''}`);
42
48
  }
43
49
  }
44
50
  }
@@ -8,6 +8,7 @@ export declare class Devices {
8
8
  static IDENTIFIER_Shelly: string;
9
9
  static IDENTIFIER_TUYA: string;
10
10
  static IDENTIFIER_ZIGBEE: string;
11
+ static IDENTIFIER_ZIGBEE2MQTT: string;
11
12
  static IDENTIFIER_WLED: string;
12
13
  static alLDevices: {
13
14
  [id: string]: iBaseDevice;
@@ -132,7 +132,7 @@ class Devices {
132
132
  static processZigbeeDevice(cDevConf) {
133
133
  const zigbeeInfo = new IoBrokerDeviceInfo_1.IoBrokerDeviceInfo(cDevConf);
134
134
  const apiDevId = zigbeeInfo.devID.startsWith('0x') ? zigbeeInfo.devID.substring(2) : zigbeeInfo.devID;
135
- const fullName = `${Devices.IDENTIFIER_ZIGBEE}-${apiDevId}`;
135
+ const fullName = `zigbee-${apiDevId}`;
136
136
  zigbeeInfo.allDevicesKey = fullName;
137
137
  if (typeof Devices.alLDevices[fullName] !== 'undefined') {
138
138
  return;
@@ -301,6 +301,7 @@ Devices.IDENTIFIER_JS = 'javascript';
301
301
  Devices.IDENTIFIER_Shelly = 'shelly';
302
302
  Devices.IDENTIFIER_TUYA = 'tuya';
303
303
  Devices.IDENTIFIER_ZIGBEE = 'zigbee';
304
+ Devices.IDENTIFIER_ZIGBEE2MQTT = 'zigbee2mqtt';
304
305
  Devices.IDENTIFIER_WLED = 'wled';
305
306
  Devices.alLDevices = {};
306
307
  Devices.energymanager = undefined;
@@ -79,7 +79,7 @@ class ZigbeeAqaraOpple3Switch extends BaseDevices_1.ZigbeeSwitch {
79
79
  }
80
80
  let pressType = undefined;
81
81
  switch (parts[2]) {
82
- case 'click':
82
+ case 'single':
83
83
  pressType = button_1.ButtonPressType.short;
84
84
  break;
85
85
  case 'hold':