hoffmation-base 2.17.4 → 2.18.1

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.
@@ -1,7 +1,6 @@
1
1
  import { DeviceSettings } from './deviceSettings';
2
2
  export declare class HeaterSettings extends DeviceSettings {
3
3
  automaticMode: boolean;
4
- automaticFallBackTemperatur: number;
5
4
  useOwnTemperatur: boolean;
6
5
  /**
7
6
  * Whether this device should be controlled using only valve position
@@ -7,7 +7,6 @@ class HeaterSettings extends deviceSettings_1.DeviceSettings {
7
7
  constructor() {
8
8
  super(...arguments);
9
9
  this.automaticMode = true;
10
- this.automaticFallBackTemperatur = 20;
11
10
  this.useOwnTemperatur = true;
12
11
  /**
13
12
  * Whether this device should be controlled using only valve position
@@ -39,16 +38,15 @@ class HeaterSettings extends deviceSettings_1.DeviceSettings {
39
38
  this.pidForcedMinimum = 1;
40
39
  }
41
40
  fromPartialObject(data) {
42
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ var _a, _b, _c, _d, _e, _f, _g, _h;
43
42
  this.automaticMode = (_a = data.automaticMode) !== null && _a !== void 0 ? _a : this.automaticMode;
44
- this.automaticFallBackTemperatur = (_b = data.automaticFallBackTemperatur) !== null && _b !== void 0 ? _b : this.automaticFallBackTemperatur;
45
- this.useOwnTemperatur = (_c = data.useOwnTemperatur) !== null && _c !== void 0 ? _c : this.useOwnTemperatur;
46
- this.controlByPid = (_d = data.controlByPid) !== null && _d !== void 0 ? _d : this.controlByPid;
47
- this.controlByTempDiff = (_e = data.controlByTempDiff) !== null && _e !== void 0 ? _e : this.controlByTempDiff;
48
- this.seasonalTurnOffActive = (_f = data.seasonalTurnOffActive) !== null && _f !== void 0 ? _f : this.seasonalTurnOffActive;
49
- this.seasonTurnOffDay = (_g = data.seasonTurnOffDay) !== null && _g !== void 0 ? _g : this.seasonTurnOffDay;
50
- this.seasonTurnOnDay = (_h = data.seasonTurnOnDay) !== null && _h !== void 0 ? _h : this.seasonTurnOnDay;
51
- this.pidForcedMinimum = (_j = data.pidForcedMinimum) !== null && _j !== void 0 ? _j : this.pidForcedMinimum;
43
+ this.useOwnTemperatur = (_b = data.useOwnTemperatur) !== null && _b !== void 0 ? _b : this.useOwnTemperatur;
44
+ this.controlByPid = (_c = data.controlByPid) !== null && _c !== void 0 ? _c : this.controlByPid;
45
+ this.controlByTempDiff = (_d = data.controlByTempDiff) !== null && _d !== void 0 ? _d : this.controlByTempDiff;
46
+ this.seasonalTurnOffActive = (_e = data.seasonalTurnOffActive) !== null && _e !== void 0 ? _e : this.seasonalTurnOffActive;
47
+ this.seasonTurnOffDay = (_f = data.seasonTurnOffDay) !== null && _f !== void 0 ? _f : this.seasonTurnOffDay;
48
+ this.seasonTurnOnDay = (_g = data.seasonTurnOnDay) !== null && _g !== void 0 ? _g : this.seasonTurnOnDay;
49
+ this.pidForcedMinimum = (_h = data.pidForcedMinimum) !== null && _h !== void 0 ? _h : this.pidForcedMinimum;
52
50
  super.fromPartialObject(data);
53
51
  }
54
52
  toJSON() {
@@ -4,6 +4,7 @@ import { GroupSettings } from './groupSettings';
4
4
  export declare class HeatGroupSettings extends GroupSettings {
5
5
  automaticPoints: TemperatureSettings[];
6
6
  automaticMode: boolean;
7
+ automaticFallBackTemperatur: number;
7
8
  /**
8
9
  * Target temperature when automaticMode is disabled
9
10
  * @type {number}
@@ -8,6 +8,7 @@ class HeatGroupSettings extends groupSettings_1.GroupSettings {
8
8
  super(...arguments);
9
9
  this.automaticPoints = [];
10
10
  this.automaticMode = true;
11
+ this.automaticFallBackTemperatur = 20;
11
12
  /**
12
13
  * Target temperature when automaticMode is disabled
13
14
  * @type {number}
@@ -15,10 +16,11 @@ class HeatGroupSettings extends groupSettings_1.GroupSettings {
15
16
  this.manualTemperature = 20;
16
17
  }
17
18
  fromPartialObject(data) {
18
- var _a, _b, _c;
19
+ var _a, _b, _c, _d;
19
20
  this.automaticPoints = (_a = data.automaticPoints) !== null && _a !== void 0 ? _a : this.automaticPoints;
20
21
  this.automaticMode = (_b = data.automaticMode) !== null && _b !== void 0 ? _b : this.automaticMode;
21
22
  this.manualTemperature = (_c = data.manualTemperature) !== null && _c !== void 0 ? _c : this.manualTemperature;
23
+ this.automaticFallBackTemperatur = (_d = data.automaticFallBackTemperatur) !== null && _d !== void 0 ? _d : this.automaticFallBackTemperatur;
22
24
  super.fromPartialObject(data);
23
25
  }
24
26
  toJSON() {
@@ -32,5 +32,4 @@ export declare class HeatGroup extends BaseGroup {
32
32
  deleteAutomaticPoint(name: string): void;
33
33
  setAutomaticPoint(setting: TemperatureSettings): void;
34
34
  private recalcRoomTemperatur;
35
- getTargetTemperature(): number;
36
35
  }
@@ -76,14 +76,14 @@ class HeatGroup extends base_group_1.BaseGroup {
76
76
  return temp;
77
77
  }
78
78
  get desiredTemp() {
79
- if (this.getHeater().length === 0) {
80
- return -99;
79
+ if (!this.settings.automaticMode) {
80
+ return this.settings.manualTemperature;
81
81
  }
82
- let value = 0;
83
- for (const h of this.getHeater()) {
84
- value += h.desiredTemperature;
82
+ const activeSetting = models_1.TemperatureSettings.getActiveSetting(this.settings.automaticPoints, new Date());
83
+ if (!activeSetting) {
84
+ return this.settings.automaticFallBackTemperatur;
85
85
  }
86
- return Math.round((value / this.getHeater().length) * 10) / 10;
86
+ return activeSetting.temperature;
87
87
  }
88
88
  static getInfo() {
89
89
  var _a, _b, _c;
@@ -162,15 +162,5 @@ class HeatGroup extends base_group_1.BaseGroup {
162
162
  ac.onTemperaturChange(temp);
163
163
  });
164
164
  }
165
- getTargetTemperature() {
166
- if (!this.settings.automaticMode) {
167
- return this.settings.manualTemperature;
168
- }
169
- const activeSetting = models_1.TemperatureSettings.getActiveSetting(this.settings.automaticPoints, new Date());
170
- if (!activeSetting) {
171
- return this.settings.manualTemperature;
172
- }
173
- return activeSetting.temperature;
174
- }
175
165
  }
176
166
  exports.HeatGroup = HeatGroup;
@@ -129,7 +129,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
129
129
  }
130
130
  }
131
131
  checkAutomaticChange() {
132
- var _a, _b, _c, _d, _e, _f, _g;
132
+ var _a, _b, _c, _d, _e, _f, _g, _h;
133
133
  if (!this._initialSeasonCheckDone) {
134
134
  this.checkSeasonTurnOff();
135
135
  }
@@ -138,14 +138,10 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
138
138
  return;
139
139
  }
140
140
  const setting = models_1.TemperatureSettings.getActiveSetting((_f = (_e = (_d = (_c = this.room) === null || _c === void 0 ? void 0 : _c.HeatGroup) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.automaticPoints) !== null && _f !== void 0 ? _f : [], new Date());
141
- if (setting === undefined) {
142
- this.log(models_1.LogLevel.Warn, `Undefined Heating Timestamp.`);
143
- this.desiredTemperature = this.settings.automaticFallBackTemperatur;
144
- return;
145
- }
146
- if (this._desiredTemperature !== setting.temperature) {
147
- this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperature}°C`);
148
- this.desiredTemperature = (_g = setting.temperature) !== null && _g !== void 0 ? _g : this.settings.automaticFallBackTemperatur;
141
+ const targetTemp = (_h = (_g = setting === null || setting === void 0 ? void 0 : setting.temperature) !== null && _g !== void 0 ? _g : heatGroupSettings === null || heatGroupSettings === void 0 ? void 0 : heatGroupSettings.automaticFallBackTemperatur) !== null && _h !== void 0 ? _h : 20;
142
+ if (this._desiredTemperature !== targetTemp) {
143
+ this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${targetTemp}°C`);
144
+ this.desiredTemperature = targetTemp;
149
145
  }
150
146
  }
151
147
  addTempChangeCallback(pCallback) {
@@ -119,7 +119,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
119
119
  }
120
120
  }
121
121
  checkAutomaticChange() {
122
- var _a, _b, _c, _d, _e, _f;
122
+ var _a, _b, _c, _d, _e, _f, _g, _h;
123
123
  if (!this._initialSeasonCheckDone) {
124
124
  this.checkSeasonTurnOff();
125
125
  }
@@ -138,14 +138,10 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
138
138
  return;
139
139
  }
140
140
  const setting = models_1.TemperatureSettings.getActiveSetting((_f = (_e = (_d = (_c = this.room) === null || _c === void 0 ? void 0 : _c.HeatGroup) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.automaticPoints) !== null && _f !== void 0 ? _f : [], new Date());
141
- if (setting === undefined) {
142
- this.log(models_1.LogLevel.Warn, `Undefined Heating Timestamp.`);
143
- this.desiredTemperature = this.settings.automaticFallBackTemperatur;
144
- return;
145
- }
146
- if (this._desiredTemperatur !== setting.temperature) {
147
- this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperature}°C`);
148
- this.desiredTemperature = setting.temperature;
141
+ const targetTemperature = (_h = (_g = setting === null || setting === void 0 ? void 0 : setting.temperature) !== null && _g !== void 0 ? _g : heatGroupSettings === null || heatGroupSettings === void 0 ? void 0 : heatGroupSettings.automaticFallBackTemperatur) !== null && _h !== void 0 ? _h : 20;
142
+ if (this._desiredTemperatur !== targetTemperature) {
143
+ this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${targetTemperature}°C`);
144
+ this.desiredTemperature = targetTemperature;
149
145
  }
150
146
  }
151
147
  stopAutomaticCheck() {
@@ -91,7 +91,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
91
91
  this._roomTemperature = val;
92
92
  }
93
93
  checkAutomaticChange() {
94
- var _a, _b, _c, _d, _e, _f;
94
+ var _a, _b, _c, _d, _e, _f, _g, _h;
95
95
  if (!this._initialSeasonCheckDone) {
96
96
  this.checkSeasonTurnOff();
97
97
  }
@@ -100,14 +100,10 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
100
100
  return;
101
101
  }
102
102
  const setting = models_1.TemperatureSettings.getActiveSetting((_f = (_e = (_d = (_c = this.room) === null || _c === void 0 ? void 0 : _c.HeatGroup) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.automaticPoints) !== null && _f !== void 0 ? _f : [], new Date());
103
- if (setting === undefined) {
104
- this.log(models_1.LogLevel.Warn, `Undefined Heating Timestamp.`);
105
- this.desiredTemperature = this.settings.automaticFallBackTemperatur;
106
- return;
107
- }
108
- if (this._desiredTemperatur !== setting.temperature) {
109
- this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperature}°C`);
110
- this.desiredTemperature = setting.temperature;
103
+ const targetTemperature = (_h = (_g = setting === null || setting === void 0 ? void 0 : setting.temperature) !== null && _g !== void 0 ? _g : heatGroupSettings === null || heatGroupSettings === void 0 ? void 0 : heatGroupSettings.automaticFallBackTemperatur) !== null && _h !== void 0 ? _h : 20;
104
+ if (this._desiredTemperatur !== targetTemperature) {
105
+ this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${targetTemperature}°C`);
106
+ this.desiredTemperature = targetTemperature;
111
107
  }
112
108
  }
113
109
  stopAutomaticCheck() {
@@ -13,6 +13,7 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
13
13
  deviceCapabilities: DeviceCapability[];
14
14
  readonly blockAutomationHandler: BlockAutomaticHandler;
15
15
  protected _activatedByExcessEnergy: boolean;
16
+ protected _desiredTemperatur: number;
16
17
  protected _info: DeviceInfo;
17
18
  protected _room: RoomBase | undefined;
18
19
  protected _mode: AcMode;
@@ -43,6 +43,7 @@ class AcDevice {
43
43
  this.settings = new models_1.AcSettings();
44
44
  this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.ac, DeviceCapability_1.DeviceCapability.blockAutomatic];
45
45
  this._activatedByExcessEnergy = false;
46
+ this._desiredTemperatur = devices_1.UNDEFINED_TEMP_VALUE;
46
47
  this._mode = ac_mode_1.AcMode.Off;
47
48
  this._movementCallbackAdded = false;
48
49
  this._roomTemperature = 0;
@@ -96,8 +97,9 @@ class AcDevice {
96
97
  return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
97
98
  }
98
99
  calculateDesiredMode() {
99
- var _a, _b, _c, _d, _e, _f, _g;
100
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
100
101
  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;
101
103
  if (this.settings.manualDisabled) {
102
104
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, as manual disable force is set.`);
103
105
  return ac_mode_1.AcMode.Off;
@@ -107,7 +109,7 @@ class AcDevice {
107
109
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, to respect night settings.`);
108
110
  return ac_mode_1.AcMode.Off;
109
111
  }
110
- const heatGroup = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup;
112
+ const heatGroup = (_d = this.room) === null || _d === void 0 ? void 0 : _d.HeatGroup;
111
113
  if (this.settings.useOwnTemperatureAndAutomatic) {
112
114
  // Device is in automatic mode so ignore energy and room temperature
113
115
  if ((heatGroup === null || heatGroup === void 0 ? void 0 : heatGroup.settings.automaticMode) === false) {
@@ -116,14 +118,11 @@ class AcDevice {
116
118
  if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Sommer && this.settings.heatingAllowed) {
117
119
  return ac_mode_1.AcMode.Heating;
118
120
  }
119
- 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) {
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) {
120
122
  return ac_mode_1.AcMode.Cooling;
121
123
  }
122
124
  return ac_mode_1.AcMode.Off;
123
125
  }
124
- if (this.settings.noCoolingOnMovement && ((_e = (_d = this.room) === null || _d === void 0 ? void 0 : _d.PraesenzGroup) === null || _e === void 0 ? void 0 : _e.anyPresent()) === true) {
125
- return ac_mode_1.AcMode.Off;
126
- }
127
126
  const temp = this.roomTemperature;
128
127
  if (temp === undefined || temp === devices_1.UNDEFINED_TEMP_VALUE) {
129
128
  this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no room temperature`);
@@ -136,17 +135,20 @@ class AcDevice {
136
135
  let threshold = acOn ? 0.5 : 1.5;
137
136
  let thresholdHeating = acOn ? 0.5 : 1.5;
138
137
  let desiredMode = ac_mode_1.AcMode.Off;
139
- const excessEnergy = (_g = (_f = devices_1.Devices.energymanager) === null || _f === void 0 ? void 0 : _f.excessEnergy) !== null && _g !== void 0 ? _g : -1;
138
+ const excessEnergy = (_h = (_g = devices_1.Devices.energymanager) === null || _g === void 0 ? void 0 : _g.excessEnergy) !== null && _h !== void 0 ? _h : -1;
140
139
  if ((acOn ? 200 : 1000) < excessEnergy) {
141
140
  // As there is plenty of energy to spare we plan to overshoot the target by 1 degree
142
141
  threshold = -0.5;
143
142
  thresholdHeating = -0.5;
144
143
  }
145
- const targetTemp = heatGroup.getTargetTemperature();
144
+ const targetTemp = heatGroup.desiredTemp;
146
145
  const coolUntil = targetTemp + threshold;
147
146
  const heatUntil = targetTemp - thresholdHeating;
148
147
  if (temp > coolUntil && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Sommer) {
149
148
  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) {
150
+ return ac_mode_1.AcMode.Off;
151
+ }
150
152
  }
151
153
  else if (temp < heatUntil && this.settings.heatingAllowed && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Winter) {
152
154
  desiredMode = ac_mode_1.AcMode.Heating;
@@ -81,8 +81,8 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
81
81
  });
82
82
  }
83
83
  setDesiredInfo(retry = false, forceTemp) {
84
- var _a, _b, _c, _d;
85
- let targetTemp = (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.getTargetTemperature()) !== null && _c !== void 0 ? _c : 21;
84
+ var _a;
85
+ let targetTemp = this._desiredTemperatur;
86
86
  if (this.desiredMode == daikin_controller_1.Mode.HOT) {
87
87
  targetTemp = this.settings.useOwnTemperatureAndAutomatic ? targetTemp + 1 : 29;
88
88
  }
@@ -95,7 +95,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
95
95
  targetHumidity: this.desiredHum,
96
96
  targetTemperature: forceTemp !== null && forceTemp !== void 0 ? forceTemp : targetTemp,
97
97
  };
98
- (_d = this.device) === null || _d === void 0 ? void 0 : _d.setACControlInfo(changeObject, (err, res) => {
98
+ (_a = this.device) === null || _a === void 0 ? void 0 : _a.setACControlInfo(changeObject, (err, res) => {
99
99
  var _a;
100
100
  if (err !== null) {
101
101
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Setting Ac Info for ${this.name} failed: ${err} `);