hoffmation-base 0.1.36 → 0.1.37

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.
Files changed (32) hide show
  1. package/lib/server/config/iConfig.d.ts +0 -1
  2. package/lib/server/devices/button.d.ts +24 -0
  3. package/lib/server/devices/button.js +97 -0
  4. package/lib/server/devices/deviceType.d.ts +1 -0
  5. package/lib/server/devices/deviceType.js +1 -0
  6. package/lib/server/devices/devices.js +4 -0
  7. package/lib/server/devices/groups/praesenzGroup.d.ts +6 -0
  8. package/lib/server/devices/groups/praesenzGroup.js +14 -5
  9. package/lib/server/devices/groups/tasterGroup.d.ts +2 -2
  10. package/lib/server/devices/groups/tasterGroup.js +9 -7
  11. package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +13 -7
  12. package/lib/server/devices/hmIPDevices/hmIpTaster.js +34 -21
  13. package/lib/server/devices/hmIPDevices/hmIpWippe.d.ts +13 -6
  14. package/lib/server/devices/hmIPDevices/hmIpWippe.js +27 -9
  15. package/lib/server/devices/iButtonSwitch.d.ts +13 -0
  16. package/lib/server/devices/{iTaster.js → iButtonSwitch.js} +0 -0
  17. package/lib/server/devices/index.d.ts +2 -2
  18. package/lib/server/devices/index.js +2 -2
  19. package/lib/server/devices/zigbee/index.d.ts +2 -0
  20. package/lib/server/devices/zigbee/index.js +2 -0
  21. package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.d.ts +19 -0
  22. package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.js +105 -0
  23. package/lib/server/devices/zigbee/zigbeeIlluShutter.js +4 -0
  24. package/lib/server/devices/zigbee/zigbeeSwitch.d.ts +19 -0
  25. package/lib/server/devices/zigbee/zigbeeSwitch.js +13 -0
  26. package/lib/server/services/Telegram/telegram-Commands.js +1 -1
  27. package/lib/server/services/news-service.js +6 -1
  28. package/lib/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +14 -14
  30. package/lib/server/devices/iTaster.d.ts +0 -7
  31. package/lib/server/devices/taste.d.ts +0 -15
  32. package/lib/server/devices/taste.js +0 -64
@@ -8,7 +8,6 @@ export interface iRestSettings {
8
8
  port?: number;
9
9
  }
