hoffmation-base 2.23.0 → 3.0.0-alpha.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.
Files changed (111) hide show
  1. package/lib/models/command/ShutterSetLevelCommand.d.ts +10 -0
  2. package/lib/models/command/ShutterSetLevelCommand.js +17 -0
  3. package/lib/models/command/WindowRestoreDesiredPositionCommand.d.ts +7 -0
  4. package/lib/models/command/WindowRestoreDesiredPositionCommand.js +12 -0
  5. package/lib/models/command/WindowSetDesiredPositionCommand.d.ts +8 -0
  6. package/lib/models/command/WindowSetDesiredPositionCommand.js +13 -0
  7. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.d.ts +7 -0
  8. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +12 -0
  9. package/lib/models/command/actuatorSetStateCommand.d.ts +13 -0
  10. package/lib/models/command/actuatorSetStateCommand.js +22 -0
  11. package/lib/models/command/actuatorToggleCommand.d.ts +8 -0
  12. package/lib/models/command/actuatorToggleCommand.js +15 -0
  13. package/lib/models/command/actuatorWriteStateToDeviceCommand.d.ts +9 -0
  14. package/lib/models/command/actuatorWriteStateToDeviceCommand.js +16 -0
  15. package/lib/models/command/baseCommand.d.ts +12 -0
  16. package/lib/models/command/baseCommand.js +34 -0
  17. package/lib/models/command/commandSource.d.ts +8 -0
  18. package/lib/models/command/commandSource.js +12 -0
  19. package/lib/models/command/commandType.d.ts +23 -0
  20. package/lib/models/command/commandType.js +27 -0
  21. package/lib/models/command/dimmerSetLightCommand.d.ts +22 -0
  22. package/lib/models/command/dimmerSetLightCommand.js +40 -0
  23. package/lib/models/command/floorSetAllShuttersCommand.d.ts +16 -0
  24. package/lib/models/command/floorSetAllShuttersCommand.js +21 -0
  25. package/lib/models/command/index.d.ts +24 -0
  26. package/lib/models/command/index.js +51 -0
  27. package/lib/models/command/lampSetLightCommand.d.ts +9 -0
  28. package/lib/models/command/lampSetLightCommand.js +15 -0
  29. package/lib/models/command/lampSetTimeBasedCommand.d.ts +18 -0
  30. package/lib/models/command/lampSetTimeBasedCommand.js +25 -0
  31. package/lib/models/command/lampToggleLightCommand.d.ts +19 -0
  32. package/lib/models/command/lampToggleLightCommand.js +24 -0
  33. package/lib/models/command/ledSetLightCommand.d.ts +25 -0
  34. package/lib/models/command/ledSetLightCommand.js +41 -0
  35. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.d.ts +9 -0
  36. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +13 -0
  37. package/lib/models/command/restoreTargetAutomaticValueCommand.d.ts +8 -0
  38. package/lib/models/command/restoreTargetAutomaticValueCommand.js +15 -0
  39. package/lib/models/command/roomRestoreLightCommand.d.ts +7 -0
  40. package/lib/models/command/roomRestoreLightCommand.js +12 -0
  41. package/lib/models/command/roomRestoreShutterPositionCommand.d.ts +8 -0
  42. package/lib/models/command/roomRestoreShutterPositionCommand.js +13 -0
  43. package/lib/models/command/roomSetLightTimeBasedCommand.d.ts +14 -0
  44. package/lib/models/command/roomSetLightTimeBasedCommand.js +19 -0
  45. package/lib/models/command/shutterSunriseUpCommand.d.ts +7 -0
  46. package/lib/models/command/shutterSunriseUpCommand.js +12 -0
  47. package/lib/models/command/shutterSunsetDownCommand.d.ts +7 -0
  48. package/lib/models/command/shutterSunsetDownCommand.js +12 -0
  49. package/lib/models/command/wledSetLightCommand.d.ts +12 -0
  50. package/lib/models/command/wledSetLightCommand.js +28 -0
  51. package/lib/models/index.d.ts +1 -0
  52. package/lib/models/index.js +1 -0
  53. package/lib/models/rooms/RoomBase.d.ts +2 -2
  54. package/lib/models/rooms/RoomBase.js +5 -5
  55. package/lib/models/rooms/iRoomBase.d.ts +2 -5
  56. package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +5 -6
  57. package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.d.ts +3 -8
  58. package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +6 -16
  59. package/lib/server/devices/baseDeviceInterfaces/iLedRgbCct.d.ts +2 -16
  60. package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +2 -2
  61. package/lib/server/devices/baseDeviceInterfaces/iTemporaryDisableAutomatic.d.ts +2 -1
  62. package/lib/server/devices/dachs/dachs.d.ts +5 -4
  63. package/lib/server/devices/dachs/dachs.js +13 -21
  64. package/lib/server/devices/groups/Window.d.ts +3 -3
  65. package/lib/server/devices/groups/Window.js +9 -15
  66. package/lib/server/devices/groups/lightGroup.d.ts +9 -7
  67. package/lib/server/devices/groups/lightGroup.js +46 -40
  68. package/lib/server/devices/groups/presenceGroup.js +2 -2
  69. package/lib/server/devices/groups/tasterGroup.js +22 -6
  70. package/lib/server/devices/groups/windowGroup.d.ts +5 -7
  71. package/lib/server/devices/groups/windowGroup.js +25 -43
  72. package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +8 -7
  73. package/lib/server/devices/hmIPDevices/hmIpLampe.js +19 -31
  74. package/lib/server/devices/hmIPDevices/hmIpRoll.d.ts +2 -2
  75. package/lib/server/devices/hmIPDevices/hmIpRoll.js +17 -15
  76. package/lib/server/devices/sharedFunctions/lampUtils.d.ts +8 -7
  77. package/lib/server/devices/sharedFunctions/lampUtils.js +47 -27
  78. package/lib/server/devices/wledDevice.d.ts +9 -8
  79. package/lib/server/devices/wledDevice.js +37 -52
  80. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +5 -4
  81. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +13 -21
  82. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +8 -12
  83. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +32 -45
  84. package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.d.ts +3 -3
  85. package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.js +11 -32
  86. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +2 -2
  87. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +9 -7
  88. package/lib/server/devices/zigbee/zigbeeBlitzShp.js +2 -2
  89. package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +1 -1
  90. package/lib/server/devices/zigbee/zigbeeIlluActuator.d.ts +0 -2
  91. package/lib/server/devices/zigbee/zigbeeIlluActuator.js +0 -6
  92. package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +4 -4
  93. package/lib/server/devices/zigbee/zigbeeIlluLampe.js +6 -11
  94. package/lib/server/devices/zigbee/zigbeeInnr142C.d.ts +0 -4
  95. package/lib/server/devices/zigbee/zigbeeInnr142C.js +0 -33
  96. package/lib/server/devices/zigbee/zigbeeUbisysActuator.d.ts +0 -2
  97. package/lib/server/devices/zigbee/zigbeeUbisysActuator.js +0 -6
  98. package/lib/server/devices/zigbee/zigbeeUbisysLampe.d.ts +4 -4
  99. package/lib/server/devices/zigbee/zigbeeUbisysLampe.js +6 -11
  100. package/lib/server/services/ShutterService.d.ts +2 -7
  101. package/lib/server/services/ShutterService.js +2 -26
  102. package/lib/server/services/Telegram/telegram-Commands.js +2 -1
  103. package/lib/server/services/api/api-service.js +6 -6
  104. package/lib/server/services/blockAutomaticHandler.d.ts +2 -2
  105. package/lib/server/services/blockAutomaticHandler.js +5 -3
  106. package/lib/server/services/govee/own-govee-device.d.ts +8 -7
  107. package/lib/server/services/govee/own-govee-device.js +36 -47
  108. package/lib/server/services/room-service/room-service.d.ts +6 -10
  109. package/lib/server/services/room-service/room-service.js +19 -25
  110. package/lib/tsconfig.tsbuildinfo +1 -1
  111. package/package.json +15 -14
