hoffmation-base 1.1.0 → 1.1.3

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 (33) hide show
  1. package/lib/models/deviceSettings/wledSettings.d.ts +2 -2
  2. package/lib/models/deviceSettings/wledSettings.js +2 -2
  3. package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +1 -0
  4. package/lib/server/devices/baseDeviceInterfaces/iButtonSwitch.d.ts +2 -1
  5. package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.d.ts +1 -0
  6. package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +3 -5
  7. package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +1 -0
  8. package/lib/server/devices/groups/lampenGroup.js +1 -1
  9. package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +3 -0
  10. package/lib/server/devices/hmIPDevices/hmIpLampe.js +10 -1
  11. package/lib/server/devices/hmIPDevices/hmIpRoll.d.ts +1 -0
  12. package/lib/server/devices/hmIPDevices/hmIpRoll.js +5 -0
  13. package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +2 -1
  14. package/lib/server/devices/hmIPDevices/hmIpTaster.js +19 -7
  15. package/lib/server/devices/hmIPDevices/hmIpWippe.d.ts +2 -1
  16. package/lib/server/devices/hmIPDevices/hmIpWippe.js +14 -4
  17. package/lib/server/devices/wledDevice.d.ts +10 -2
  18. package/lib/server/devices/wledDevice.js +38 -5
  19. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +1 -0
  20. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +4 -0
  21. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +1 -0
  22. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +5 -0
  23. package/lib/server/devices/zigbee/BaseDevices/zigbeeSwitch.d.ts +2 -1
  24. package/lib/server/devices/zigbee/BaseDevices/zigbeeSwitch.js +5 -0
  25. package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.js +17 -11
  26. package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +3 -0
  27. package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +10 -1
  28. package/lib/server/devices/zigbee/zigbeeIlluLampe.js +1 -1
  29. package/lib/server/services/dbo/iPersist.d.ts +4 -2
  30. package/lib/server/services/dbo/postgreSqlPersist.d.ts +4 -2
  31. package/lib/server/services/dbo/postgreSqlPersist.js +61 -8
  32. package/lib/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { DeviceSettings } from './deviceSettings';
