hoffmation-base 3.0.0-alpha.2 → 3.0.0-alpha.20

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 (74) hide show
  1. package/lib/models/command/ShutterSetLevelCommand.js +2 -1
  2. package/lib/models/command/WindowRestoreDesiredPositionCommand.js +1 -0
  3. package/lib/models/command/WindowSetDesiredPositionCommand.js +1 -0
  4. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +1 -0
  5. package/lib/models/command/actuatorSetStateCommand.js +3 -2
  6. package/lib/models/command/actuatorToggleCommand.js +2 -1
  7. package/lib/models/command/actuatorWriteStateToDeviceCommand.d.ts +1 -1
  8. package/lib/models/command/actuatorWriteStateToDeviceCommand.js +7 -2
  9. package/lib/models/command/baseCommand.d.ts +4 -1
  10. package/lib/models/command/baseCommand.js +25 -6
  11. package/lib/models/command/blockAutomaticCommand.d.ts +17 -0
  12. package/lib/models/command/blockAutomaticCommand.js +22 -0
  13. package/lib/models/command/blockAutomaticLiftBlockCommand.d.ts +12 -0
  14. package/lib/models/command/blockAutomaticLiftBlockCommand.js +17 -0
  15. package/lib/models/command/blockAutomaticUntilCommand.d.ts +17 -0
  16. package/lib/models/command/blockAutomaticUntilCommand.js +22 -0
  17. package/lib/models/command/commandSource.js +1 -0
  18. package/lib/models/command/commandType.d.ts +3 -0
  19. package/lib/models/command/commandType.js +3 -0
  20. package/lib/models/command/dimmerSetLightCommand.js +6 -5
  21. package/lib/models/command/index.d.ts +3 -0
  22. package/lib/models/command/index.js +7 -1
  23. package/lib/models/command/lampSetLightCommand.js +2 -1
  24. package/lib/models/command/lampSetTimeBasedCommand.js +1 -1
  25. package/lib/models/command/lampToggleLightCommand.js +1 -1
  26. package/lib/models/command/ledSetLightCommand.js +2 -1
  27. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +1 -0
  28. package/lib/models/command/restoreTargetAutomaticValueCommand.js +2 -1
  29. package/lib/models/command/roomRestoreLightCommand.js +1 -0
  30. package/lib/models/command/roomRestoreShutterPositionCommand.js +1 -0
  31. package/lib/models/command/shutterSunriseUpCommand.js +1 -0
  32. package/lib/models/command/shutterSunsetDownCommand.js +1 -0
  33. package/lib/models/command/wledSetLightCommand.d.ts +1 -0
  34. package/lib/models/command/wledSetLightCommand.js +4 -0
  35. package/lib/models/deviceSettings/acSettings.d.ts +7 -1
  36. package/lib/models/deviceSettings/acSettings.js +11 -4
  37. package/lib/models/deviceSettings/actuatorSettings.d.ts +17 -0
  38. package/lib/models/deviceSettings/actuatorSettings.js +23 -5
  39. package/lib/models/deviceSettings/ledSettings.js +10 -18
  40. package/lib/models/deviceSettings/wledSettings.js +5 -13
  41. package/lib/models/groupSettings/heatGroupSettings.d.ts +4 -0
  42. package/lib/models/groupSettings/heatGroupSettings.js +4 -0
  43. package/lib/models/rooms/RoomBase.js +2 -2
  44. package/lib/server/devices/IoBrokerBaseDevice.d.ts +2 -0
  45. package/lib/server/devices/IoBrokerBaseDevice.js +12 -1
  46. package/lib/server/devices/baseDeviceInterfaces/iAcDevice.d.ts +0 -5
  47. package/lib/server/devices/groups/heatGroup.d.ts +1 -0
  48. package/lib/server/devices/groups/heatGroup.js +2 -3
  49. package/lib/server/devices/groups/lightGroup.d.ts +2 -2
  50. package/lib/server/devices/groups/lightGroup.js +11 -10
  51. package/lib/server/devices/hmIPDevices/hmIpLampe.js +1 -2
  52. package/lib/server/devices/hmIPDevices/hmIpRoll.js +2 -2
  53. package/lib/server/devices/sharedFunctions/lampUtils.d.ts +1 -0
  54. package/lib/server/devices/sharedFunctions/lampUtils.js +30 -15
  55. package/lib/server/devices/wledDevice.d.ts +1 -0
  56. package/lib/server/devices/wledDevice.js +13 -8
  57. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -2
  58. package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +0 -2
  59. package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.js +9 -18
  60. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +8 -8
  61. package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.d.ts +2 -1
  62. package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.js +6 -4
  63. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +3 -3
  64. package/lib/server/services/ac/ac-device.d.ts +0 -5
  65. package/lib/server/services/ac/ac-device.js +17 -18
  66. package/lib/server/services/ac/daikin-service.js +2 -1
  67. package/lib/server/services/ac/own-daikin-device.js +12 -4
  68. package/lib/server/services/api/api-service.d.ts +65 -2
  69. package/lib/server/services/api/api-service.js +108 -18
  70. package/lib/server/services/blockAutomaticHandler.d.ts +6 -8
  71. package/lib/server/services/blockAutomaticHandler.js +11 -14
  72. package/lib/server/services/govee/own-govee-device.js +4 -7
  73. package/lib/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +1 -1