@@ -23,11 +23,10 @@ class Window extends base_group_1.BaseGroup {
23
23
  }
24
24
  /**
25
25
  * sets the desired Pos and moves rollo to this level
26
- * @param {number} value
27
26
  */
28
- setDesiredPosition(value) {
29
- this.desiredPosition = value;
30
- this.restoreDesiredPosition();
27
+ setDesiredPosition(c) {
28
+ this.desiredPosition = c.position;
29
+ this.restoreDesiredPosition(new models_2.WindowRestoreDesiredPositionCommand(c));
31
30
  }
32
31
  getHandle() {
33
32
  return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.Handle);
@@ -60,19 +59,14 @@ class Window extends base_group_1.BaseGroup {
60
59
  element.vibrationBlockedByGriff = true;
61
60
  });
62
61
  const timeOfDay = services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset);
63
- if (services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay)) {
64
- services_1.ShutterService.windowAllMiddle(this);
65
- }
66
- else {
67
- services_1.ShutterService.windowAllUp(this);
68
- }
62
+ services_1.ShutterService.windowAllToPosition(this, new models_2.ShutterSetLevelCommand(models_2.CommandSource.Automatic, services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay) ? 50 : 100, 'Window ajar by handle'));
69
63
  });
70
64
  griff.addOffenCallback((offen) => {
71
65
  if (offen) {
72
66
  this.getVibration().forEach((element) => {
73
67
  element.vibrationBlockedByGriff = true;
74
68
  });
75
- services_1.ShutterService.windowAllUp(this);
69
+ services_1.ShutterService.windowAllToPosition(this, new models_2.ShutterSetLevelCommand(models_2.CommandSource.Automatic, 100, 'Window opened by handle'));
76
70
  return;
77
71
  }
78
72
  });
@@ -89,7 +83,7 @@ class Window extends base_group_1.BaseGroup {
89
83
  }
90
84
  }, 12000);
91
85
  });
92
- this.restoreDesiredPosition();
86
+ this.restoreDesiredPosition(new models_2.WindowRestoreDesiredPositionCommand(models_2.CommandSource.Automatic, 'Last window Handle closed'));
93
87
  }