2
- export declare class WledSettings extends DeviceSettings {
1
+ import { DimmerSettings } from './dimmerSettings';
2
+ export declare class WledSettings extends DimmerSettings {
3
3
  dayOn: boolean;
4
4
  dayBrightness: number;
5
5
  dawnOn: boolean;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WledSettings = void 0;
4
- const deviceSettings_1 = require("./deviceSettings");
5
- class WledSettings extends deviceSettings_1.DeviceSettings {
4
+ const dimmerSettings_1 = require("./dimmerSettings");
5
+ class WledSettings extends dimmerSettings_1.DimmerSettings {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.dayOn = false;
@@ -3,6 +3,7 @@ import { iRoomDevice } from './iRoomDevice';
3
3
  export interface iActuator extends iRoomDevice {
4
4
  settings: ActuatorSettings;
5
5
  actuatorOn: boolean;
6
+ persist(): void;
6
7
  /**
7
8
  * Controls the power state of this actuator
8
9
  * @param {boolean} pValue the new desired State
@@ -1,4 +1,4 @@
1
- import { Button } from '../button';
1
+ import { Button, ButtonPressType } from '../button';
2
2
  import { iRoomDevice } from './iRoomDevice';
3
3
  export interface iButtonSwitch extends iRoomDevice {
4
4
  buttonTopLeft: Button | undefined;
@@ -9,5 +9,6 @@ export interface iButtonSwitch extends iRoomDevice {
9
9
  buttonBotRight: Button | undefined;
10
10
  buttonBot: Button | undefined;
11
11
  buttonTop: Button | undefined;
12
+ persist(buttonName: string, pressType: ButtonPressType): void;
12
13
  getButtonAssignment(): string;
13
14
  }
@@ -2,6 +2,7 @@ import { iLamp } from './iLamp';
2
2
  import { DimmerSettings, TimeOfDay } from '../../../models';
3
3
  export interface iDimmableLamp extends iLamp {
4
4
  settings: DimmerSettings;
5
+ readonly brightness: number;
5
6
  toggleLight(time: TimeOfDay, force: boolean, calculateTime: boolean): void;
6
7
  /**
7
8
  * This function sets the light to a specific value
@@ -1,9 +1,7 @@
1
- import { ActuatorSettings, TimeOfDay } from '../../../models';
2
- import { iRoomDevice } from './iRoomDevice';
3
- export interface iLamp extends iRoomDevice {
4
- settings: ActuatorSettings;
1
+ import { TimeOfDay } from '../../../models';
2
+ import { iActuator } from './iActuator';
3
+ export interface iLamp extends iActuator {
5
4
  lightOn: boolean;
6
- persist(): void;
7
5
  setTimeBased(time: TimeOfDay, timeout: number, force: boolean): void;
8
6
  toggleLight(time: TimeOfDay, force: boolean, calculateTime: boolean): void;
9
7
  /**
@@ -4,5 +4,6 @@ export interface iShutter extends iRoomDevice {
4
4
  currentLevel: number;
5
5
  desiredFensterLevel: number;
6
6
  fenster: Fenster | undefined;
7
+ persist(): void;
7
8
  setLevel(pPosition: number, initial: boolean, skipOpenWarning?: boolean): void;
8
9
  }
@@ -131,7 +131,7 @@ class LampenGroup extends base_group_1.BaseGroup {
131
131
  }
132
132
  setAllWled(pValue, brightness = -1, preset) {
133
133
  this.getWled().forEach((w) => {
134
- w.setLight(pValue, brightness, preset);
134
+ w.setWled(pValue, brightness, preset);
135
135
  });
136
136
  }
137
137
  }
@@ -11,7 +11,10 @@ export declare class HmIpLampe extends HmIPDevice implements iLamp {
11
11
  private _turnOffTimeout;
12
12
  private turnOffTime;
13
13
  constructor(pInfo: IoBrokerDeviceInfo);
14
+ get actuatorOn(): boolean;
14
15
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
16
+ setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
17
+ toggleActuator(force: boolean): boolean;
15
18
  /** @inheritdoc */
16
19
  setLight(pValue: boolean, timeout?: number, force?: boolean): void;
17
20
  toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
@@ -18,6 +18,9 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
18
18
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
19
19
  this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
20
20
  }
21
+ get actuatorOn() {
22
+ return this.lightOn;
23
+ }
21
24
  update(idSplit, state, initial = false) {
22
25
  this.log(models_1.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
23
26
  super.update(idSplit, state, initial, true);
@@ -31,6 +34,12 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
31
34
  break;
32
35
  }
33
36
  }
37
+ setActuator(pValue, timeout, force) {
38
+ this.setLight(pValue, timeout, force);
39
+ }
40
+ toggleActuator(force) {
41
+ return this.toggleLight(undefined, force);
42
+ }
34
43
  /** @inheritdoc */
35
44
  setLight(pValue, timeout = -1, force = false) {
36
45
  if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
@@ -101,7 +110,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
101
110
  }
102
111
  persist() {
103
112
  var _a;
104
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
113
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
105
114
  }
106
115
  }
107
116
  exports.HmIpLampe = HmIpLampe;
@@ -17,6 +17,7 @@ export declare class HmIpRoll extends HmIPDevice implements iShutter {
17
17
  get fenster(): Fenster | undefined;
18
18
  set fenster(value: Fenster | undefined);
19
19
  get desiredFensterLevel(): number;
20
+ persist(): void;
20
21
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
21
22
  setLevel(pPosition: number, initial?: boolean, skipOpenWarning?: boolean): void;
22
23
  toJSON(): Partial<IoBrokerBaseDevice>;
@@ -36,6 +36,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
36
36
  var _a;
37
37
  (_a = this._fenster) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(value);
38
38
  }, this);
39
+ this.persist();
39
40
  }
40
41
  this._currentLevel = value;
41
42
  }