@@ -35,7 +35,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
35
35
  return this.lightOn;
36
36
  }
37
37
  restoreTargetAutomaticValue(c) {
38
- this.setActuator(new models_1.ActuatorSetStateCommand(c, this.targetAutomaticState, 'Restore targetAutomaticState due to BlockAutomaticHandler'));
38
+ this.setActuator(new models_1.ActuatorSetStateCommand(c, this.targetAutomaticState));
39
39
  }
40
40
  update(idSplit, state, initial = false) {
41
41
  this.queuedValue = null;
@@ -62,7 +62,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
62
62
  this.setLight(models_1.DimmerSetLightCommand.byTimeBased(this.settings, c));
63
63
  }
64
64
  setActuator(c) {
65
- this.setLight(new models_1.DimmerSetLightCommand(c, c.on, 'Set dimmer due to set ActuactorCommand', c.timeout));
65
+ this.setLight(new models_1.DimmerSetLightCommand(c, c.on, '', c.timeout));
66
66
  }
67
67
  toggleActuator(c) {
68
68
  const setActuatorCommand = models_1.ActuatorSetStateCommand.byActuatorAndToggleCommand(this, c);
@@ -82,26 +82,26 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
82
82
  this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
83
83
  return;
84
84
  }
85
- if (c.transitionTime > -1) {
86
- this.setState(this._stateIdTransitionTime, c.transitionTime);
87
- }
88
85
  const dontBlock = sharedFunctions_1.LampUtils.checkUnBlock(this, c);
89
86
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
90
87
  return;
91
88
  }
89
+ if (c.transitionTime > -1) {
90
+ this.setState(this._stateIdTransitionTime, c.transitionTime);
91
+ }
92
92
  if (c.on && c.brightness <= 0 && this.brightness < 10) {
93
93
  c.brightness = 10;
94
94
  }
95
- this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${c.on}" with brightness ${c.brightness}`, services_1.LogDebugType.SetActuator);
96
95
  if (c.timeout > -1 && !dontBlock) {
97
- this.blockAutomationHandler.disableAutomatic(c.timeout, models_1.CollisionSolving.overrideIfGreater);
96
+ this.blockAutomationHandler.disableAutomatic(new models_1.BlockAutomaticCommand(c, c.timeout));
98
97
  }
99
98
  if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !c.on) {
100
99
  // With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
101
- this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c.on, c, 'Set dimmer due to set ActuactorCommand'));
100
+ this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on));
102
101
  this.queuedValue = c.on;
103
102
  return;
104
103
  }