94
88
  });
95
89
  });
@@ -105,11 +99,11 @@ class Window extends base_group_1.BaseGroup {
105
99
  rolloPositionChange(pValue) {
106
100
  this.log(models_2.LogLevel.Debug, `Rollo Position Change in ${this.roomName} to ${pValue}`, pValue == this.desiredPosition ? services_1.LogDebugType.None : services_1.LogDebugType.ShutterPositionChange);
107
101
  if (pValue === 0 || pValue === 100) {
108
- this.getRoom().setLightTimeBased(true);
102
+ this.getRoom().setLightTimeBased(new models_2.RoomSetLightTimeBasedCommand(models_2.CommandSource.Automatic, true, 'Window.rolloPositionChange'));
109
103
  }
110
104
  }
111
- restoreDesiredPosition() {
112
- services_1.ShutterService.windowAllToPosition(this, this.desiredPosition, false);
105
+ restoreDesiredPosition(c) {
106
+ services_1.ShutterService.windowAllToPosition(this, new models_2.ShutterSetLevelCommand(c, this.desiredPosition));
113
107
  }
114
108
  }
115
109
  exports.Window = Window;
@@ -1,6 +1,6 @@
1
1
  import { BaseGroup } from './base-group';
2
2
  import { iActuator, iLamp } from '../baseDeviceInterfaces';
3
- import { TimeCallback, TimeOfDay } from '../../../models';
3
+ import { ActuatorSetStateCommand, LampSetLightCommand, LampSetTimeBasedCommand, LedSetLightCommand, LightGroupSwitchTimeConditionalCommand, TimeCallback, TimeOfDay, WledSetLightCommand } from '../../../models';
4
4
  import { WledDevice } from '../wledDevice';
5
5
  import { iLedRgbCct } from '../baseDeviceInterfaces/iLedRgbCct';
6
6
  export declare class LightGroup extends BaseGroup {
@@ -15,12 +15,14 @@ export declare class LightGroup extends BaseGroup {
15
15
  getOutlets(): iActuator[];
16
16
  getAllAsActuator(): iActuator[];
17
17
  handleSunriseOff(): void;
18
- switchAll(target: boolean, force?: boolean): void;
19
- switchTimeConditional(time: TimeOfDay): void;
20
- setAllLampen(pValue: boolean, time?: TimeOfDay, force?: boolean, timeout?: number): void;
21
- setAllStecker(pValue: boolean, time?: TimeOfDay, force?: boolean): void;
22
- setAllLED(pValue: boolean, brightness?: number, color?: string, colortemp?: number): void;
23
- setAllWled(pValue: boolean, brightness?: number, preset?: number): void;
18
+ switchAll(c: ActuatorSetStateCommand): void;
19
+ switchTimeConditional(c: LightGroupSwitchTimeConditionalCommand): void;
20
+ setAllLampen(c: LampSetLightCommand): void;
21
+ setAllLampenTimeBased(c: LampSetTimeBasedCommand): void;
22
+ setAllactuator(c: ActuatorSetStateCommand): void;
23
+ setAllActuatorsTimeBased(time: TimeOfDay): void;
24
+ setAllLED(c: LedSetLightCommand): void;
25
+ setAllWled(c: WledSetLightCommand): void;
24
26
  initialize(): void;
25
27
  recalculateTimeCallbacks(): void;
26
28
  private reconfigureSunriseTimeCallback;
@@ -65,85 +65,91 @@ class LightGroup extends base_group_1.BaseGroup {
65
65
  return;
66
66
  }
67
67
  this.log(models_1.LogLevel.Info, `Es ist hell genug --> Schalte Lampen im ${this.roomName} aus`);
68
- this.switchAll(false);
68
+ this.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'LightGroup handleSunriseOff'));
69
69
  }
