hoffmation-base 3.0.0-alpha.27 → 3.0.0-alpha.29

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 (36) hide show
  1. package/lib/models/command/baseCommand.js +3 -0
  2. package/lib/models/timeCallback.js +3 -3
  3. package/lib/server/config/heatingMode.d.ts +2 -1
  4. package/lib/server/config/heatingMode.js +2 -1
  5. package/lib/server/devices/espresense/detectedBluetoothDevice.js +1 -1
  6. package/lib/server/devices/groups/windowGroup.js +4 -4
  7. package/lib/server/devices/sharedFunctions/lampUtils.js +3 -3
  8. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +3 -3
  9. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +3 -4
  10. package/lib/server/devices/zigbee/BaseDevices/index.d.ts +1 -0
  11. package/lib/server/devices/zigbee/BaseDevices/index.js +3 -0
  12. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +3 -30
  13. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +2 -56
  14. package/lib/server/devices/zigbee/BaseDevices/zigbeeLamp.d.ts +20 -0
  15. package/lib/server/devices/zigbee/BaseDevices/zigbeeLamp.js +47 -0
  16. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +2 -2
  17. package/lib/server/devices/zigbee/zigbeeBlitzShp.d.ts +1 -0
  18. package/lib/server/devices/zigbee/zigbeeBlitzShp.js +2 -1
  19. package/lib/server/devices/zigbee/zigbeeIkeaSteckdose.d.ts +1 -0
  20. package/lib/server/devices/zigbee/zigbeeIkeaSteckdose.js +2 -1
  21. package/lib/server/devices/zigbee/zigbeeIlluActuator.d.ts +1 -2
  22. package/lib/server/devices/zigbee/zigbeeIlluActuator.js +2 -9
  23. package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +4 -15
  24. package/lib/server/devices/zigbee/zigbeeIlluLampe.js +4 -37
  25. package/lib/server/devices/zigbee/zigbeeUbisysActuator.d.ts +2 -1
  26. package/lib/server/devices/zigbee/zigbeeUbisysActuator.js +3 -5
  27. package/lib/server/devices/zigbee/zigbeeUbisysLampe.d.ts +7 -12
  28. package/lib/server/devices/zigbee/zigbeeUbisysLampe.js +13 -27
  29. package/lib/server/services/ShutterService.js +3 -3
  30. package/lib/server/services/ac/ac-device.d.ts +10 -0
  31. package/lib/server/services/ac/ac-device.js +27 -9
  32. package/lib/server/services/api/api-service.js +1 -3
  33. package/lib/server/services/blockAutomaticHandler.js +3 -1
  34. package/lib/server/services/calendar/m/303/274ll-service.js +1 -1
  35. package/lib/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +1 -1
@@ -1,19 +1,14 @@
1
- import { LampSetLightCommand, LampSetTimeBasedCommand, LampToggleLightCommand } from '../../../models';
2
1
  import { iLamp } from '../baseDeviceInterfaces';