104
+ this.log(models_1.LogLevel.Debug, c.logMessage, services_1.LogDebugType.SetActuator);
105
105
  if (c.brightness >= this.settings.turnOnThreshhold) {
106
106
  this.setBrightnessState(c.brightness);
107
107
  return;
@@ -1,5 +1,5 @@
1
1
  import { DeviceType } from '../../deviceType';
2
- import { LampSetTimeBasedCommand, LedSetLightCommand, LedSettings } from '../../../../models';
2
+ import { ActuatorSetStateCommand, LampSetTimeBasedCommand, LedSetLightCommand, LedSettings } from '../../../../models';
3
3
  import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
4
4
  import { iLedRgbCct } from '../../baseDeviceInterfaces/iLedRgbCct';
5
5
  import { ZigbeeDimmer } from './zigbeeDimmer';
@@ -20,6 +20,7 @@ export declare abstract class ZigbeeLedRGBCCT extends ZigbeeDimmer implements iL
20
20
  * @inheritDoc
21
21
  */
22
22
  setTimeBased(c: LampSetTimeBasedCommand): void;
23
+ setActuator(c: ActuatorSetStateCommand): void;
23
24
  /**
24
25
  * @inheritDoc
25
26
  */
@@ -41,6 +41,9 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
41
41
  setTimeBased(c) {
42
42
  this.setLight(models_1.LedSetLightCommand.byTimeBased(this.settings, c));
43
43
  }
44
+ setActuator(c) {
45
+ this.setLight(new models_1.LedSetLightCommand(c, c.on, '', c.timeout));
46
+ }
44
47
  /**
45
48
  * @inheritDoc
46
49
  */
@@ -56,15 +59,14 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
56
59
  if (c.on && c.brightness === -1 && this.brightness < 10) {
57
60
  c.brightness = 10;
58
61
  }
59
- this.log(models_1.LogLevel.Debug, `LED Schalten An: ${c.on}\tHelligkeit: ${c.brightness}%\tFarbe: "${c.color}"\tColorTemperatur: ${c.colorTemp}\tTransition Time: ${c.transitionTime}`);
62
+ super.setLight(c);
60
63
  const formattedColor = services_1.Utils.formatHex(c.color);
61
- if (formattedColor !== null && c.on) {
64
+ if (formattedColor !== null && c.on && (c.color !== this.color || c.isForceAction)) {
62
65
  this.setState(this._stateIdColor, formattedColor);
63
66
  }
64
- if (c.colorTemp > -1 && c.on) {
67
+ if (c.colorTemp > -1 && c.on && (c.colorTemp !== this.colortemp || c.isForceAction)) {
65
68
  this.setState(this._stateIdColorTemp, c.colorTemp);
66
69
  }
67
- super.setLight(c);
68
70
  }
69
71
  }
70
72
  exports.ZigbeeLedRGBCCT = ZigbeeLedRGBCCT;
@@ -75,19 +75,19 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
75
75
  super.update(idSplit, state, initial, pOverride);
76
76
  }