10
10
  export interface iConfig {
11
- cacheDir?: string;
12
11
  ioBrokerUrl: string;
13
12
  logSettings?: iLogSettings;
14
13
  translationSettings: iTranslationSettings;
@@ -0,0 +1,24 @@
1
+ export declare class ButtonCapabilities {
2
+ shortPress: boolean;
3
+ doublePress: boolean;
4
+ triplePress: boolean;
5
+ longPress: boolean;
6
+ }
7
+ export declare enum ButtonPressType {
8
+ short = 0,
9
+ long = 1,
10
+ double = 2,
11
+ triple = 3
12
+ }
13
+ export declare class Button {
14
+ name: string;
15
+ buttonCapabilities: ButtonCapabilities;
16
+ private _state;
17
+ private _callbacks;
18
+ private _timeouts;
19
+ getState(type: ButtonPressType): boolean;
20
+ constructor(name: string, buttonCapabilities: ButtonCapabilities);
21
+ addCb(buttonType: ButtonPressType, pCallback: (pValue: boolean) => void, description?: string): void;
22
+ getDescription(): string;
23
+ updateState(type: ButtonPressType, pValue: boolean): void;
24
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = exports.ButtonPressType = exports.ButtonCapabilities = void 0;
4
+ const utils_1 = require("../services/utils/utils");
5
+ const log_service_1 = require("../services/log-service/log-service");
6
+ const logLevel_1 = require("../../models/logLevel");
7
+ class ButtonCapabilities {
8
+ constructor() {
9
+ this.shortPress = true;
10
+ this.doublePress = true;
11
+ this.triplePress = true;
12
+ this.longPress = true;
13
+ }
14
+ }
15
+ exports.ButtonCapabilities = ButtonCapabilities;
16
+ var ButtonPressType;
17
+ (function (ButtonPressType) {
18
+ ButtonPressType[ButtonPressType["short"] = 0] = "short";
19
+ ButtonPressType[ButtonPressType["long"] = 1] = "long";
20
+ ButtonPressType[ButtonPressType["double"] = 2] = "double";
21
+ ButtonPressType[ButtonPressType["triple"] = 3] = "triple";
22
+ })(ButtonPressType = exports.ButtonPressType || (exports.ButtonPressType = {}));
23
+ class Button {
24
+ constructor(name, buttonCapabilities) {
25
+ this.name = name;
26
+ this.buttonCapabilities = buttonCapabilities;
27
+ this._state = new Map();
28
+ this._callbacks = new Map();
29
+ this._timeouts = new Map();
30
+ if (buttonCapabilities.shortPress) {
31
+ this._callbacks.set(ButtonPressType.short, []);
32
+ this._timeouts.set(ButtonPressType.short, null);
33
+ this._state.set(ButtonPressType.short, false);
34
+ }
35
+ if (buttonCapabilities.longPress) {
36
+ this._callbacks.set(ButtonPressType.long, []);
37
+ this._timeouts.set(ButtonPressType.long, null);
38
+ this._state.set(ButtonPressType.long, false);
39
+ }
40
+ if (buttonCapabilities.doublePress) {
41
+ this._callbacks.set(ButtonPressType.double, []);
42
+ this._timeouts.set(ButtonPressType.double, null);
43
+ this._state.set(ButtonPressType.double, false);
44
+ }
45
+ if (buttonCapabilities.triplePress) {
46
+ this._callbacks.set(ButtonPressType.triple, []);
47
+ this._timeouts.set(ButtonPressType.triple, null);
48
+ this._state.set(ButtonPressType.triple, false);
49
+ }
50
+ }
51
+ getState(type) {
52
+ var _a;
53
+ return (_a = this._state.get(type)) !== null && _a !== void 0 ? _a : false;
54
+ }
55
+ addCb(buttonType, pCallback, description = 'Not described') {
56
+ const cbArr = this._callbacks.get(buttonType);
57
+ if (cbArr === undefined) {
58
+ log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Error, `This Button doesn't support press Type ${ButtonPressType[buttonType]}`);
59
+ return;
60
+ }
61
+ cbArr.push({ cb: pCallback, description: description });
62
+ }
63
+ getDescription() {
64
+ const description = [];
65
+ for (const [key, arr] of this._callbacks.entries()) {
66
+ for (const entry of arr) {
67
+ description.push(`${ButtonPressType[key]}: "${entry.description}"`);
68
+ }
69
+ }
70
+ return description.join('\n');
71
+ }
72
+ updateState(type, pValue) {
73
+ var _a, _b;
74
+ if (pValue === this._state.get(type)) {
75
+ return;
76
+ }
77
+ this._state.set(type, pValue);
78
+ if (!this._callbacks.has(type)) {
79
+ log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Error, `This Button doesn't support press Type ${ButtonPressType[type]}`);
80
+ return;
81
+ }
82
+ for (const c of (_a = this._callbacks.get(type)) !== null && _a !== void 0 ? _a : []) {
83
+ c.cb(pValue);
84
+ }
85
+ if (!pValue) {
86
+ return;
87
+ }
88
+ const timeout = (_b = this._timeouts.get(type)) !== null && _b !== void 0 ? _b : null;
89
+ if (timeout !== null) {
90
+ clearTimeout(timeout);
91
+ }
92
+ this._timeouts.set(type, utils_1.Utils.guardedTimeout(() => {
93
+ this.updateState(type, false);
94
+ }, 5000, this));
95
+ }
96
+ }
97
+ exports.Button = Button;
@@ -28,5 +28,6 @@ export declare enum DeviceType {
28
28
  ZigbeeSonoffMotion = 214,
29
29
  ZigbeeAqaraMagnetContact = 215,
30
30
  ZigbeeSonoffTemp = 216,
31
+ ZigbeeAqaraOpple3Switch = 217,
31
32
  Wled = 1001
32
33
  }
@@ -32,5 +32,6 @@ var DeviceType;
32
32
  DeviceType[DeviceType["ZigbeeSonoffMotion"] = 214] = "ZigbeeSonoffMotion";