@@ -51,6 +52,10 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
51
52
  }
52
53
  return this._fenster.desiredPosition;
53
54
  }
55
+ persist() {
56
+ var _a;
57
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistShutter(this);
58
+ }
54
59
  update(idSplit, state, initial = false) {
55
60
  this.log(models_2.LogLevel.DeepTrace, `Rollo Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
56
61
  super.update(idSplit, state, initial, true);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
3
  import { iBatteryDevice, iButtonSwitch } from '../baseDeviceInterfaces';
4
- import { Button } from '../button';
4
+ import { Button, ButtonPressType } from '../button';
5
5
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
6
6
  export declare class HmIpTaster extends HmIPDevice implements iButtonSwitch, iBatteryDevice {
7
7
  private static readonly BUTTON_CAPABILLITIES;
@@ -15,6 +15,7 @@ export declare class HmIpTaster extends HmIPDevice implements iButtonSwitch, iBa
15
15
  buttonTop: undefined;
16
16
  battery: number;
17
17
  constructor(pInfo: IoBrokerDeviceInfo);
18
+ persist(buttonName: string, pressType: ButtonPressType): void;
18
19
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
19
20
  getButtonAssignment(): string;
20
21
  }
@@ -6,20 +6,25 @@ const deviceType_1 = require("../deviceType");
6
6
  const button_1 = require("../button");
7
7
  const models_1 = require("../../../models");
8
8
  const DeviceCapability_1 = require("../DeviceCapability");
9
+ const services_1 = require("../../services");
9
10
  class HmIpTaster extends hmIpDevice_1.HmIPDevice {
10
11
  constructor(pInfo) {
11
12
  super(pInfo, deviceType_1.DeviceType.HmIpTaster);
13
+ this.buttonBot = undefined;
14
+ this.buttonTop = undefined;
15
+ this.battery = -99;
16
+ this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.buttonSwitch);
17
+ this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
12
18
  this.buttonTopLeft = new button_1.Button('TopLeft', HmIpTaster.BUTTON_CAPABILLITIES);
13
19
  this.buttonMidLeft = new button_1.Button('MidLeft', HmIpTaster.BUTTON_CAPABILLITIES);
14
20
  this.buttonBotLeft = new button_1.Button('BotLeft', HmIpTaster.BUTTON_CAPABILLITIES);
15
21
  this.buttonTopRight = new button_1.Button('TopRight', HmIpTaster.BUTTON_CAPABILLITIES);
16
22
  this.buttonMidRight = new button_1.Button('MidRight', HmIpTaster.BUTTON_CAPABILLITIES);
17
23
  this.buttonBotRight = new button_1.Button('BotRight', HmIpTaster.BUTTON_CAPABILLITIES);
18
- this.buttonBot = undefined;
19
- this.buttonTop = undefined;
20
- this.battery = -99;
21
- this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.buttonSwitch);
22
- this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
24
+ }
25
+ persist(buttonName, pressType) {
26
+ var _a;
27
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistSwitchInput(this, pressType, buttonName);
23
28
  }
24
29
  update(idSplit, state, initial = false) {
25
30
  this.log(models_1.LogLevel.DeepTrace, `Taster Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
@@ -55,17 +60,24 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
55
60
  if (cTaste === undefined) {
56
61
  return;
57
62
  }
63
+ const boolVal = state.val;
58
64
  switch (idSplit[4]) {
59
65
  case 'PRESS_SHORT':
60
66
  if (!initial) {
61
67
  // Tasten beim Starten ignorieren
62
- cTaste.updateState(button_1.ButtonPressType.short, state.val);
68
+ if (boolVal) {
69
+ this.persist(cTaste.name, button_1.ButtonPressType.short);
70
+ }
71
+ cTaste.updateState(button_1.ButtonPressType.short, boolVal);
63
72
  }
64
73
  break;
65
74
  case 'PRESS_LONG':
66
75
  if (!initial) {
67
76
  // Tasten beim Starten ignorieren
68
- cTaste.updateState(button_1.ButtonPressType.long, state.val);
77
+ if (boolVal) {
78
+ this.persist(cTaste.name, button_1.ButtonPressType.long);
79
+ }
80
+ cTaste.updateState(button_1.ButtonPressType.long, boolVal);
69
81
  }
70
82
  break;
71
83
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
- import { Button } from '../button';
3
+ import { Button, ButtonPressType } from '../button';
4
4
  import { iButtonSwitch } from '../baseDeviceInterfaces';
5
5
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
6
6
  export declare class HmIpWippe extends HmIPDevice implements iButtonSwitch {
@@ -15,5 +15,6 @@ export declare class HmIpWippe extends HmIPDevice implements iButtonSwitch {
15
15
  buttonTop: Button;
16
16
  constructor(pInfo: IoBrokerDeviceInfo);
17
17
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
18
+ persist(buttonName: string, pressType: ButtonPressType): void;
18
19
  getButtonAssignment(): string;
19
20
  }
@@ -6,6 +6,7 @@ const deviceType_1 = require("../deviceType");
6
6
  const button_1 = require("../button");
7
7
  const models_1 = require("../../../models");
8
8
  const DeviceCapability_1 = require("../DeviceCapability");
9
+ const services_1 = require("../../services");
9
10
  class HmIpWippe extends hmIpDevice_1.HmIPDevice {
10
11
  constructor(pInfo) {
11
12
  super(pInfo, deviceType_1.DeviceType.HmIpWippe);
@@ -28,23 +29,32 @@ class HmIpWippe extends hmIpDevice_1.HmIPDevice {
28
29
  if (cTaste === undefined) {
29
30
  return;
30
31
  }
32
+ const boolVal = state.val;
31
33
  switch (idSplit[4]) {
32
34
  case 'PRESS_SHORT':
33
35
  if (!initial) {
34
36
  // Tasten beim Starten ignorieren
35
- this.log(models_1.LogLevel.Debug, `Tasten Update initial ignoriert`);
36
- cTaste.updateState(button_1.ButtonPressType.short, state.val);
37
+ if (boolVal) {
38
+ this.persist(cTaste.name, button_1.ButtonPressType.short);
39
+ }
40
+ cTaste.updateState(button_1.ButtonPressType.short, boolVal);
37
41
  }
38
42
  break;
39
43
  case 'PRESS_LONG':
40
44
  if (!initial) {
41
45
  // Tasten beim Starten ignorieren
42
- this.log(models_1.LogLevel.Debug, `Tasten Update initial ignoriert`);
43
- cTaste.updateState(button_1.ButtonPressType.long, state.val);
46
+ if (boolVal) {
47
+ this.persist(cTaste.name, button_1.ButtonPressType.long);
48
+ }
49
+ cTaste.updateState(button_1.ButtonPressType.long, boolVal);
44
50
  }
45
51
  break;
46
52
  }
47
53
  }
54
+ persist(buttonName, pressType) {
55
+ var _a;
56
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistSwitchInput(this, pressType, buttonName);
57
+ }
48
58
  getButtonAssignment() {
49
59
  const result = [`Button: ${this.info.customName}`];
50
60
  for (const taste of [this.buttonTop, this.buttonBot]) {
@@ -3,7 +3,8 @@ import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
3
3
  import { TimeOfDay } from '../../models';
4
4
  import { WledSettings } from '../../models/deviceSettings/wledSettings';
5
5
  import { IoBrokerDeviceInfo } from './IoBrokerDeviceInfo';
6
- export declare class WledDevice extends IoBrokerBaseDevice {
6
+ import { iDimmableLamp } from './baseDeviceInterfaces/iDimmableLamp';
7
+ export declare class WledDevice extends IoBrokerBaseDevice implements iDimmableLamp {
7
8
  on: boolean;
8
9
  brightness: number;
9
10
  linkQuality: number;
@@ -14,7 +15,14 @@ export declare class WledDevice extends IoBrokerBaseDevice {
14
15
  private readonly _presetID;
15
16
  private readonly _brightnessID;
16
17
  constructor(pInfo: IoBrokerDeviceInfo);
18
+ get actuatorOn(): boolean;
19
+ get lightOn(): boolean;
17
20
  update(idSplit: string[], state: ioBroker.State, initial?: boolean, _pOverride?: boolean): void;
18
- setLight(pValue: boolean, brightness?: number, preset?: number): void;
21
+ setLight(pValue: boolean, _timeout?: number, _force?: boolean, brightness?: number, _transitionTime?: number): void;
22
+ setWled(pValue: boolean, brightness?: number, preset?: number): void;
19
23
  setTimeBased(time: TimeOfDay): void;
24
+ persist(): void;
25
+ setActuator(pValue: boolean, _timeout?: number, _force?: boolean): void;
26
+ toggleActuator(_force: boolean): boolean;
27
+ toggleLight(time?: TimeOfDay, _force?: boolean, calculateTime?: boolean): boolean;
20
28
  }
@@ -19,6 +19,12 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
19
19
  this._presetID = `${this.info.fullID}.ps`;
20
20
  this._brightnessID = `${this.info.fullID}.bri`;
21
21
  }
22
+ get actuatorOn() {
23
+ return this.on;
24
+ }
25
+ get lightOn() {
26
+ return this.on;
27
+ }
22
28
  update(idSplit, state, initial = false, _pOverride = false) {
23
29
  services_1.ServerLogService.writeLog(models_1.LogLevel.DeepTrace, `Wled: ${initial ? 'Initiales ' : ''}Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
24
30
  switch (idSplit[3]) {
@@ -30,7 +36,10 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
30
36
  break;
31
37
  }
32
38
  }
33
- setLight(pValue, brightness = -1, preset) {
39
+ setLight(pValue, _timeout, _force, brightness, _transitionTime) {
40
+ this.setWled(pValue, brightness);
41
+ }
42
+ setWled(pValue, brightness = -1, preset) {
34
43
  if (this._onID === '') {
35
44
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Keine On ID für "${this.info.customName}" bekannt.`);
36
45
  return;
@@ -62,25 +71,49 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
62
71
  switch (time) {
63
72
  case models_1.TimeOfDay.Night:
64
73
  if (this.settings.nightOn) {
65
- this.setLight(true, this.settings.nightBrightness, this.settings.nightPreset);
74
+ this.setWled(true, this.settings.nightBrightness, this.settings.nightPreset);
66
75
  }
67
76
  break;
68
77
  case models_1.TimeOfDay.AfterSunset:
69
78
  if (this.settings.duskOn) {
70
- this.setLight(true, this.settings.duskBrightness, this.settings.duskPreset);
79
+ this.setWled(true, this.settings.duskBrightness, this.settings.duskPreset);
71
80
  }
72
81
  break;
73
82
  case models_1.TimeOfDay.BeforeSunrise:
74
83
  if (this.settings.dawnOn) {
75
- this.setLight(true, this.settings.dawnBrightness, this.settings.dawnPreset);
84
+ this.setWled(true, this.settings.dawnBrightness, this.settings.dawnPreset);
76
85
  }
77
86
  break;
78
87
  case models_1.TimeOfDay.Daylight:
79
88
  if (this.settings.dayOn) {
80
- this.setLight(true, this.settings.dayBrightness, this.settings.dayPreset);
89
+ this.setWled(true, this.settings.dayBrightness, this.settings.dayPreset);
81
90
  }
82
91
  break;
83
92
  }
84
93
  }
94
+ persist() {
95
+ var _a;
96
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
97
+ }
98
+ setActuator(pValue, _timeout, _force) {
99
+ this.setLight(pValue);
100
+ }
101
+ toggleActuator(_force) {
102
+ this.setLight(!this.on);
103
+ return this.on;
104
+ }
105
+ toggleLight(time, _force = false, calculateTime = false) {
106
+ var _a;
107
+ const newVal = !this.lightOn;
108
+ if (newVal && time === undefined && calculateTime && this.room !== undefined) {
109
+ time = services_1.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
110
+ }
111
+ if (newVal && time !== undefined) {
112
+ this.setTimeBased(time);
113
+ return true;
114
+ }
115
+ this.setLight(newVal);
116
+ return newVal;
117
+ }
85
118
  }
86
119
  exports.WledDevice = WledDevice;
@@ -14,5 +14,6 @@ export declare class ZigbeeActuator extends ZigbeeDevice implements iActuator {
14
14
  constructor(pInfo: IoBrokerDeviceInfo, type: DeviceType, actuatorOnSwitchID: string);
15
15
  update(idSplit: string[], state: ioBroker.State, initial?: boolean, handledByChildObject?: boolean): void;
16
16
  setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
17
+ persist(): void;
17
18
  toggleActuator(force?: boolean): boolean;
18
19
  }
@@ -68,6 +68,10 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
68
68
  }
69
69
  }, timeout, this);
70
70
  }
71
+ persist() {
72
+ var _a;
73
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
74
+ }
71
75
  toggleActuator(force = false) {
72
76
  const newVal = this.queuedValue !== null ? !this.queuedValue : !this.actuatorOn;
73
77
  const timeout = newVal && force ? 30 * 60 * 1000 : -1;
@@ -22,6 +22,7 @@ export declare class ZigbeeShutter extends ZigbeeDevice implements iShutter {
22
22
  get fenster(): Fenster | undefined;
23
23
  set fenster(value: Fenster | undefined);
24
24
  get desiredFensterLevel(): number;
25
+ persist(): void;
25
26
  update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
26
27
  setLevel(pPosition: number, initial?: boolean, skipOpenWarning?: boolean): void;
27
28
  toJSON(): Partial<IoBrokerBaseDevice>;
@@ -45,6 +45,7 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
45
45
  var _a;
46
46
  (_a = this._fenster) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(value);
47
47
  }, this);
48
+ this.persist();
48
49
  }
49
50
  this._currentLevel = value;
50
51
  }
@@ -60,6 +61,10 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
60
61
  }
61
62
  return this._fenster.desiredPosition;
62
63
  }