70
- switchAll(target, force = false) {
70
+ switchAll(c) {
71
71
  this.getAllAsActuator().forEach((a) => {
72
- if (a.settings.includeInAmbientLight && !force && !target && this._ambientLightOn) {
72
+ if (a.settings.includeInAmbientLight && !c.isForceAction && !c.on && this._ambientLightOn) {
73
73
  a.log(models_1.LogLevel.Info, `Ambient light mode is active --> Skip non force light off command in ${this.roomName}`);
74
74
  return;
75
75
  }
76
- a.setActuator(target, undefined, force);
76
+ a.setActuator(c);
77
77
  });
78
78
  }
79
- switchTimeConditional(time) {
80
- const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(time);
79
+ switchTimeConditional(c) {
80
+ const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(c.time);
81
81
  let resultLampen = false;
82
82
  let resultSteckdosen = false;
83
83
  let activatedGroups = 0;
84
+ const command = new models_1.LampSetTimeBasedCommand(c, c.time, 'LightGroup switchTimeConditional');
84
85
  if (this.getWled().length > 0) {
85
86
  activatedGroups++;
86
- this.log(models_1.LogLevel.Debug, `Set Wled time based for time "${models_1.TimeOfDay[time]}"`);
87
+ this.log(models_1.LogLevel.Debug, `Set Wled time based for time "${models_1.TimeOfDay[c.time]}"`);
87
88
  this.getWled().forEach((wled) => {
88
- wled.setTimeBased(time);
89
+ wled.setTimeBased(command);
89
90
  });
90
91
  }
91
92
  if (this.getLED().length > 0) {
92
93
  activatedGroups++;
93
- this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${models_1.TimeOfDay[time]}"`);
94
+ this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${models_1.TimeOfDay[c.time]}"`);
94
95
  this.getLED().forEach((s) => {
95
- s.setTimeBased(time);
96
+ s.setTimeBased(command);
96
97
  });
97
98
  }
98
99
  if (this.getOutlets().length > 0) {
99
100
  activatedGroups++;
100
- this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${models_1.TimeOfDay[time]}"`);
101
+ this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${models_1.TimeOfDay[c.time]}"`);
101
102
  resultSteckdosen = darkOutside;
102
103
  }
103
104
  if (activatedGroups === 0 || this.getRoom().settings.includeLampsInNormalMovementLightning) {
104
- this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${models_1.TimeOfDay[time]}"`);
105
+ this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${models_1.TimeOfDay[c.time]}"`);
105
106
  resultLampen = darkOutside;
106
107
  }
107
- this.setAllLampen(resultLampen, time);
108
- this.setAllStecker(resultSteckdosen, time);
108
+ if (resultLampen) {
109
+ this.setAllLampenTimeBased(new models_1.LampSetTimeBasedCommand(models_1.CommandSource.Automatic, c.time, 'LightGroup switchTimeConditional'));
110
+ }
111
+ else {
112
+ this.setAllLampen(new models_1.LampSetLightCommand(models_1.CommandSource.Automatic, false, 'LightGroup switchTimeConditional --> off'));
113
+ }
114
+ if (resultSteckdosen) {
115
+ this.setAllActuatorsTimeBased(c.time);
116
+ }
117
+ else {
118
+ this.setAllactuator(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'LightGroup switchTimeConditional --> off'));
119
+ }
109
120
  }
110
- setAllLampen(pValue, time, force = false, timeout) {
121
+ setAllLampen(c) {
111
122
  this.getLights().forEach((s) => {
112
- if (!pValue ||
113
- time === undefined ||
114
- (time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
115
- (time === models_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
116
- (time === models_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
117
- timeout !== null && timeout !== void 0 ? timeout : (timeout = pValue && force ? 30 * 60 * 1000 : -1);
118
- if (pValue && time !== undefined) {
119
- s.setTimeBased(time, timeout, force);
120
- }
121
- else {
122
- s.setLight(pValue, timeout, force);
123
- }
124
- }
123
+ s.setLight(c);
124
+ });
125
+ }
126
+ setAllLampenTimeBased(c) {
127
+ this.getLights().forEach((s) => {
128
+ s.setTimeBased(c);
129
+ });
130
+ }
131
+ setAllactuator(c) {
132
+ this.getOutlets().forEach((s) => {
133
+ s.setActuator(c);
125
134
  });
126
135
  }
127
- setAllStecker(pValue, time, force = false) {
136
+ setAllActuatorsTimeBased(time) {
128
137
  this.getOutlets().forEach((s) => {
129
- if (!pValue ||
130
- time === undefined ||
131
- (time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
138
+ if ((time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
132
139
  (time === models_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
133
140
  (time === models_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
134
- const timeout = pValue && force ? 30 * 60 * 1000 : -1;
135
- s.setActuator(pValue, timeout, force);
141
+ s.setActuator(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, true, `LightGroup setAllActuatorsTimeBased`));
136
142
  }
137
143
  });
138
144
  }
139
- setAllLED(pValue, brightness = -1, color = '', colortemp = -1) {
145
+ setAllLED(c) {
140
146
  this.getLED().forEach((s) => {
141
- s.setLight(pValue, undefined, true, brightness, undefined, color, colortemp);
147
+ s.setLight(c);
142
148
  });
143
149
  }
144
- setAllWled(pValue, brightness = -1, preset) {
150
+ setAllWled(c) {
145
151
  this.getWled().forEach((w) => {
146
- w.setWled(pValue, brightness, preset);
152
+ w.setWled(c);
147
153
  });
148
154
  }
149
155
  initialize() {
@@ -202,7 +208,7 @@ class LightGroup extends base_group_1.BaseGroup {
202
208
  this.log(models_1.LogLevel.Info, `Draußen wird es dunkel --> Aktiviere Ambientenbeleuchtung`);
203
209
  this.getAllAsActuator().forEach((a) => {
204
210
  if (a.settings.includeInAmbientLight) {
205
- a.setActuator(true);
211
+ a.setActuator(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, true, 'Ambient Light Start Callback'));
206
212
  }
207
213
  });
208
214
  services_1.Utils.guardedTimeout(() => {
@@ -210,7 +216,7 @@ class LightGroup extends base_group_1.BaseGroup {
210
216
  this.log(models_1.LogLevel.Info, `Ambientenbeleuchtung um Mitternacht abschalten.`);
211
217
  this._ambientLightOn = false;
212
218
  if (((_a = this.getRoom().PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) !== true) {
213
- this.switchAll(false);
219
+ this.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'Ambient Light End Callback'));
214
220
  }
215
221
  }, services_1.Utils.timeTilMidnight, this);
216
222
  }
@@ -38,14 +38,14 @@ class PresenceGroup extends base_group_1.BaseGroup {
38
38
  this.addLastLeftCallback(() => {
39
39
  var _a, _b;
40
40
  (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
41
- (_b = this.getRoom().LightGroup) === null || _b === void 0 ? void 0 : _b.switchAll(false);
41
+ (_b = this.getRoom().LightGroup) === null || _b === void 0 ? void 0 : _b.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'Presence Group LastLeftCallback'));
42
42
  });
43
43
  this.addFirstEnterCallback(() => {
44
44
  if (!this.getRoom().settings.lampenBeiBewegung) {
45
45
  return;
46
46
  }
47
47
  this.log(models_1.LogLevel.DeepTrace, `Bewegung im Raum ${this.roomName} festgestellt --> Licht einschalten`);
48
- this.getRoom().setLightTimeBased();
48
+ this.getRoom().setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(models_1.CommandSource.Automatic, true, 'Motion detected'));
49
49
  });
50
50
  this.getMotionDetector().forEach((b) => {
51
51
  b.addMovementCallback((val) => {
@@ -7,6 +7,7 @@ const group_type_1 = require("./group-type");
7
7
  const device_list_1 = require("../device-list");
8
8
  const services_1 = require("../../services");
9
9
  const button_1 = require("../button");
10
+ const models_1 = require("../../../models");
10
11
  class TasterGroup extends base_group_1.BaseGroup {
11
12
  constructor(roomName, buttonIds) {
12
13
  super(roomName, group_type_1.GroupType.Buttons);
@@ -20,30 +21,45 @@ class TasterGroup extends base_group_1.BaseGroup {
20
21
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
21
22
  (_a = t.buttonTopLeft) === null || _a === void 0 ? void 0 : _a.addCb(button_1.ButtonPressType.long, (pValue) => {
22
23
  var _a;
23
- pValue && ((_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.allRolloDown(false, true));
24
+ if (!pValue) {
25
+ return;
26
+ }
27
+ (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Manual, 0, 'Button Top Left pressed long'));
24
28
  }, `Close all Rollos in this room`);
25
29
  (_b = t.buttonTopLeft) === null || _b === void 0 ? void 0 : _b.addCb(button_1.ButtonPressType.short, (pValue) => {
26
30
  var _a;
27
- pValue && ((_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(25, true));
31
+ if (!pValue) {
32
+ return;
33
+ }
34
+ (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Manual, 25, 'Button Top Left pressed short'));
28
35
  }, `Nearly closes all Rollos in this room`);
29
36
  (_c = t.buttonTopRight) === null || _c === void 0 ? void 0 : _c.addCb(button_1.ButtonPressType.long, (pValue) => {
30
37
  var _a;
31
38
  if (!pValue) {
32
39
  return;
33
40
  }
34
- (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.allRolloUp(true);
41
+ (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Manual, 100, 'Button Top Right pressed long'));
35
42
  }, `Open all Rollos in this room`);
36
43
  (_d = t.buttonTopRight) === null || _d === void 0 ? void 0 : _d.addCb(button_1.ButtonPressType.short, (pValue) => {
37
44
  var _a;
38
- pValue && ((_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(50, true));
45
+ if (!pValue) {
46
+ return;
47
+ }
48
+ (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Manual, 50, 'Button Top Right pressed short'));
39
49
  }, `All Rollos in this room to middle`);
40
50
  (_e = t.buttonMidLeft) === null || _e === void 0 ? void 0 : _e.addCb(button_1.ButtonPressType.long, (pValue) => {
41
51
  var _a;
42
- pValue && ((_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true, true));
52
+ if (!pValue) {
53
+ return;
54
+ }
55
+ (_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Manual, true, 'Button press to turn all lights on'));
43
56
  }, `Turn all Lights in this room on`);
44
57
  (_f = t.buttonMidRight) === null || _f === void 0 ? void 0 : _f.addCb(button_1.ButtonPressType.long, (pValue) => {
45
58
  var _a;
46
- pValue && ((_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false, true));
59
+ if (!pValue) {
60
+ return;
61
+ }
62
+ (_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Manual, false, 'Button press to turn all lights off'));
47
63
  }, `Turn all Lights in this room off`);
48
64
  if (((_g = services_1.SettingsService.settings.sonos) === null || _g === void 0 ? void 0 : _g.buttonBotRightForRadio) === true) {
49
65
  const sonosGroup = this.getRoom().SonosGroup;
@@ -1,4 +1,4 @@
1
- import { TimeCallback } from '../../../models';
1
+ import { RoomRestoreShutterPositionCommand, ShutterSunriseUpCommand, TimeCallback, WindowSetDesiredPositionCommand, WindowSetRolloByWeatherStatusCommand } from '../../../models';
2
2
  import { Window } from './Window';
3
3
  import { BaseGroup } from './base-group';
4
4
  export declare class WindowGroup extends BaseGroup {
@@ -6,14 +6,12 @@ export declare class WindowGroup extends BaseGroup {
6
6
  sunriseShutterCallback: TimeCallback | undefined;
7
7
  sunsetShutterCallback: TimeCallback | undefined;
8
8
  constructor(roomName: string, windows: Window[]);
9
- allRolloDown(initial?: boolean, savePosition?: boolean): void;
10
- allRolloUp(savePosition?: boolean): void;
11
- allRolloToLevel(level: number, savePosition?: boolean): void;
9
+ setDesiredPosition(c: WindowSetDesiredPositionCommand): void;
12
10
  initialize(): void;
13
11
  recalcTimeCallbacks(): void;
14
- setRolloByWeatherStatus(): void;
15
- sunriseUp(initial?: boolean): void;
16
- restoreRolloPosition(recalc?: boolean): void;
12
+ setRolloByWeatherStatus(c: WindowSetRolloByWeatherStatusCommand): void;
13
+ sunriseUp(c: ShutterSunriseUpCommand): void;
14
+ restoreRolloPosition(c: RoomRestoreShutterPositionCommand): void;
17
15
  changeVibrationMotionBlock(block: boolean): void;
18
16
  private sunsetDown;
19
17
  private reconfigureSunsetShutterCallback;
@@ -27,35 +27,21 @@ class WindowGroup extends base_group_1.BaseGroup {
27
27
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Shutter, new device_list_1.DeviceList(shutterIds));
28
28
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MagnetContact, new device_list_1.DeviceList(magnetIds));
29
29
  }
30
- allRolloDown(initial = false, savePosition = false) {
30
+ setDesiredPosition(c) {
31
31
  this.windows.forEach((f) => {
32
- if (savePosition)
33
- f.desiredPosition = 0;
34
- services_1.ShutterService.windowAllDown(f, initial);
35
- });
36
- }
37
- allRolloUp(savePosition = false) {
38
- this.windows.forEach((f) => {
39
- if (savePosition) {
40
- f.desiredPosition = 100;
41
- }
42
- services_1.ShutterService.windowAllUp(f);
43
- });
44
- }
45
- allRolloToLevel(level, savePosition = false) {
46
- this.windows.forEach((f) => {
47
- if (savePosition) {
48
- f.desiredPosition = level;
49
- }
50
- services_1.ShutterService.windowAllToPosition(f, level, false);
32
+ f.setDesiredPosition(c);
51
33
  });
52
34
  }
53
35
  initialize() {
54
36
  const room = this.getRoom();
55
37
  this.recalcTimeCallbacks();
56
38
  if (room.settings.rolloHeatReduction) {
57
- services_1.Utils.guardedInterval(this.setRolloByWeatherStatus, 15 * 60 * 1000, this, false);
58
- services_1.Utils.guardedTimeout(this.setRolloByWeatherStatus, 2 * 60 * 1000, this);
39
+ services_1.Utils.guardedInterval(() => {
40
+ this.setRolloByWeatherStatus(new models_1.WindowSetRolloByWeatherStatusCommand(models_1.CommandSource.Automatic, 'Regular interval'));
41
+ }, 15 * 60 * 1000, this, false);
42
+ services_1.Utils.guardedTimeout(() => {
43
+ this.setRolloByWeatherStatus(new models_1.WindowSetRolloByWeatherStatusCommand(models_1.CommandSource.Automatic, 'Delayed initial check'));
44
+ }, 2 * 60 * 1000, this);
59
45
  }
60
46
  this.windows.forEach((f) => {
61
47
  f.initialize();
@@ -65,7 +51,7 @@ class WindowGroup extends base_group_1.BaseGroup {
65
51
  this.reconfigureSunriseShutterCallback();
66
52
  this.reconfigureSunsetShutterCallback();
67
53
  }
68
- setRolloByWeatherStatus() {
54
+ setRolloByWeatherStatus(c) {
69
55
  const room = this.getRoom();
70
56
  const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset);
71
57
  const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
@@ -76,7 +62,7 @@ class WindowGroup extends base_group_1.BaseGroup {
76
62
  return;
77
63
  }
78
64
  if (darkOutside) {
79
- f.restoreDesiredPosition();
65
+ f.restoreDesiredPosition(new models_1.WindowRestoreDesiredPositionCommand(c, `It's dark outside.`));
80
66
  return;
81
67
  }
82
68
  let desiredPos = f.desiredPosition;
@@ -89,30 +75,29 @@ class WindowGroup extends base_group_1.BaseGroup {
89
75
  if (f.griffeInPosition(models_2.WindowPosition.kipp) > 0) {
90
76
  desiredPos = Math.max(30, desiredPos);
91
77
  }
92
- services_1.ShutterService.windowAllToPosition(f, desiredPos, false, true);
78
+ services_1.ShutterService.windowAllToPosition(f, new models_1.ShutterSetLevelCommand(c, desiredPos, '', true));
93
79
  });
94
80
  }
95
- sunriseUp(initial = false) {
81
+ sunriseUp(c) {
96
82
  this.windows.forEach((f) => {
97
83
  if (!this.getRoom().settings.sonnenAufgangRollos || f.getShutter().length === 0) {
98
84
  return;
99
85
  }
100
- this.log(models_1.LogLevel.Debug, `Fahre das Rollo zum Sonnenaufgang ${initial ? '(ggf. nachträglich)' : ''} hoch`);
101
- f.setDesiredPosition(100);
86
+ f.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(c, 100));
102
87
  });
103
88
  }
104
- restoreRolloPosition(recalc = false) {
105
- if (!recalc) {
89
+ restoreRolloPosition(c) {
90
+ if (!c.recalc) {
106
91
  this.windows.forEach((f) => {
107
- f.restoreDesiredPosition();
92
+ f.restoreDesiredPosition(new models_1.WindowRestoreDesiredPositionCommand(c));
108
93
  });
109
94
  return;
110
95
  }
111
96
  if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset))) {
112
- this.sunriseUp(true);
97
+ this.sunriseUp(new models_1.ShutterSunriseUpCommand(c, 'It is daytime'));
113
98
  }
114
99
  else {
115
- this.sunsetDown();
100
+ this.sunsetDown(new models_1.ShutterSunsetDownCommand(c, 'It is dark outside or nighttime'));
116
101
  }
117
102
  }
118
103
  changeVibrationMotionBlock(block) {
@@ -125,13 +110,10 @@ class WindowGroup extends base_group_1.BaseGroup {
125
110
  });
126
111
  });
127
112
  }
128
- sunsetDown() {
129
- var _a, _b;
130
- this.allRolloToLevel(0, true);
113
+ sunsetDown(c) {
114
+ this.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(c, 0));
131
115
  const room = this.getRoom();
132
- if (((_a = room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) && room.settings.lampOffset) {
133
- (_b = room.LightGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(services_1.TimeCallbackService.dayType(room.settings.lampOffset));
134
- }
116
+ room.setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(c, true, 'sunsetDown'));
135
117
  }
136
118
  reconfigureSunsetShutterCallback() {
137
119
  const room = this.getRoom();
@@ -155,11 +137,11 @@ class WindowGroup extends base_group_1.BaseGroup {
155
137
  if (this.sunsetShutterCallback === undefined) {
156
138
  this.log(models_1.LogLevel.Debug, `Add Sunset Shutter callback for ${this.roomName}`);
157
139
  this.sunsetShutterCallback = new models_1.TimeCallback(`${this.roomName} Sunset Shutter`, models_1.TimeCallbackType.SunSet, () => {
158
- this.sunsetDown();
140
+ this.sunsetDown(new models_1.ShutterSunsetDownCommand(models_1.CommandSource.Automatic, 'Time-Callback fired'));
159
141
  }, room.settings.rolloOffset.sunset);
160
142
  if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
161
143
  services_1.Utils.guardedTimeout(() => {
162
- this.allRolloDown(true, true);
144
+ this.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Initial, 0, 'It is dark outside'));
163
145
  }, 60000, this);
164
146
  }
165
147
  services_1.TimeCallbackService.addCallback(this.sunsetShutterCallback);
@@ -188,10 +170,10 @@ class WindowGroup extends base_group_1.BaseGroup {
188
170
  room.skipNextRolloUp = false;
189
171
  return;
190
172
  }
191
- this.sunriseUp();
173
+ this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Automatic, 'Time-Callback fired'));
192
174
  }, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
193
175
  if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
194
- this.sunriseUp(true);
176
+ this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Initial, 'Initial sunrise up as it is day'));
195
177
  }
196
178
  services_1.TimeCallbackService.addCallback(this.sunriseShutterCallback);
197
179
  }
@@ -1,5 +1,5 @@
1
1
  import { HmIPDevice } from './hmIpDevice';
2
- import { ActuatorSettings, TimeOfDay } from '../../../models';
2
+ import { ActuatorSetStateCommand, ActuatorSettings, ActuatorToggleCommand, ActuatorWriteStateToDeviceCommand, LampSetLightCommand, LampSetTimeBasedCommand, LampToggleLightCommand, RestoreTargetAutomaticValueCommand } from '../../../models';
3
3
  import { iLamp, iTemporaryDisableAutomatic } from '../baseDeviceInterfaces';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
5
  import { BlockAutomaticHandler } from '../../services/blockAutomaticHandler';
@@ -12,13 +12,14 @@ export declare class HmIpLampe extends HmIPDevice implements iLamp, iTemporaryDi
12
12
  targetAutomaticState: boolean;
13
13
  constructor(pInfo: IoBrokerDeviceInfo);
14
14
  get actuatorOn(): boolean;
15
- restoreTargetAutomaticValue(): void;
15
+ restoreTargetAutomaticValue(c: RestoreTargetAutomaticValueCommand): void;
16
16
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
17
- setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
18
- toggleActuator(force: boolean): boolean;
17
+ setActuator(command: ActuatorSetStateCommand): void;
18
+ toggleActuator(c: ActuatorToggleCommand): boolean;
19
19
  /** @inheritdoc */
20
- setLight(pValue: boolean, timeout?: number, force?: boolean): void;
21
- toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
22
- setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
20
+ setLight(c: LampSetLightCommand): void;
21
+ writeActuatorStateToDevice(c: ActuatorWriteStateToDeviceCommand): void;
22
+ toggleLight(c: LampToggleLightCommand): boolean;
23
+ setTimeBased(c: LampSetTimeBasedCommand): void;
23
24
  persist(): void;
24
25
  }
@@ -24,9 +24,9 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
24
24
  get actuatorOn() {
25
25
  return this.lightOn;
26
26
  }
27
- restoreTargetAutomaticValue() {
28
- this.log(models_1.LogLevel.Debug, `Restore Target Automatic value`);
29
- this.setActuator(this.targetAutomaticState);
27
+ restoreTargetAutomaticValue(c) {
28
+ this.log(models_1.LogLevel.Debug, c.logMessage);
29
+ this.setLight(new models_1.LampSetLightCommand(c, this.targetAutomaticState, 'Lampen RestoreTargetAutomaticValue'));
30
30
  }
31
31
  update(idSplit, state, initial = false) {
32
32
  this.log(models_1.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
@@ -41,45 +41,33 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
41
41
  break;
42
42
  }
43
43
  }
44
- setActuator(pValue, timeout, force) {
45
- this.setLight(pValue, timeout, force);
44
+ setActuator(command) {
45
+ this.setLight(command);
46
46
  }
47
- toggleActuator(force) {
48
- return this.toggleLight(undefined, force);
47
+ toggleActuator(c) {
48
+ const setActuatorCommand = models_1.ActuatorSetStateCommand.byActuatorAndToggleCommand(this, c);
49
+ this.setActuator(setActuatorCommand);
50
+ return setActuatorCommand.on;
49
51
  }
50
52
  /** @inheritdoc */
51
- setLight(pValue, timeout = -1, force = false) {
52
- if (sharedFunctions_1.LampUtils.checkBlockActive(this, force, pValue)) {
53
- return;
54
- }
55
- if (sharedFunctions_1.LampUtils.checkUnchanged(this, force, pValue)) {
56
- return;
57
- }
53
+ setLight(c) {
58
54
  if (this.lightOnSwitchID === '') {
59
55
  this.log(models_1.LogLevel.Error, `Keine Switch ID bekannt.`);
60
56
  return;
61
57
  }
62
- this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}"`, services_1.LogDebugType.SetActuator);
63
- this.queuedValue = pValue;
64
- this.setState(this.lightOnSwitchID, pValue, undefined, (err) => {
58
+ sharedFunctions_1.LampUtils.setActuator(this, c);
59
+ }
60
+ writeActuatorStateToDevice(c) {
61
+ this.log(models_1.LogLevel.Debug, c.logMessage, services_1.LogDebugType.SetActuator);
62
+ this.setState(this.lightOnSwitchID, c.stateValue, undefined, (err) => {
65
63
  this.log(models_1.LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
66
64
  });
67
- if (this.settings.isStromStoss && pValue) {
68
- timeout = 3000;
69
- sharedFunctions_1.LampUtils.stromStossOn(this);
70
- }
71
- if (timeout < 0 || !pValue) {
72
- return;
73
- }
74
- if (timeout > -1) {
75
- this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
76
- }
77
65
  }
78
- toggleLight(time, force = false, calculateTime = false) {
79
- return sharedFunctions_1.LampUtils.toggleLight(this, time, force, calculateTime);
66
+ toggleLight(c) {
67
+ return sharedFunctions_1.LampUtils.toggleLight(this, c);
80
68
  }
81
- setTimeBased(time, timeout = -1, force = false) {
82
- sharedFunctions_1.LampUtils.setTimeBased(this, time, timeout, force);
69
+ setTimeBased(c) {
70
+ sharedFunctions_1.LampUtils.setTimeBased(this, c);
83
71
  }
84
72
  persist() {
85
73
  var _a;
@@ -1,6 +1,6 @@
1
1
  import { HmIPDevice } from './hmIpDevice';
2
2
  import { Window } from '../groups';
3
- import { ShutterSettings } from '../../../models';
3
+ import { ShutterSetLevelCommand, ShutterSettings } from '../../../models';
4
4
  import { iShutter } from '../baseDeviceInterfaces';
5
5
  import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
6
6
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
@@ -20,6 +20,6 @@ export declare class HmIpRoll extends HmIPDevice implements iShutter {
20
20
  get desiredWindowShutterLevel(): number;
21
21
  persist(): void;
22
22
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
23
- setLevel(pPosition: number, initial?: boolean, skipOpenWarning?: boolean): void;
23
+ setLevel(command: ShutterSetLevelCommand): void;
24
24
  toJSON(): Partial<IoBrokerBaseDevice>;
25
25
  }