33
33
  DeviceType[DeviceType["ZigbeeAqaraMagnetContact"] = 215] = "ZigbeeAqaraMagnetContact";
34
34
  DeviceType[DeviceType["ZigbeeSonoffTemp"] = 216] = "ZigbeeSonoffTemp";
35
+ DeviceType[DeviceType["ZigbeeAqaraOpple3Switch"] = 217] = "ZigbeeAqaraOpple3Switch";
35
36
  DeviceType[DeviceType["Wled"] = 1001] = "Wled";
36
37
  })(DeviceType = exports.DeviceType || (exports.DeviceType = {}));
@@ -34,6 +34,7 @@ const zigbeeSonoffMotion_1 = require("./zigbee/zigbeeSonoffMotion");
34
34
  const hmIpAccessPoint_1 = require("./hmIPDevices/hmIpAccessPoint");
35
35
  const zigbeeAqaraMagnetContact_1 = require("./zigbee/zigbeeAqaraMagnetContact");
36
36
  const zigbeeSonoffTemp_1 = require("./zigbee/zigbeeSonoffTemp");
37
+ const zigbeeAqaraOpple3Switch_1 = require("./zigbee/zigbeeAqaraOpple3Switch");
37
38
  class Devices {
38
39
  constructor(pDeviceData, pRoomImportEnforcer) {
39
40
  // This forces import of rooms at correct timing, to allow devices to land in proper rooms.
@@ -93,6 +94,9 @@ class Devices {
93
94
  case 'AqaraMagnetContact':
94
95
  d = new zigbeeAqaraMagnetContact_1.ZigbeeAqaraMagnetContact(zigbeeInfo);
95
96
  break;
97
+ case 'AqaraOpple3Switch':
98
+ d = new zigbeeAqaraOpple3Switch_1.ZigbeeAqaraOpple3Switch(zigbeeInfo);
99
+ break;
96
100
  case 'AquaraMotion':
97
101
  d = new zigbeeAquaraMotion_1.ZigbeeAquaraMotion(zigbeeInfo);
98
102
  break;
@@ -4,6 +4,7 @@ import { BaseGroup } from './base-group';
4
4
  import { ZigbeeMotionSensor } from '../zigbee/zigbeeMotionSensor';
5
5
  export declare class PraesenzGroup extends BaseGroup {
6
6
  private _lastMovement;
7
+ private _lastLeftTimeout;
7
8
  getMotionDetector(): Array<HmIpBewegung | ZigbeeMotionSensor>;
8
9
  getPresenceSensors(): HmIpPraezenz[];
9
10
  constructor(roomName: string, presenceDetectorIds: string[], motionSensorIds: string[]);
@@ -11,6 +12,11 @@ export declare class PraesenzGroup extends BaseGroup {
11
12
  presentAmount(): number;
12
13
  anyPresent(): boolean;
13
14
  lastLeftCB(val: boolean, cb: () => void): void;
15
+ /**
16
+ * In case of an existing delayed last left callback timeout, this removes it.
17
+ * @private
18
+ */
19
+ private resetLastLeftTimeout;
14
20
  addLastLeftCallback(cb: () => void): void;
15
21
  private firstEnterCallback;
16
22
  addFirstEnterCallback(cb: () => void): void;
@@ -14,6 +14,7 @@ class PraesenzGroup extends base_group_1.BaseGroup {
14
14
  constructor(roomName, presenceDetectorIds, motionSensorIds) {
15
15
  super(roomName, group_type_1.GroupType.Presence);
16
16
  this._lastMovement = new Date(0);
17
+ this._lastLeftTimeout = null;
17
18
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.PresenceDetection, new device_list_1.DeviceList(presenceDetectorIds));
18
19
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MotionDetection, new device_list_1.DeviceList(motionSensorIds));
19
20
  }
@@ -94,10 +95,8 @@ class PraesenzGroup extends base_group_1.BaseGroup {
94
95
  return false;
95
96
  }
96
97
  lastLeftCB(val, cb) {
97
- if (val) {
98
- return;
99
- }
100
- if (this.anyPresent()) {
98
+ if (val || this.anyPresent()) {
99
+ this.resetLastLeftTimeout();
101
100
  return;
102
101
  }
103
102
  let timeAfterReset = utils_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
@@ -107,7 +106,8 @@ class PraesenzGroup extends base_group_1.BaseGroup {
107
106
  return;
108
107
  }
109
108
  this.log(logLevel_1.LogLevel.Debug, `Movement reset in ${this.roomName} delayed.`);
110
- utils_1.Utils.guardedTimeout(() => {
109
+ this.resetLastLeftTimeout();
110
+ this._lastLeftTimeout = utils_1.Utils.guardedTimeout(() => {
111
111
  timeAfterReset =
112
112
  utils_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
113
113
  this.log(logLevel_1.LogLevel.Debug, `Delayed Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
@@ -116,6 +116,15 @@ class PraesenzGroup extends base_group_1.BaseGroup {
116
116
  }
117
117
  }, Math.abs(timeAfterReset) + 500, this);
118
118
  }
119
+ /**
120
+ * In case of an existing delayed last left callback timeout, this removes it.
121
+ * @private
122
+ */
123
+ resetLastLeftTimeout() {
124
+ if (this._lastLeftTimeout !== null) {
125
+ clearTimeout(this._lastLeftTimeout);
126
+ }
127
+ }
119
128
  addLastLeftCallback(cb) {
120
129
  this.getPresenceSensors().forEach((p) => {
121
130
  p.addPresenceCallback((val) => {
@@ -1,7 +1,7 @@
1
- import { HmIpTaster } from '../hmIPDevices/hmIpTaster';
2
1
  import { BaseGroup } from './base-group';
2
+ import { iButtonSwitch } from '../iButtonSwitch';
3
3
  export declare class TasterGroup extends BaseGroup {
4
- getButtons(): HmIpTaster[];
4
+ getButtons(): iButtonSwitch[];
5
5
  constructor(roomName: string, buttonIds: string[]);
6
6
  initCallbacks(): void;
7
7
  }
@@ -5,6 +5,7 @@ const base_group_1 = require("./base-group");
5
5
  const device_cluster_type_1 = require("../device-cluster-type");
6
6
  const group_type_1 = require("./group-type");
7
7
  const device_list_1 = require("../device-list");
8
+ const button_1 = require("../button");
8
9
  class TasterGroup extends base_group_1.BaseGroup {
9
10
  getButtons() {
10
11
  return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.Buttons);
@@ -15,36 +16,37 @@ class TasterGroup extends base_group_1.BaseGroup {
15
16
  }
16
17
  initCallbacks() {
17
18
  this.getButtons().forEach((t) => {
18
- t.tasten.ObenLinks.addLongCallback((pValue) => {
19
+ var _a, _b, _c, _d, _e, _f, _g;
20
+ (_a = t.buttonTopLeft) === null || _a === void 0 ? void 0 : _a.addCb(button_1.ButtonPressType.long, (pValue) => {
19
21
  var _a;
20
22
  pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloDown(false, true));
21
23
  }, `Close all Rollos in this room`);
22
- t.tasten.ObenLinks.addShortCallback((pValue) => {
24
+ (_b = t.buttonTopLeft) === null || _b === void 0 ? void 0 : _b.addCb(button_1.ButtonPressType.short, (pValue) => {
23
25
  var _a;
24
26
  pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(25, true));
25
27
  }, `Nearly closes all Rollos in this room`);
26
- t.tasten.ObenRechts.addLongCallback((pValue) => {
28
+ (_c = t.buttonTopRight) === null || _c === void 0 ? void 0 : _c.addCb(button_1.ButtonPressType.long, (pValue) => {
27
29
  var _a;
28
30
  if (!pValue) {
29
31
  return;
30
32
  }
31
33
  (_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloUp(true);
32
34
  }, `Open all Rollos in this room`);
33
- t.tasten.ObenRechts.addShortCallback((pValue) => {
35
+ (_d = t.buttonTopRight) === null || _d === void 0 ? void 0 : _d.addCb(button_1.ButtonPressType.short, (pValue) => {
34
36
  var _a;
35
37
  pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(50, true));
36
38
  }, `All Rollos in this room to middle`);
37
- t.tasten.MitteLinks.addLongCallback((pValue) => {
39
+ (_e = t.buttonMidLeft) === null || _e === void 0 ? void 0 : _e.addCb(button_1.ButtonPressType.long, (pValue) => {
38
40
  var _a;
39
41
  pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true, true));
40
42
  }, `Turn all Lights in this room on`);
41
- t.tasten.MitteRechts.addLongCallback((pValue) => {
43
+ (_f = t.buttonMidRight) === null || _f === void 0 ? void 0 : _f.addCb(button_1.ButtonPressType.long, (pValue) => {
42
44
  var _a;
43
45
  pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false, true));
44
46
  }, `Turn all Lights in this room off`);
45
47
  const sonosGroup = this.getRoom().SonosGroup;
46
48
  if (sonosGroup !== undefined && sonosGroup.getOwnSonosDevices().length > 0) {
47
- t.tasten.UntenRechts.addLongCallback(() => {
49
+ (_g = t.buttonBotRight) === null || _g === void 0 ? void 0 : _g.addCb(button_1.ButtonPressType.long, () => {
48
50
  sonosGroup.trigger(this.getRoom().settings.radioUrl);
49
51
  });
50
52
  }
@@ -1,13 +1,19 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
- import { iTaster } from '../iTaster';
3
+ import { iButtonSwitch } from '../iButtonSwitch';
4
4
  import { DeviceInfo } from '../DeviceInfo';
5
- import { Taste } from '../taste';
6
- export declare class HmIpTaster extends HmIPDevice implements iTaster {
7
- tasten: {
8
- [id: string]: Taste;
9
- };
5
+ import { Button } from '../button';
6
+ export declare class HmIpTaster extends HmIPDevice implements iButtonSwitch {
7
+ private static readonly BUTTON_CAPABILLITIES;
8
+ buttonTopLeft: Button;
9
+ buttonMidLeft: Button;
10
+ buttonBotLeft: Button;
11
+ buttonTopRight: Button;
12
+ buttonMidRight: Button;
13
+ buttonBotRight: Button;
14
+ buttonBot: undefined;
15
+ buttonTop: undefined;
10
16
  constructor(pInfo: DeviceInfo);
11
17
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
12
- getTastenAssignment(): string;
18
+ getButtonAssignment(): string;
13
19
  }
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpTaster = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const taste_1 = require("../taste");
6
+ const button_1 = require("../button");
7
7
  const logLevel_1 = require("../../../models/logLevel");
8
8
  class HmIpTaster extends hmIpDevice_1.HmIPDevice {
9
9
  constructor(pInfo) {
10
10
  super(pInfo, deviceType_1.DeviceType.HmIpTaster);
11
- this.tasten = {
12
- ObenLinks: new taste_1.Taste(1),
13
- ObenRechts: new taste_1.Taste(2),
14
- MitteLinks: new taste_1.Taste(3),
15
- MitteRechts: new taste_1.Taste(4),
16
- UntenLinks: new taste_1.Taste(5),
17
- UntenRechts: new taste_1.Taste(6),
18
- };
11
+ this.buttonTopLeft = new button_1.Button('TopLeft', HmIpTaster.BUTTON_CAPABILLITIES);
12
+ this.buttonMidLeft = new button_1.Button('MidLeft', HmIpTaster.BUTTON_CAPABILLITIES);
13
+ this.buttonBotLeft = new button_1.Button('BotLeft', HmIpTaster.BUTTON_CAPABILLITIES);
14
+ this.buttonTopRight = new button_1.Button('TopRight', HmIpTaster.BUTTON_CAPABILLITIES);
15
+ this.buttonMidRight = new button_1.Button('MidRight', HmIpTaster.BUTTON_CAPABILLITIES);
16
+ this.buttonBotRight = new button_1.Button('BotRight', HmIpTaster.BUTTON_CAPABILLITIES);
17
+ this.buttonBot = undefined;
18
+ this.buttonTop = undefined;
19
19
  }
20
20
  update(idSplit, state, initial = false) {
21
21
  this.log(logLevel_1.LogLevel.DeepTrace, `Taster Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
@@ -23,22 +23,22 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
23
23
  let cTaste = undefined;
24
24
  switch (idSplit[3]) {
25
25
  case '1':
26
- cTaste = this.tasten.ObenLinks;
26
+ cTaste = this.buttonTopLeft;
27
27
  break;
28
28
  case '2':
29
- cTaste = this.tasten.ObenRechts;
29
+ cTaste = this.buttonTopRight;
30
30
  break;
31
31
  case '3':
32
- cTaste = this.tasten.MitteLinks;
32
+ cTaste = this.buttonMidLeft;
33
33
  break;
34
34
  case '4':
35
- cTaste = this.tasten.MitteRechts;
35
+ cTaste = this.buttonMidRight;
36
36
  break;
37
37
  case '5':
38
- cTaste = this.tasten.UntenLinks;
38
+ cTaste = this.buttonBotLeft;
39
39
  break;
40
40
  case '6':
41
- cTaste = this.tasten.UntenRechts;
41
+ cTaste = this.buttonBotRight;
42
42
  break;
43
43
  }
44
44
  if (cTaste === undefined) {
@@ -48,25 +48,32 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
48
48
  case 'PRESS_SHORT':
49
49
  if (!initial) {
50
50
  // Tasten beim Starten ignorieren
51
- cTaste.updateShort(state.val);
51
+ cTaste.updateState(button_1.ButtonPressType.short, state.val);
52
52
  }
53
53
  break;
54
54
  case 'PRESS_LONG':
55
55
  if (!initial) {
56
56
  // Tasten beim Starten ignorieren
57
- cTaste.updateLong(state.val);
57
+ cTaste.updateState(button_1.ButtonPressType.long, state.val);
58
58
  }
59
59
  break;
60
60
  }
61
61
  }
62
- getTastenAssignment() {
62
+ getButtonAssignment() {
63
63
  const result = [`Button: ${this.info.customName}`];
64
- for (const tastenName in this.tasten) {
65
- const desc = this.tasten[tastenName].getDescription();
64
+ for (const taste of [
65
+ this.buttonTopLeft,
66
+ this.buttonTopRight,
67
+ this.buttonMidLeft,
68
+ this.buttonMidRight,
69
+ this.buttonBotLeft,
70
+ this.buttonBotRight,
71
+ ]) {
72
+ const desc = taste.getDescription();
66
73
  if (desc === '') {
67
74
  continue;
68
75
  }
69
- result.push(`Button "${tastenName}":`);
76
+ result.push(`Button "${taste.name}":`);
70
77
  result.push(desc);
71
78
  result.push('');
72
79
  }
@@ -75,3 +82,9 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
75
82
  }
76
83
  }
77
84
  exports.HmIpTaster = HmIpTaster;
85
+ HmIpTaster.BUTTON_CAPABILLITIES = {
86
+ shortPress: true,
87
+ longPress: true,
88
+ doublePress: false,
89
+ triplePress: false,
90
+ };
@@ -1,12 +1,19 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
3
  import { DeviceInfo } from '../DeviceInfo';
4
- import { Taste } from '../taste';
5
- export declare class HmIpWippe extends HmIPDevice {
6
- tasten: {
7
- Unten: Taste;
8
- Oben: Taste;
9
- };
4
+ import { Button } from '../button';
5
+ import { iButtonSwitch } from '../iButtonSwitch';
6
+ export declare class HmIpWippe extends HmIPDevice implements iButtonSwitch {
7
+ private static readonly BUTTON_CAPABILLITIES;
8
+ buttonTopLeft: undefined;
9
+ buttonMidLeft: undefined;
10
+ buttonBotLeft: undefined;
11
+ buttonTopRight: undefined;
12
+ buttonMidRight: undefined;
13
+ buttonBotRight: undefined;
14
+ buttonBot: Button;
15
+ buttonTop: Button;
10
16
  constructor(pInfo: DeviceInfo);
11
17
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
18
+ getButtonAssignment(): string;
12
19
  }
@@ -3,15 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpWippe = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const taste_1 = require("../taste");
6
+ const button_1 = require("../button");
7
7
  const logLevel_1 = require("../../../models/logLevel");
8
8
  class HmIpWippe extends hmIpDevice_1.HmIPDevice {
9
9
  constructor(pInfo) {
10
10
  super(pInfo, deviceType_1.DeviceType.HmIpWippe);
11
- this.tasten = {
12
- Unten: new taste_1.Taste(1),
13
- Oben: new taste_1.Taste(2),
14
- };
11
+ this.buttonBot = new button_1.Button('Bottom', HmIpWippe.BUTTON_CAPABILLITIES);
12
+ this.buttonTop = new button_1.Button('Top', HmIpWippe.BUTTON_CAPABILLITIES);
15
13
  }
16
14
  update(idSplit, state, initial = false) {
17
15
  this.log(logLevel_1.LogLevel.DeepTrace, `Wippe Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
@@ -19,10 +17,10 @@ class HmIpWippe extends hmIpDevice_1.HmIPDevice {
19
17
  let cTaste = undefined;
20
18
  switch (idSplit[3]) {
21
19
  case '1':
22
- cTaste = this.tasten.Unten;
20
+ cTaste = this.buttonBot;
23
21
  break;
24
22
  case '2':
25
- cTaste = this.tasten.Oben;
23
+ cTaste = this.buttonTop;
26
24
  break;
27
25
  }
28
26
  if (cTaste === undefined) {
@@ -33,17 +31,37 @@ class HmIpWippe extends hmIpDevice_1.HmIPDevice {
33
31
  if (!initial) {
34
32
  // Tasten beim Starten ignorieren
35
33
  this.log(logLevel_1.LogLevel.Debug, `Tasten Update initial ignoriert`);
36
- cTaste.updateShort(state.val);
34
+ cTaste.updateState(button_1.ButtonPressType.short, state.val);
37
35
  }
38
36
  break;
39
37
  case 'PRESS_LONG':
40
38
  if (!initial) {
41
39
  // Tasten beim Starten ignorieren
42
40
  this.log(logLevel_1.LogLevel.Debug, `Tasten Update initial ignoriert`);
43
- cTaste.updateLong(state.val);
41
+ cTaste.updateState(button_1.ButtonPressType.long, state.val);
44
42
  }
45
43
  break;
46
44
  }
47
45
  }
46
+ getButtonAssignment() {
47
+ const result = [`Button: ${this.info.customName}`];
48
+ for (const taste of [this.buttonTop, this.buttonBot]) {
49
+ const desc = taste.getDescription();
50
+ if (desc === '') {
51
+ continue;
52
+ }
53
+ result.push(`Button "${taste.name}":`);
54
+ result.push(desc);
55
+ result.push('');
56
+ }
57
+ result.push('____________');
58
+ return result.join('\n');
59
+ }
48
60
  }
49
61
  exports.HmIpWippe = HmIpWippe;
62
+ HmIpWippe.BUTTON_CAPABILLITIES = {
63
+ shortPress: true,
64
+ longPress: true,
65
+ doublePress: false,
66
+ triplePress: false,
67
+ };
@@ -0,0 +1,13 @@
1
+ import { Button } from './button';
2
+ import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
3
+ export interface iButtonSwitch extends IoBrokerBaseDevice {
4
+ buttonTopLeft: Button | undefined;
5
+ buttonTopRight: Button | undefined;
6
+ buttonMidLeft: Button | undefined;
7
+ buttonMidRight: Button | undefined;
8
+ buttonBotLeft: Button | undefined;
9
+ buttonBotRight: Button | undefined;
10
+ buttonBot: Button | undefined;
11
+ buttonTop: Button | undefined;
12
+ getButtonAssignment(): string;
13
+ }
@@ -2,6 +2,7 @@ export * from './groups/index';
2
2
  export * from './hmIPDevices/index';
3
3
  export * from './models/index';
4
4
  export * from './zigbee/index';
5
+ export * from './button';
5
6
  export * from './device-cluster';
6
7
  export * from './device-cluster-type';
7
8
  export * from './device-list';
@@ -11,6 +12,7 @@ export * from './deviceType';
11
12
  export * from './deviceUpdater';
12
13
  export * from './Griffe';
13
14
  export * from './Heizgruppen';
15
+ export * from './iButtonSwitch';
14
16
  export * from './iDeviceUpdater';
15
17
  export * from './iHumiditySensor';
16
18
  export * from './iIlluminationSensor';
@@ -18,7 +20,5 @@ export * from './iHeater';
18
20
  export * from './iLamp';
19
21
  export * from './IoBrokerBaseDevice';
20
22
  export * from './iShutter';
21
- export * from './iTaster';
22
23
  export * from './iTemperaturSensor';
23
- export * from './taste';
24
24
  export * from './wledDevice';
@@ -14,6 +14,7 @@ __exportStar(require("./groups/index"), exports);
14
14
  __exportStar(require("./hmIPDevices/index"), exports);
15
15
  __exportStar(require("./models/index"), exports);
16
16
  __exportStar(require("./zigbee/index"), exports);
17
+ __exportStar(require("./button"), exports);
17
18
  __exportStar(require("./device-cluster"), exports);
18
19
  __exportStar(require("./device-cluster-type"), exports);
19
20
  __exportStar(require("./device-list"), exports);
@@ -23,6 +24,7 @@ __exportStar(require("./deviceType"), exports);
23
24
  __exportStar(require("./deviceUpdater"), exports);
24
25
  __exportStar(require("./Griffe"), exports);
25
26
  __exportStar(require("./Heizgruppen"), exports);
27
+ __exportStar(require("./iButtonSwitch"), exports);
26
28
  __exportStar(require("./iDeviceUpdater"), exports);
27
29
  __exportStar(require("./iHumiditySensor"), exports);
28
30
  __exportStar(require("./iIlluminationSensor"), exports);
@@ -30,7 +32,5 @@ __exportStar(require("./iHeater"), exports);
30
32
  __exportStar(require("./iLamp"), exports);
31
33
  __exportStar(require("./IoBrokerBaseDevice"), exports);
32
34
  __exportStar(require("./iShutter"), exports);
33
- __exportStar(require("./iTaster"), exports);
34
35
  __exportStar(require("./iTemperaturSensor"), exports);
35
- __exportStar(require("./taste"), exports);
36
36
  __exportStar(require("./wledDevice"), exports);
@@ -1,5 +1,6 @@
1
1
  export * from './ZigbeeActuator';
2
2
  export * from './zigbeeAqaraMagnetContact';
3
+ export * from './zigbeeAqaraOpple3Switch';
3
4
  export * from './zigbeeAquaraMotion';
4
5
  export * from './zigbeeAquaraVibra';
5
6
  export * from './zigbeeAquaraWater';
@@ -18,3 +19,4 @@ export * from './zigbeeShutter';
18
19
  export * from './zigbeeSMaBiTMagnetContact';
19
20
  export * from './zigbeeSonoffMotion';
20
21
  export * from './zigbeeSonoffTemp';
22
+ export * from './zigbeeSwitch';
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./ZigbeeActuator"), exports);
14
14
  __exportStar(require("./zigbeeAqaraMagnetContact"), exports);
15
+ __exportStar(require("./zigbeeAqaraOpple3Switch"), exports);
15
16
  __exportStar(require("./zigbeeAquaraMotion"), exports);
16
17
  __exportStar(require("./zigbeeAquaraVibra"), exports);
17
18
  __exportStar(require("./zigbeeAquaraWater"), exports);
@@ -30,3 +31,4 @@ __exportStar(require("./zigbeeShutter"), exports);
30
31
  __exportStar(require("./zigbeeSMaBiTMagnetContact"), exports);
31
32
  __exportStar(require("./zigbeeSonoffMotion"), exports);
32
33
  __exportStar(require("./zigbeeSonoffTemp"), exports);
34
+ __exportStar(require("./zigbeeSwitch"), exports);
@@ -0,0 +1,19 @@
1
+ /// <reference types="iobroker" />
2
+ import { ZigbeeSwitch } from './zigbeeSwitch';
3
+ import { Button } from '../button';
4
+ import { DeviceInfo } from '../DeviceInfo';
5
+ export declare class ZigbeeAqaraOpple3Switch extends ZigbeeSwitch {
6
+ private static readonly BUTTON_CAPABILLITIES;
7
+ buttonTopLeft: Button;
8
+ buttonMidLeft: Button;
9
+ buttonBotLeft: Button;
10
+ buttonTopRight: Button;
11
+ buttonMidRight: Button;
12
+ buttonBotRight: Button;
13
+ buttonBot: undefined;
14
+ buttonTop: undefined;
15
+ constructor(pInfo: DeviceInfo);
16
+ update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
17
+ private updateButton;
18
+ getButtonAssignment(): string;
19
+ }