64
+ persist() {
65
+ var _a;
66
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistShutter(this);
67
+ }
63
68
  update(idSplit, state, initial = false, pOverride = false) {
64
69
  super.update(idSplit, state, initial, pOverride);
65
70
  }
@@ -2,7 +2,7 @@
2
2
  import { iButtonSwitch } from '../../baseDeviceInterfaces';
3
3
  import { ZigbeeDevice } from './zigbeeDevice';
4
4
  import { DeviceType } from '../../deviceType';
5
- import { Button } from '../../button';
5
+ import { Button, ButtonPressType } from '../../button';
6
6
  import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
7
7
  export declare abstract class ZigbeeSwitch extends ZigbeeDevice implements iButtonSwitch {
8
8
  battery: number;
@@ -15,6 +15,7 @@ export declare abstract class ZigbeeSwitch extends ZigbeeDevice implements iButt
15
15
  abstract buttonTopLeft: Button | undefined;
16
16
  abstract buttonTopRight: Button | undefined;
17
17
  constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
18
+ persist(buttonName: string, pressType: ButtonPressType): void;
18
19
  update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverrride?: boolean): void;
19
20
  abstract getButtonAssignment(): string;
20
21
  }
@@ -4,12 +4,17 @@ exports.ZigbeeSwitch = void 0;
4
4
  const zigbeeDevice_1 = require("./zigbeeDevice");