77
77
  setLevel(c) {
78
- this.log(models_1.LogLevel.Debug, c.logMessage);
79
78
  let pPosition = c.level;
80
79
  if (!this._firstCommandRecieved && !c.isInitial) {
81
80
  this._firstCommandRecieved = true;
82
81
  }
83
82
  else if (this._firstCommandRecieved && c.isInitial) {
84
- this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
83
+ this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
85
84
  return;
86
85
  }
87
86
  if (this.currentLevel === pPosition && !c.isForceAction) {
88
- this.log(models_1.LogLevel.Debug, `Skip Rollo command to Position ${pPosition} as this is the current one`, services_1.LogDebugType.SkipUnchangedRolloPosition);
87
+ this.log(models_1.LogLevel.Debug, `Skip Rollo command to Position ${pPosition} as this is the current one, commandLog: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedRolloPosition);
89
88
  return;
90
89
  }
90
+ this.log(models_1.LogLevel.Debug, c.logMessage);
91
91
  if (this._window !== undefined) {
92
92
  if (this._window.griffeInPosition(models_2.WindowPosition.offen) > 0 && pPosition < 100) {
93
93
  if (!c.skipOpenWarning) {
@@ -37,11 +37,6 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
37
37
  restoreTargetAutomaticValue(): void;
38
38
  isAvailableForExcessEnergy(): boolean;
39
39
  calculateDesiredMode(): AcMode;
40
- /**
41
- * Disable automatic Turn-On and Turn-Off for given amount of ms.
42
- * @param {number} timeout
43
- */
44
- deactivateAutomaticChange(timeout?: number): void;
45
40
  abstract setDesiredMode(mode: AcMode, writeToDevice: boolean, temp?: number): void;
46
41
  abstract turnOn(): void;
47
42
  onTemperaturChange(newTemperatur: number): void;
@@ -52,7 +52,7 @@ class AcDevice {
52
52
  this._info.customName = `${roomName} ${name}`;
53
53
  this._info.room = roomName;
54
54
  this._info.allDevicesKey = `ac-${roomName}-${name}`;
55
- utils_1.Utils.guardedInterval(this.automaticCheck, 5 * 60 * 1000, this, true);
55
+ utils_1.Utils.guardedInterval(this.automaticCheck, 5 * 60 * 1000, this, false);
56
56
  utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
57
57
  this.persistDeviceInfo();
58
58
  this.loadDeviceSettings();
@@ -85,7 +85,8 @@ class AcDevice {
85
85
  this.automaticCheck();
86
86
  }
87
87
  isAvailableForExcessEnergy() {
88
- if (this.settings.useOwnTemperatureAndAutomatic) {
88
+ var _a, _b;
89
+ if (this.settings.useAutomatic || (((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.settings.automaticMode) && this.settings.heatingAllowed)) {
89
90
  return false;
90
91
  }
91
92
  if (this.blockAutomationHandler.automaticBlockActive) {
@@ -97,9 +98,14 @@ class AcDevice {
97
98
  return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
98
99
  }
99
100
  calculateDesiredMode() {
100
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
101
+ var _a, _b, _c, _d, _e, _f, _g;
101
102
  const acOn = this.on;
102
- this._desiredTemperatur = (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.desiredTemp) !== null && _c !== void 0 ? _c : 0;
103
+ const heatGroup = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup;
104
+ if (!heatGroup) {
105
+ this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no heat group`);
106
+ return ac_mode_1.AcMode.Off;
107
+ }
108
+ this._desiredTemperatur = heatGroup.desiredTemp;
103
109
  if (this.settings.manualDisabled) {
104
110
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, as manual disable force is set.`);
105
111
  return ac_mode_1.AcMode.Off;
@@ -109,16 +115,15 @@ class AcDevice {
109
115
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, to respect night settings.`);
110
116
  return ac_mode_1.AcMode.Off;
111
117
  }