3
2
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
4
- import { ZigbeeUbisysActuator } from './zigbeeUbisysActuator';
5
- export declare class ZigbeeUbisysLampe extends ZigbeeUbisysActuator implements iLamp {
3
+ import { ZigbeeLamp } from './BaseDevices';
4
+ import { iLoadMeter } from '../baseDeviceInterfaces/iLoadMeter';
5
+ export declare class ZigbeeUbisysLampe extends ZigbeeLamp implements iLamp, iLoadMeter {
6
+ protected readonly _stateIdState: string;
7
+ protected readonly _stateNameState: string;
8
+ private _loadPower;
6
9
  constructor(pInfo: IoBrokerDeviceInfo);
7
10
  /** @inheritDoc */
8
- get lightOn(): boolean;
11
+ get loadPower(): number;
9
12
  /** @inheritDoc */
10
13
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
11
- /** @inheritdoc */
12
- setLight(c: LampSetLightCommand): void;
13
- /** @inheritDoc */
14
- toggleLight(c: LampToggleLightCommand): boolean;
15
- /** @inheritDoc */
16
- setTimeBased(c: LampSetTimeBasedCommand): void;
17
- /** @inheritDoc */
18
- persist(): void;
19
14
  }
@@ -3,44 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZigbeeUbisysLampe = void 0;
4
4
  const deviceType_1 = require("../deviceType");
5
5
  const models_1 = require("../../../models");
6
- const services_1 = require("../../services");
6
+ const BaseDevices_1 = require("./BaseDevices");
7
7
  const DeviceCapability_1 = require("../DeviceCapability");
8
- const zigbeeUbisysActuator_1 = require("./zigbeeUbisysActuator");
9
- const sharedFunctions_1 = require("../sharedFunctions");
10
- class ZigbeeUbisysLampe extends zigbeeUbisysActuator_1.ZigbeeUbisysActuator {
8
+ class ZigbeeUbisysLampe extends BaseDevices_1.ZigbeeLamp {
11
9
  constructor(pInfo) {
12
10
  super(pInfo, deviceType_1.DeviceType.ZigbeeUbisysLampe);
13
- this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
11
+ this._loadPower = 0;
12
+ this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.loadMetering);
13
+ this._stateIdState = `${pInfo.fullID}.state`;
14
+ this._stateNameState = `${pInfo.fullID}.state`;
14
15
  }
15
16
  /** @inheritDoc */
16
- get lightOn() {
17
- return super.actuatorOn;
17
+ get loadPower() {
18
+ return this._loadPower;
18
19
  }
19
20
  /** @inheritDoc */
20
21
  update(idSplit, state, initial = false) {
21
- super.update(idSplit, state, initial, true);
22
22
  switch (idSplit[3]) {
23
- case 'state':
24
- this.log(models_1.LogLevel.Trace, `Lampen Update für ${this.info.customName} auf ${state.val}`);
23
+ case 'load_power':
24
+ const newLoadPower = state.val;
25
+ this.log(Math.abs(newLoadPower - this._loadPower) > 0.25 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new current load power: ${state.val}`);
26
+ this._loadPower = newLoadPower;
25
27
  break;
26
28
  }
27
- }
28
- /** @inheritdoc */
29
- setLight(c) {
30
- super.setActuator(c);
31
- }
32
- /** @inheritDoc */
33
- toggleLight(c) {
34
- return sharedFunctions_1.LampUtils.toggleLight(this, c);
35
- }
36
- /** @inheritDoc */
37
- setTimeBased(c) {
38
- sharedFunctions_1.LampUtils.setTimeBased(this, c);
39
- }
40
- /** @inheritDoc */
41
- persist() {
42
- var _a;
43
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
29
+ super.update(idSplit, state, initial, true);
44
30
  }
45
31
  }
46
32
  exports.ZigbeeUbisysLampe = ZigbeeUbisysLampe;
@@ -30,10 +30,10 @@ class ShutterService {
30
30
  for (const f of r.WindowGroup.windows) {
31
31
  f.getShutter().forEach((shutter) => {
32
32
  var _a, _b, _c, _d, _e;
33
- response.push(`Rollo: "${shutter.info.customName}"\t${((_a = shutter.room) === null || _a === void 0 ? void 0 : _a.settings.sonnenAufgangRollos) === true
33
+ response.push(`Shutter: "${shutter.info.customName}"\t${((_a = shutter.room) === null || _a === void 0 ? void 0 : _a.settings.sonnenAufgangRollos) === true
34
34
  ? (_c = (_b = r.sunriseShutterCallback) === null || _b === void 0 ? void 0 : _b.nextToDo) === null || _c === void 0 ? void 0 : _c.toLocaleTimeString()
35
- : 'Hochfahren inaktiv'}`);
36
- down.push(`Rollo: "${shutter.info.customName}"\t${(_e = (_d = r.sunsetShutterCallback) === null || _d === void 0 ? void 0 : _d.nextToDo) === null || _e === void 0 ? void 0 : _e.toLocaleTimeString()}`);
35
+ : 'Sunrise Shutter up inactive'}`);
36
+ down.push(`Shutter: "${shutter.info.customName}"\t${(_e = (_d = r.sunsetShutterCallback) === null || _d === void 0 ? void 0 : _d.nextToDo) === null || _e === void 0 ? void 0 : _e.toLocaleTimeString('de-DE')}`);
37
37
  });
38
38
  }
39
39
  }
@@ -22,6 +22,16 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
22
22
  protected _room: RoomBase | undefined;
23
23
  protected _mode: AcMode;
24
24
  private _movementCallbackAdded;
25
+ /**
26
+ * Whether the AC is allowed to cool (depends on the season
27
+ * @returns {boolean} True if the AC is allowed to cool
28
+ */
29
+ get coolingAllowed(): boolean;
30
+ /**
31
+ * Whether the AC is allowed to heat (depends on the season and the settings)
32
+ * @returns {boolean} True if the AC is allowed to heat
33
+ */
34
+ get heatingAllowed(): boolean;
25
35
  /** @inheritDoc */
26
36
  get temperature(): number;
27
37
  /** @inheritDoc */
@@ -15,6 +15,27 @@ const settings_service_1 = require("../settings-service");
15
15
  const config_1 = require("../../config");
16
16
  const blockAutomaticHandler_1 = require("../blockAutomaticHandler");
17
17
  class AcDevice {
18
+ /**
19
+ * Whether the AC is allowed to cool (depends on the season
20
+ * @returns {boolean} True if the AC is allowed to cool
21
+ */
22
+ get coolingAllowed() {
23
+ var _a, _b;
24
+ if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Summer) {
25
+ return false;
26
+ }
27
+ if (this.settings.noCoolingOnMovement && ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent())) {
28
+ return false;
29
+ }
30
+ return true;
31
+ }
32
+ /**
33
+ * Whether the AC is allowed to heat (depends on the season and the settings)
34
+ * @returns {boolean} True if the AC is allowed to heat
35
+ */
36
+ get heatingAllowed() {
37
+ return settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Summer && this.settings.heatingAllowed;
38
+ }
18
39
  /** @inheritDoc */
19
40
  get temperature() {
20
41
  return this._roomTemperature;
@@ -114,7 +135,7 @@ class AcDevice {
114
135
  }
115
136
  /** @inheritDoc */
116
137
  calculateDesiredMode() {
117
- var _a, _b, _c, _d, _e, _f, _g;
138
+ var _a, _b, _c;
118
139
  const acOn = this.on;
119
140
  const heatGroup = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup;
120
141
  if (!heatGroup) {
@@ -136,10 +157,10 @@ class AcDevice {
136
157
  if (this.settings.useAutomatic) {
137
158
  return ac_mode_1.AcMode.Auto;
138
159
  }
139
- if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Sommer && this.settings.heatingAllowed) {
160
+ if (this.heatingAllowed) {
140
161
  return ac_mode_1.AcMode.Heating;
141
162
  }
142
- 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) {
163
+ else if (this.coolingAllowed) {
143
164
  return ac_mode_1.AcMode.Cooling;
144
165
  }
145
166
  return ac_mode_1.AcMode.Off;
@@ -156,7 +177,7 @@ class AcDevice {
156
177
  let threshold = acOn ? 0.5 : 1.5;
157
178
  let thresholdHeating = acOn ? 0.5 : 1.5;
158
179
  let desiredMode = ac_mode_1.AcMode.Off;
159
- const excessEnergy = (_e = (_d = devices_1.Devices.energymanager) === null || _d === void 0 ? void 0 : _d.excessEnergy) !== null && _e !== void 0 ? _e : -1;
180
+ const excessEnergy = (_c = (_b = devices_1.Devices.energymanager) === null || _b === void 0 ? void 0 : _b.excessEnergy) !== null && _c !== void 0 ? _c : -1;
160
181
  if ((acOn ? 200 : 1000) < excessEnergy) {
161
182
  // As there is plenty of energy to spare we plan to overshoot the target by 1 degree
162
183
  threshold = -0.5;
@@ -165,13 +186,10 @@ class AcDevice {
165
186
  const targetTemp = heatGroup.desiredTemp;
166
187
  const coolUntil = targetTemp + threshold;
167
188
  const heatUntil = targetTemp - thresholdHeating;
168
- if (temp > coolUntil && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Sommer) {
189
+ if (temp > coolUntil && this.coolingAllowed) {
169
190
  desiredMode = ac_mode_1.AcMode.Cooling;
170
- 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) {
171
- return ac_mode_1.AcMode.Off;
172
- }
173
191
  }
174
- else if (temp < heatUntil && this.settings.heatingAllowed && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Winter) {
192
+ else if (temp < heatUntil && this.heatingAllowed) {
175
193
  desiredMode = ac_mode_1.AcMode.Heating;
176
194
  }
177
195
  if (acOn ? desiredMode === ac_mode_1.AcMode.Off : desiredMode !== ac_mode_1.AcMode.Off) {
@@ -7,8 +7,6 @@ const room_service_1 = require("../room-service");
7
7
  const log_service_1 = require("../log-service");
8
8
  const ac_1 = require("../ac");
9
9
  const DeviceCapability_1 = require("../../devices/DeviceCapability");
10
- const settings_service_1 = require("../settings-service");
11
- const config_1 = require("../../config");
12
10
  class API {
13
11
  /**
14
12
  * Endpoint to end a scene manually (or early if it has automatic turn off)
@@ -97,7 +95,7 @@ class API {
97
95
  desiredMode = ac_1.AcMode.Off;
98
96
  }
99
97
  else {
100
- desiredMode = settings_service_1.SettingsService.heatMode == config_1.HeatingMode.Winter ? ac_1.AcMode.Heating : ac_1.AcMode.Cooling;
98
+ desiredMode = d.heatingAllowed ? ac_1.AcMode.Heating : ac_1.AcMode.Cooling;
101
99
  }
102
100
  }
103
101
  d.log(models_1.LogLevel.Info, `API Call to set AC to ${desiredState} with mode ${desiredMode} for ${forceTime}ms`);
@@ -38,7 +38,9 @@ class BlockAutomaticHandler {
38
38
  }
39
39
  this.automaticBlockedUntil = c.targetDate;
40
40
  if (c.revertToAutomaticAtBlockLift) {
41
- this.updateRestoreTimeout(new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.'));
41
+ const revertCommand = new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.');
42
+ revertCommand.overrideCommandSource = models_1.CommandSource.Automatic;
43
+ this.updateRestoreTimeout(revertCommand);
42
44
  }
43
45
  else {
44
46
  this.removeRestoreTimeout();
@@ -42,7 +42,7 @@ class MuellService {
42
42
  continue;
43
43
  }
44
44
  const ev = data[k];
45
- log_service_1.ServerLogService.writeLog(models_1.LogLevel.DeepTrace, `${ev.summary} is in ${ev.location} on the ${ev.start.getDate()} of ${this.months[ev.start.getMonth()]} at ${ev.start.toLocaleTimeString('en-GB')}`);
45
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.DeepTrace, `${ev.summary} is in ${ev.location} on the ${ev.start.getDate()} of ${this.months[ev.start.getMonth()]} at ${ev.start.toLocaleTimeString('de-DE')}`);
46
46
  if (ev.start.getTime() < todayMidnight) {
47
47
  continue;
48
48
  }