5
5
  const DeviceCapability_1 = require("../../DeviceCapability");
6
6
  const models_1 = require("../../../../models");
7
+ const services_1 = require("../../../services");
7
8
  class ZigbeeSwitch extends zigbeeDevice_1.ZigbeeDevice {
8
9
  constructor(pInfo, deviceType) {
9
10
  super(pInfo, deviceType);
10
11
  this.battery = -99;
11
12
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
12
13
  }
14
+ persist(buttonName, pressType) {
15
+ var _a;
16
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistSwitchInput(this, pressType, buttonName);
17
+ }
13
18
  update(idSplit, state, initial = false, pOverrride = false) {
14
19
  super.update(idSplit, state, initial, pOverrride);
15
20
  switch (idSplit[3]) {
@@ -77,23 +77,29 @@ class ZigbeeAqaraOpple3Switch extends BaseDevices_1.ZigbeeSwitch {
77
77
  this.log(models_1.LogLevel.Error, `Unknown index: ${index} for button, Aqara Opple 3 has only 6 buttons.`);
78
78
  return;
79
79
  }
80
+ let pressType = undefined;
80
81
  switch (parts[2]) {
81
82
  case 'click':
82
- taste.updateState(button_1.ButtonPressType.short, val);
83
- return;
83
+ pressType = button_1.ButtonPressType.short;
84
+ break;
84
85
  case 'hold':
85
- taste.updateState(button_1.ButtonPressType.long, val);
86
- return;
86
+ pressType = button_1.ButtonPressType.long;
87
+ break;
87
88
  case 'double':
88
- taste.updateState(button_1.ButtonPressType.double, val);
89
- return;
89
+ pressType = button_1.ButtonPressType.double;
90
+ break;
90
91
  case 'triple':
91
- taste.updateState(button_1.ButtonPressType.triple, val);
92
- return;
93
- default:
94
- this.log(models_1.LogLevel.Error, `Unknown pressType: "${parts[2]}" for button, Aqara Opple 3 has only types "click, hold, double, triple".`);
95
- return;
92
+ pressType = button_1.ButtonPressType.triple;
93
+ break;
94
+ }
95
+ if (pressType == undefined) {
96
+ this.log(models_1.LogLevel.Error, `Unknown pressType: "${parts[2]}" for button, Aqara Opple 3 has only types "click, hold, double, triple".`);
97
+ return;
98
+ }
99
+ if (val) {
100
+ this.persist(taste.name, pressType);
96
101
  }
102
+ taste.updateState(pressType, val);
97
103
  }
98
104
  }
99
105
  exports.ZigbeeAqaraOpple3Switch = ZigbeeAqaraOpple3Switch;
@@ -16,8 +16,11 @@ export declare class ZigbeeIlluDimmer extends ZigbeeDevice implements iDimmableL
16
16
  private turnOffTime;
17
17
  private _lastPersist;
18
18
  constructor(pInfo: IoBrokerDeviceInfo);
19
+ get actuatorOn(): boolean;
19
20
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
20
21
  setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
22
+ setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
23
+ toggleActuator(force: boolean): boolean;
21
24
  /**
22
25
  * @inheritDoc
23
26
  * @param pValue The desired value
@@ -26,6 +26,9 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
26
26
  this.brightnessID = `${this.info.fullID}.brightness`;
27
27
  this.transitionID = `${this.info.fullID}.transition_time`;
28
28
  }
29
+ get actuatorOn() {
30
+ return this.lightOn;
31
+ }
29
32
  update(idSplit, state, initial = false) {
30
33
  this.queuedValue = null;
31
34
  this.log(models_1.LogLevel.DeepTrace, `Dimmer Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
@@ -63,6 +66,12 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
63
66
  break;
64
67
  }
65
68
  }
69
+ setActuator(pValue, timeout, force) {
70
+ this.setLight(pValue, timeout, force);
71
+ }
72
+ toggleActuator(force) {
73
+ return this.toggleLight(undefined, force);
74
+ }
66
75
  /**
67
76
  * @inheritDoc
68
77
  * @param pValue The desired value
@@ -135,7 +144,7 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
135
144
  if (this._lastPersist + 1000 < now) {
136
145
  return;
137
146
  }
138
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
147
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
139
148
  this._lastPersist = now;
140
149
  }
141
150
  toggleLight(time, force = false, calculateTime = false) {
@@ -60,7 +60,7 @@ class ZigbeeIlluLampe extends zigbeeIlluActuator_1.ZigbeeIlluActuator {
60
60
  }
61
61
  persist() {
62
62
  var _a;
63
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
63
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
64
64
  }
65
65
  }
66
66
  exports.ZigbeeIlluLampe = ZigbeeIlluLampe;
@@ -1,4 +1,4 @@
1
- import { iAcDevice, iBaseDevice, iHeater, iLamp, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
1
+ import { ButtonPressType, iAcDevice, iActuator, iBaseDevice, iButtonSwitch, iHeater, iMotionSensor, IoBrokerBaseDevice, iShutter } from '../../devices';
2
2
  import { CountToday, CurrentIlluminationDataPoint, EnergyCalculation, RoomBase, ShutterCalibration, TemperaturDataPoint } from '../../../models';
3
3
  export interface iPersist {
4
4
  initialized: boolean;
@@ -12,7 +12,9 @@ export interface iPersist {
12
12
  persistCurrentIllumination(data: CurrentIlluminationDataPoint): void;
13
13
  persistEnergyManager(energyData: EnergyCalculation): void;
14
14
  persistAC(device: iAcDevice): void;
15
- persistLamp(device: iLamp): void;
15
+ persistActuator(device: iActuator): void;
16
+ persistSwitchInput(device: iButtonSwitch, pressType: ButtonPressType, buttonName: string): void;
16
17
  persistMotionSensor(device: iMotionSensor): void;
18
+ persistShutter(device: iShutter): void;
17
19
  readTemperaturDataPoint(hzGrp: iHeater, limit: number): Promise<TemperaturDataPoint[]>;
18
20
  }
@@ -1,6 +1,6 @@
1
1
  import { iPersist } from './iPersist';
2
2
  import { CountToday, CurrentIlluminationDataPoint, EnergyCalculation, RoomBase, ShutterCalibration, TemperaturDataPoint } from '../../../models';
3
- import { iAcDevice, iBaseDevice, iHeater, iLamp, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
3
+ import { ButtonPressType, iAcDevice, iActuator, iBaseDevice, iButtonSwitch, iHeater, iMotionSensor, IoBrokerBaseDevice, iShutter } from '../../devices';
4
4
  import { iPersistenceSettings } from '../../config';
5
5
  export declare class PostgreSqlPersist implements iPersist {
6
6
  initialized: boolean;
@@ -13,8 +13,10 @@ export declare class PostgreSqlPersist implements iPersist {
13
13
  getShutterCalibration(_device: IoBrokerBaseDevice): Promise<ShutterCalibration>;
14
14
  initialize(): Promise<void>;
15
15
  persistAC(device: iAcDevice): void;
16
- persistLamp(device: iLamp): void;
16
+ persistActuator(device: iActuator): void;
17
+ persistSwitchInput(device: iButtonSwitch, pressType: ButtonPressType, buttonName: string): void;
17
18
  persistMotionSensor(device: iMotionSensor): void;
19
+ persistShutter(device: iShutter): void;
18
20
  persistCurrentIllumination(data: CurrentIlluminationDataPoint): void;
19
21
  persistShutterCalibration(_data: ShutterCalibration): void;
20
22
  readTemperaturDataPoint(heater: iHeater, limit: number): Promise<TemperaturDataPoint[]>;