112
- const heatGroup = (_d = this.room) === null || _d === void 0 ? void 0 : _d.HeatGroup;
113
- if (this.settings.useOwnTemperatureAndAutomatic) {
118
+ if (this.settings.useOwnTemperature) {
114
119
  // Device is in automatic mode so ignore energy and room temperature
115
- if ((heatGroup === null || heatGroup === void 0 ? void 0 : heatGroup.settings.automaticMode) === false) {
120
+ if (this.settings.useAutomatic) {
116
121
  return ac_mode_1.AcMode.Auto;
117
122
  }
118
123
  if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Sommer && this.settings.heatingAllowed) {
119
124
  return ac_mode_1.AcMode.Heating;
120
125
  }
121
- if (!this.settings.noCoolingOnMovement || ((_f = (_e = this.room) === null || _e === void 0 ? void 0 : _e.PraesenzGroup) === null || _f === void 0 ? void 0 : _f.anyPresent()) !== true) {
126
+ if (!this.settings.noCoolingOnMovement || ((_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.PraesenzGroup) === null || _c === void 0 ? void 0 : _c.anyPresent()) !== true) {
122
127
  return ac_mode_1.AcMode.Cooling;
123
128
  }
124
129
  return ac_mode_1.AcMode.Off;
@@ -135,7 +140,7 @@ class AcDevice {
135
140
  let threshold = acOn ? 0.5 : 1.5;
136
141
  let thresholdHeating = acOn ? 0.5 : 1.5;
137
142
  let desiredMode = ac_mode_1.AcMode.Off;
138
- const excessEnergy = (_h = (_g = devices_1.Devices.energymanager) === null || _g === void 0 ? void 0 : _g.excessEnergy) !== null && _h !== void 0 ? _h : -1;
143
+ const excessEnergy = (_e = (_d = devices_1.Devices.energymanager) === null || _d === void 0 ? void 0 : _d.excessEnergy) !== null && _e !== void 0 ? _e : -1;
139
144
  if ((acOn ? 200 : 1000) < excessEnergy) {
140
145
  // As there is plenty of energy to spare we plan to overshoot the target by 1 degree
141
146
  threshold = -0.5;
@@ -146,7 +151,7 @@ class AcDevice {
146
151
  const heatUntil = targetTemp - thresholdHeating;
147
152
  if (temp > coolUntil && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Sommer) {
148
153
  desiredMode = ac_mode_1.AcMode.Cooling;
149
- if (this.settings.noCoolingOnMovement && ((_k = (_j = this.room) === null || _j === void 0 ? void 0 : _j.PraesenzGroup) === null || _k === void 0 ? void 0 : _k.anyPresent()) === true) {
154
+ if (this.settings.noCoolingOnMovement && ((_g = (_f = this.room) === null || _f === void 0 ? void 0 : _f.PraesenzGroup) === null || _g === void 0 ? void 0 : _g.anyPresent()) === true) {
150
155
  return ac_mode_1.AcMode.Off;
151
156
  }
152
157
  }
@@ -158,13 +163,6 @@ class AcDevice {
158
163
  }
159
164
  return desiredMode;
160
165
  }
161
- /**
162
- * Disable automatic Turn-On and Turn-Off for given amount of ms.
163
- * @param {number} timeout
164
- */
165
- deactivateAutomaticChange(timeout = 60 * 60 * 1000) {
166
- this.blockAutomationHandler.disableAutomatic(timeout);
167
- }
168
166
  onTemperaturChange(newTemperatur) {
169
167
  this.roomTemperatur = newTemperatur;
170
168
  }
@@ -186,8 +184,9 @@ class AcDevice {
186
184
  turnOffDueToMissingEnergy() {
187
185
  this.turnOff();
188
186
  }
187
+ // TODO: Migrate to new command system
189
188
  setState(mode, desiredTemp, forceTime = 60 * 60 * 1000) {
190
- this.blockAutomationHandler.disableAutomatic(forceTime);
189
+ this.blockAutomationHandler.disableAutomatic(new models_1.BlockAutomaticCommand(models_1.CommandSource.Unknown, forceTime));
191
190
  this._mode = mode;
192
191
  if (mode == ac_mode_1.AcMode.Off) {
193
192
  this.turnOff();
@@ -68,6 +68,7 @@ class DaikinService {
68
68
  });
69
69
  });
70
70
  }
71
+ // TODO: Migrate to new command system
71
72
  static setAll(on, force = false) {
72
73
  if (!this.isInitialized) {
73
74
  return;
@@ -81,7 +82,7 @@ class DaikinService {
81
82
  dev.turnOff();
82
83
  }
83
84
  if (force) {
84
- dev.deactivateAutomaticChange(180 * 60 * 1000);
85
+ dev.blockAutomationHandler.disableAutomatic(new models_1.BlockAutomaticCommand(models_1.CommandSource.Unknown, 180 * 60 * 1000));
85
86
  }
86
87
  }
87
88
  }
@@ -86,13 +86,21 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
86
86
  });
87
87
  }
88
88
  setDesiredInfo(retry = false, forceTemp) {
89
- var _a;
89
+ var _a, _b;
90
+ if (this._desiredTemperatur === devices_1.UNDEFINED_TEMP_VALUE) {
91
+ if (((_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === undefined) {
92
+ this.log(models_1.LogLevel.Error, `Neither desired temperature nor HeatGroup is set for ${this.name}(${this.ip})`);
93
+ return;
94
+ }
95
+ this._desiredTemperatur = this.room.HeatGroup.desiredTemp;
96
+ return;
97
+ }
90
98
  let targetTemp = this._desiredTemperatur;
91
99
  if (this.desiredMode == daikin_controller_1.Mode.HOT) {
92
- targetTemp = this.settings.useOwnTemperatureAndAutomatic ? targetTemp + 1 : 29;
100
+ targetTemp = this.settings.useOwnTemperature ? targetTemp : 29;
93
101
  }
94
102
  else if (this.desiredMode == daikin_controller_1.Mode.COLD) {
95
- targetTemp = this.settings.useOwnTemperatureAndAutomatic ? targetTemp - 1 : 16;
103
+ targetTemp = this.settings.useOwnTemperature ? targetTemp : 16;
96
104
  }
97
105
  const changeObject = {
98
106
  power: this.desiredState,
@@ -100,7 +108,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
100
108
  targetHumidity: this.desiredHum,
101
109
  targetTemperature: forceTemp !== null && forceTemp !== void 0 ? forceTemp : targetTemp,
102
110
  };
103
- (_a = this.device) === null || _a === void 0 ? void 0 : _a.setACControlInfo(changeObject, (err, res) => {
111
+ (_b = this.device) === null || _b === void 0 ? void 0 : _b.setACControlInfo(changeObject, (err, res) => {
104
112
  var _a;
105
113
  if (err !== null) {
106
114
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Setting Ac Info for ${this.name} failed: ${err} `);
@@ -1,5 +1,5 @@
1
1
  import { BaseGroup, ButtonPosition, ButtonPressType, iBaseDevice } from '../../devices';
2
- import { CollisionSolving, DeviceSettings, RoomBase } from '../../../models';
2
+ import { ActuatorSetStateCommand, BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, CollisionSolving, DeviceSettings, DimmerSetLightCommand, LampSetLightCommand, LedSetLightCommand, RoomBase, ShutterSetLevelCommand } from '../../../models';
3
3
  import { LogObject } from '../log-service';
4
4
  import { AcDevice, AcMode } from '../ac';
5
5
  import { GroupSettings } from '../../../models/groupSettings/groupSettings';
@@ -40,14 +40,25 @@ export declare class API {
40
40
  static setAllAc(desiredState: boolean): void;
41
41
  /**
42
42
  * Changes the status of a given Lamp
43
+ * @deprecated Use "API.lampSetLight" instead
44
+ * TODO: Remove deprecated API method
43
45
  * @param {string} deviceId The device Id of the lamp
44
46
  * @param {boolean} state The desired new state
45
47
  * @param timeout Desired time after which this should be reverted to normal state
46
48
  * @returns {Error | null} In case it failed the Error containing the reason
47
49
  */
48
50
  static setLamp(deviceId: string, state: boolean, timeout?: number): Error | null;
51
+ /**
52
+ * Changes the status of a given Lamp
53
+ * @param {string} deviceId The device Id of the lamp
54
+ * @param {LampSetLightCommand} c The command(stack) to perform on the lamp
55
+ * @returns {Error | null} In case it failed the Error containing the reason.
56
+ */
57
+ static lampSetLight(deviceId: string, c: LampSetLightCommand): Error | null;
49
58
  /**
50
59
  * Changes the status of a given actuator
60
+ * @deprecated Use "API.actuatorSetState" instead
61
+ * TODO: Remove deprecated API method
51
62
  * @param {string} deviceId The device Id of the actuator
52
63
  * @param {boolean} state The desired new state
53
64
  * @param timeout Desired time after which this should be reverted to automatic state
@@ -57,6 +68,15 @@ export declare class API {
57
68
  /**
58
69
  * Changes the status of a given actuator
59
70
  * @param {string} deviceId The device Id of the actuator
71
+ * @param {ActuatorSetStateCommand} c The command(stack) to perform on the actuator
72
+ * @returns {Error | null} In case it failed the Error containing the reason
73
+ */
74
+ static actuatorSetState(deviceId: string, c: ActuatorSetStateCommand): Error | null;
75
+ /**
76
+ * Changes the status of the given dimmer
77
+ * @deprecated Use "API.dimmerSetLight" instead
78
+ * TODO: Remove deprecated API method
79
+ * @param {string} deviceId The device Id of the actuator
60
80
  * @param {boolean} state The desired new state
61
81
  * @param timeout A chosen Timeout after which the light should be reset
62
82
  * @param brightness The desired brightness
@@ -65,7 +85,16 @@ export declare class API {
65
85
  */
66
86
  static setDimmer(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number): Error | null;
67
87
  /**
68
- * Changes the status of a given actuator
88
+ * Changes the status of the given dimmer
89
+ * @param {string} deviceId The device Id of the dimmable device.
90
+ * @param {DimmerSetLightCommand} command The command(stack) to perform on the dimmer
91
+ * @returns {Error | null} In case it failed the Error containing the reason.
92
+ */
93
+ static dimmerSetLight(deviceId: string, command: DimmerSetLightCommand): Error | null;
94
+ /**
95
+ * Changes the status of a given led-device
96
+ * @deprecated Use "API.ledSetLight" instead
97
+ * TODO: Remove deprecated API method
69
98
  * @param {string} deviceId The device Id of the actuator
70
99
  * @param {boolean} state The desired new state
71
100
  * @param timeout A chosen Timeout after which the light should be reset
@@ -76,14 +105,30 @@ export declare class API {
76
105
  * @returns {Error | null} In case it failed the Error containing the reason
77
106
  */
78
107
  static setLedLamp(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): Error | null;
108
+ /**
109
+ * Changes the status of a given led-device
110
+ * @param {string} deviceId The device Id of the LED-Device
111
+ * @param {LedSetLightCommand} command The command(stack) to perform on the led-device
112
+ */
113
+ static ledSetLight(deviceId: string, command: LedSetLightCommand): Error | null;
79
114
  /**
80
115
  * Changes the position of a given shutter
81
116
  * if needed this updates the window position as well
117
+ * @deprecated Use "API.shutterSetLevel" instead
118
+ * TODO: Remove deprecated API method
82
119
  * @param {string} deviceId The device Id of the shutter
83
120
  * @param {number} level The desired new level (0 being open, 100 being closed)
84
121
  * @returns {Error | null} Error if there is no shutter with the given id
85
122
  */
86
123
  static setShutter(deviceId: string, level: number): Error | null;
124
+ /**
125
+ * Changes the position of a given shutter
126
+ * if needed this updates the window position as well
127
+ * @param {string} deviceId The device Id of the shutter
128
+ * @param {ShutterSetLevelCommand} command The command(stack) to perform on the shutter
129
+ * @returns {Error | null} Error if there is no shutter with the given id
130
+ */
131
+ static shutterSetLevel(deviceId: string, command: ShutterSetLevelCommand): Error | null;
87
132
  static speakOnDevice(deviceId: string, message: string, volume?: number): Error | null;
88
133
  /**
89
134
  * Starts a specified scene
@@ -113,17 +158,35 @@ export declare class API {
113
158
  static loadAllDeviceSettingsFromDb(): void;
114
159
  /**
115
160
  * Lifts a previously started Block of automatic
161
+ * @deprecated Use "API.blockAutomaticLiftAutomaticBlock" instead
162
+ * TODO: Remove deprecated API method
116
163
  * @param {string} deviceId The target device
117
164
  * @returns {Error | null} In case it failed the Error containing the reason
118
165
  */
119
166
  static liftAutomaticBlock(deviceId: string): Error | null;
167
+ /**
168
+ * Lifts a previously started Block of automatic
169
+ * @param {string} deviceId The target device
170
+ * @param {BlockAutomaticLiftBlockCommand} command The command to lift the automatic block
171
+ * @returns {Error | null} In case it failed the Error containing the reason
172
+ */
173
+ static blockAutomaticLiftAutomaticBlock(deviceId: string, command: BlockAutomaticLiftBlockCommand): Error | null;
120
174
  /**
121
175
  * Blocks the automatic of the given device for provided Duration
176
+ * @deprecated Use "API.blockAutomaticDisable" instead
177
+ * TODO: Remove deprecated API method
122
178
  * @param {string} deviceId The target device
123
179
  * @param {number} duration The duration in ms for which the device should remain in current state
124
180
  * @param {CollisionSolving} onCollision The desired Collision Solving strategy, in case the automatic being blocked already
125
181
  * @returns {Error | null} In case it failed the Error containing the reason
126
182
  */
127
183
  static blockAutomatic(deviceId: string, duration: number, onCollision?: CollisionSolving): Error | null;
184
+ /**
185
+ * Blocks the automatic of the given device for provided Duration
186
+ * @param {string} deviceId The target device
187
+ * @param {BlockAutomaticCommand} command The command to block the automatic
188
+ * @returns {Error | null} In case it failed the Error containing the reason
189
+ */
190
+ static blockAutomaticSetBlock(deviceId: string, command: BlockAutomaticCommand): Error | null;
128
191
  static pressButtonSwitch(deviceId: string, position: ButtonPosition, pressType: ButtonPressType): Error | null;
129
192
  }