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
@@ -99,80 +99,69 @@ class OwnGoveeDevice {
99
99
  /**
100
100
  * @inheritDoc
101
101
  */
102
- setTimeBased(time, timeout = -1, force = false) {
103
- switch (time) {
104
- case models_1.TimeOfDay.Night:
105
- if (this.settings.nightOn) {
106
- this.setLight(true, timeout, force, this.settings.nightBrightness, undefined, this.settings.nightColor, this.settings.nightColorTemp);
107
- }
108
- break;
109
- case models_1.TimeOfDay.AfterSunset:
110
- if (this.settings.duskOn) {
111
- this.setLight(true, timeout, force, this.settings.duskBrightness, undefined, this.settings.duskColor, this.settings.duskColorTemp);
112
- }
113
- break;
114
- case models_1.TimeOfDay.BeforeSunrise:
115
- if (this.settings.dawnOn) {
116
- this.setLight(true, timeout, force, this.settings.dawnBrightness, undefined, this.settings.dawnColor, this.settings.dawnColorTemp);
117
- }
118
- break;
119
- case models_1.TimeOfDay.Daylight:
120
- if (this.settings.dayOn) {
121
- this.setLight(true, timeout, force, this.settings.dayBrightness, undefined, this.settings.dayColor, this.settings.dayColorTemp);
122
- }
123
- break;
124
- }
102
+ setTimeBased(c) {
103
+ this.setLight(models_1.LedSetLightCommand.byTimeBased(this.settings, c));
125
104
  }
126
105
  /**
127
106
  * @inheritDoc
128
107
  */
129
- setLight(pValue, timeout = -1, force, brightness = -1, _transitionTime, color = '', colorTemp = -1) {
130
- if (pValue && brightness === -1 && this.brightness < 10) {
131
- brightness = 10;
108
+ setLight(c) {
109
+ if (c.on && c.brightness === -1 && this.brightness < 10) {
110
+ c.brightness = 10;
132
111
  }
133
- this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
134
- const formattedColor = utils_1.Utils.formatHex(color);
112
+ this.log(models_1.LogLevel.Debug, c.logMessage);
113
+ const formattedColor = utils_1.Utils.formatHex(c.color);
135
114
  if (formattedColor !== null) {
136
- this.setColor(color);
115
+ this.setColor(c.color);
137
116
  }
138
- const dontBlock = devices_1.LampUtils.checkUnBlock(this, force, pValue);
139
- if (devices_1.LampUtils.checkBlockActive(this, force, pValue)) {
117
+ const dontBlock = devices_1.LampUtils.checkUnBlock(this, c);
118
+ if (devices_1.LampUtils.checkBlockActive(this, c)) {
140
119
  return;
141
120
  }
142
- this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, log_service_1.LogDebugType.SetActuator);
143
- if (brightness > -1 && pValue) {
144
- this.setBrightness(brightness, () => {
145
- this.log(models_1.LogLevel.Debug, `Brightness set to ${brightness}`);
121
+ this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${c.on}" with brightness ${c.brightness}`, log_service_1.LogDebugType.SetActuator);
122
+ if (c.brightness > -1 && c.on) {
123
+ this.setBrightness(c.brightness, () => {
124
+ this.log(models_1.LogLevel.Debug, `Brightness set to ${c.brightness}`);
146
125
  this.turnOn();
147
126
  });
148
127
  }
149
- else if (pValue) {
128
+ else if (c.on) {
150
129
  this.turnOn();
151
130
  }
152
131
  else {
153
132
  this.turnOff();
154
133
  }
155
- if (timeout > -1 && !dontBlock) {
156
- this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
134
+ if (c.timeout > -1 && !dontBlock) {
135
+ this.blockAutomationHandler.disableAutomatic(c.timeout, models_1.CollisionSolving.overrideIfGreater);
157
136
  }
158
137
  }
159
- setActuator(pValue, timeout, force) {
160
- this.setLight(pValue, timeout, force);
138
+ setActuator(c) {
139
+ this.setLight(new models_1.LedSetLightCommand(c, c.on, c.reason));
161
140
  }
162
- restoreTargetAutomaticValue() {
141
+ restoreTargetAutomaticValue(c) {
163
142
  this.log(models_1.LogLevel.Debug, `Restore Target Automatic value`);
164
- this.setActuator(this.targetAutomaticState);
143
+ this.setActuator(new models_1.ActuatorSetStateCommand(c, this.targetAutomaticState, 'Restore Target Automatic value'));
165
144
  }
166
145
  persist() {
167
146
  var _a;
168
147
  (_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
169
148
  }
170
- toggleActuator(_force) {
171
- this.setLight(!this.on);
172
- return this.on;
149
+ toggleActuator(c) {
150
+ const setActuatorCommand = models_1.ActuatorSetStateCommand.byActuatorAndToggleCommand(this, c);
151
+ this.setActuator(setActuatorCommand);
152
+ return setActuatorCommand.on;
173
153
  }
174
- toggleLight(time, _force = false, calculateTime = false) {
175
- return devices_1.LampUtils.toggleLight(this, time, _force, calculateTime);
154
+ toggleLight(c) {
155
+ return devices_1.LampUtils.toggleLight(this, c);
156
+ }
157
+ writeActuatorStateToDevice(c) {
158
+ this.log(models_1.LogLevel.Debug, c.logMessage, log_service_1.LogDebugType.SetActuator);
159
+ if (c.stateValue) {
160
+ this.turnOn();
161
+ }
162
+ else {
163
+ this.turnOff();
164
+ }
176
165
  }
177
166
  update(data) {
178
167
  this.queuedValue = null;
@@ -1,5 +1,5 @@
1
1
  import { ringStorage } from '../utils';
2
- import { iRoomBase, RoomBase } from '../../../models';
2
+ import { ActuatorSetStateCommand, FloorSetAllShuttersCommand, iRoomBase, RoomBase } from '../../../models';
3
3
  import { BaseGroup, iRoomDevice } from '../../devices';
4
4
  export declare class RoomService {
5
5
  static Rooms: Map<string, RoomBase>;
@@ -15,20 +15,16 @@ export declare class RoomService {
15
15
  static addToRoomList(room: RoomBase): void;
16
16
  static getAllRoomsOfFloor(floor: number): IterableIterator<[string, RoomBase]>;
17
17
  /**
18
- * Set ALl Roolos of a specific floor
19
- * !!floor -1 sets all rollos in house instead!!
20
- * @param floor the level on which all rollos shall be changed -1 equals all rooms
21
- * @param position (0 equals down, 100 up)
18
+ * Moves all shutters of the desired floor(s) to the desired position
22
19
  */
23
- static setAllRolloOfFloor(floor?: number, position?: number): void;
20
+ static setAllShutterOfFloor(c: FloorSetAllShuttersCommand): void;
24
21
  /**
25
22
  * Set ALl Lamps of a specific floor
26
23
  * !!floor -1 sets all lamps in house instead!!
27
24
  * @param floor the level on which all lamps shall be changed -1 equals all rooms
28
- * @param status
29
- * @param timeout
25
+ * @param command the command to be executed
30
26
  */
31
- static setAllLampsOfFloor(floor: number, status?: boolean, timeout?: number): void;
27
+ static setAllLampsOfFloor(floor: number, command: ActuatorSetStateCommand): void;
32
28
  static clearAllAlarms(): void;
33
29
  static startAwayMode(): void;
34
30
  static startNightAlarmMode(): void;
@@ -37,6 +33,6 @@ export declare class RoomService {
37
33
  static getLastMovements(): string;
38
34
  private static stopIntrusionAlarm;
39
35
  private static performNextIntrusionLevel;
40
- private static restoreRolloPosition;
36
+ private static restoreShutterPositions;
41
37
  private static restoreLight;
42
38
  }
@@ -15,34 +15,30 @@ class RoomService {
15
15
  return [...this.Rooms].filter(([_name, room]) => room.etage === floor).values();
16
16
  }
17
17
  /**
18
- * Set ALl Roolos of a specific floor
19
- * !!floor -1 sets all rollos in house instead!!
20
- * @param floor the level on which all rollos shall be changed -1 equals all rooms
21
- * @param position (0 equals down, 100 up)
18
+ * Moves all shutters of the desired floor(s) to the desired position
22
19
  */
23
- static setAllRolloOfFloor(floor = -1, position = 0) {
20
+ static setAllShutterOfFloor(c) {
24
21
  var _a;
25
- const rooms = floor > -1 ? this.getAllRoomsOfFloor(floor) : this.Rooms.entries();
22
+ const rooms = c.specificFloor != undefined ? this.getAllRoomsOfFloor(c.specificFloor) : this.Rooms.entries();
26
23
  for (const [_name, room] of rooms) {
27
- (_a = room.WindowGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(position, true);
24
+ (_a = room.WindowGroup) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(c, c.position));
28
25
  }
29
26
  }
30
27
  /**
31
28
  * Set ALl Lamps of a specific floor
32
29
  * !!floor -1 sets all lamps in house instead!!
33
30
  * @param floor the level on which all lamps shall be changed -1 equals all rooms
34
- * @param status
35
- * @param timeout
31
+ * @param command the command to be executed
36
32
  */
37
- static setAllLampsOfFloor(floor, status = false, timeout) {
33
+ static setAllLampsOfFloor(floor, command) {
38
34
  var _a, _b, _c, _d;
39
- log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Schalte alle Lampen in Etage ${floor} auf den Wert ${status}`);
35
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Schalte alle Lampen in Etage ${floor} auf den Wert ${command.on}`);
40
36
  const rooms = floor > -1 ? this.getAllRoomsOfFloor(floor) : this.Rooms.entries();
41
37
  for (const [_name, room] of rooms) {
42
- (_a = room.LightGroup) === null || _a === void 0 ? void 0 : _a.setAllLampen(status, undefined, true, timeout);
43
- (_b = room.LightGroup) === null || _b === void 0 ? void 0 : _b.setAllLED(status);
44
- (_c = room.LightGroup) === null || _c === void 0 ? void 0 : _c.setAllStecker(status, undefined, true);
45
- (_d = room.LightGroup) === null || _d === void 0 ? void 0 : _d.setAllWled(status);
38
+ (_a = room.LightGroup) === null || _a === void 0 ? void 0 : _a.setAllLampen(command);
39
+ (_b = room.LightGroup) === null || _b === void 0 ? void 0 : _b.setAllLED(new models_1.LedSetLightCommand(command, command.on));
40
+ (_c = room.LightGroup) === null || _c === void 0 ? void 0 : _c.setAllactuator(command);
41
+ (_d = room.LightGroup) === null || _d === void 0 ? void 0 : _d.setAllWled(new models_1.WledSetLightCommand(command, command.on));
46
42
  }
47
43
  }
48
44
  static clearAllAlarms() {
@@ -55,8 +51,6 @@ class RoomService {
55
51
  }
56
52
  }
57
53
  this.stopIntrusionAlarm();
58
- this.restoreRolloPosition();
59
- this.restoreLight();
60
54
  }
61
55
  static startAwayMode() {
62
56
  Sonos_1.SonosService.speakOnAll(Translation_1.Res.alarmArmed(), 40);
@@ -129,8 +123,8 @@ class RoomService {
129
123
  this._intrusionAlarmActive = false;
130
124
  this._intrusionAlarmLevel = 0;
131
125
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Alert, `Alarm wurde beendet --> Fahre Rollos in Ausgangsposition.`);
132
- this.restoreRolloPosition();
133
- this.restoreLight();
126
+ this.restoreShutterPositions(new models_1.RoomRestoreShutterPositionCommand(models_1.CommandSource.Force, false, 'Resetting all shutter in all Rooms to last known position'));
127
+ this.restoreLight(new models_1.RoomRestoreLightCommand(models_1.CommandSource.Force, 'roomService.clearAllAlarms'));
134
128
  }
135
129
  static performNextIntrusionLevel() {
136
130
  this._intrusionAlarmTimeout = undefined;
@@ -149,8 +143,8 @@ class RoomService {
149
143
  else if (this._intrusionAlarmLevel === 2) {
150
144
  speakMessage = Translation_1.Res.intruderShutterUpPleaseLeave();
151
145
  utils_1.Utils.guardedNewThread(() => {
152
- this.setAllRolloOfFloor(-1, 100);
153
- this.setAllLampsOfFloor(-1, true);
146
+ this.setAllShutterOfFloor(new models_1.FloorSetAllShuttersCommand(models_1.CommandSource.Automatic, 100, undefined, 'Intrusion alarm level 2'));
147
+ this.setAllLampsOfFloor(-1, new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, true, 'Intrusion alarm level 2'));
154
148
  }, this);
155
149
  }
156
150
  else if (this._intrusionAlarmLevel === 3) {
@@ -178,15 +172,15 @@ class RoomService {
178
172
  Telegram_1.TelegramService.inform(`Eindringling erhielt folgende Nachricht: "${speakMessage}"\nAlarmlevel ist ${this._intrusionAlarmLevel}\t Automatisches Ende bei ${alarmAutomaticEnd}`);
179
173
  }, this);
180
174
  }
181
- static restoreRolloPosition() {
175
+ static restoreShutterPositions(c) {
182
176
  var _a;
183
177
  for (const room of this.Rooms.values()) {
184
- (_a = room.WindowGroup) === null || _a === void 0 ? void 0 : _a.restoreRolloPosition();
178
+ (_a = room.WindowGroup) === null || _a === void 0 ? void 0 : _a.restoreRolloPosition(c);
185
179
  }
186
180
  }
187
- static restoreLight() {
181
+ static restoreLight(c) {
188
182
  for (const room of this.Rooms.values()) {
189
- room.setLightTimeBased(true);
183
+ room.setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(c, true, 'roomService.restoreLight'));
190
184
  }
191
185
  }
192
186
  }