hoffmation-base 3.0.0-beta.2 → 3.0.0-beta.4

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.
@@ -37,6 +37,14 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
37
37
  * Defines the desired minimum temperature for warm water.
38
38
  */
39
39
  warmWaterDesiredMinTemp: number;
40
+ /**
41
+ * Defines the desired minimum temperature for heat storage during winter.
42
+ */
43
+ winterMinimumHeatStorageTemp: number;
44
+ /**
45
+ * Defines the desired minimum temperature for heat storage during winter.
46
+ */
47
+ winterMinimumPreNightHeatStorageTemp: number;
40
48
  fromPartialObject(data: Partial<DachsDeviceSettings>): void;
41
49
  protected toJSON(): Partial<DachsDeviceSettings>;
42
50
  }
@@ -43,9 +43,17 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
43
43
  * Defines the desired minimum temperature for warm water.
44
44
  */
45
45
  this.warmWaterDesiredMinTemp = 45;
46
+ /**
47
+ * Defines the desired minimum temperature for heat storage during winter.
48
+ */
49
+ this.winterMinimumHeatStorageTemp = 55;
50
+ /**
51
+ * Defines the desired minimum temperature for heat storage during winter.
52
+ */
53
+ this.winterMinimumPreNightHeatStorageTemp = 65;
46
54
  }
47
55
  fromPartialObject(data) {
48
- var _a, _b, _c, _d, _e, _f, _g;
56
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
49
57
  this.refreshIntervalTime = (_a = data.refreshIntervalTime) !== null && _a !== void 0 ? _a : this.refreshIntervalTime;
50
58
  this.batteryLevelBeforeNightTurnOnThreshold =
51
59
  (_b = data.batteryLevelBeforeNightTurnOnThreshold) !== null && _b !== void 0 ? _b : this.batteryLevelBeforeNightTurnOnThreshold;
@@ -55,6 +63,9 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
55
63
  (_e = data.batteryLevelPreventStartThreshold) !== null && _e !== void 0 ? _e : this.batteryLevelPreventStartThreshold;
56
64
  this.batteryLevelAllowStartThreshold = (_f = data.batteryLevelAllowStartThreshold) !== null && _f !== void 0 ? _f : this.batteryLevelAllowStartThreshold;
57
65
  this.warmWaterDesiredMinTemp = (_g = data.warmWaterDesiredMinTemp) !== null && _g !== void 0 ? _g : this.warmWaterDesiredMinTemp;
66
+ this.winterMinimumHeatStorageTemp = (_h = data.winterMinimumHeatStorageTemp) !== null && _h !== void 0 ? _h : this.winterMinimumHeatStorageTemp;
67
+ this.winterMinimumPreNightHeatStorageTemp =
68
+ (_j = data.winterMinimumPreNightHeatStorageTemp) !== null && _j !== void 0 ? _j : this.winterMinimumPreNightHeatStorageTemp;
58
69
  super.fromPartialObject(data);
59
70
  }
60
71
  toJSON() {
@@ -87,7 +87,9 @@ export declare class Dachs implements iBaseDevice, iActuator {
87
87
  */
88
88
  private onBatteryLevelChange;
89
89
  private checkAllDesiredStates;
90
- private onTempChange;
90
+ private onHeatStorageTempChange;
91
+ private onWarmWaterTempChange;
92
+ private checkWwPumpDesiredState;
91
93
  private checkHeatingRod;
92
94
  private shouldDachsBeStarted;
93
95
  private checkAlternativeActuator;
@@ -63,8 +63,8 @@ class Dachs {
63
63
  const energyManager = devices_1.Devices.energymanager;
64
64
  energyManager.battery.addBatteryLevelCallback(this.onBatteryLevelChange.bind(this));
65
65
  }
66
- this.warmWaterSensor.addTempChangeCallback(this.onTempChange.bind(this));
67
- this.heatStorageTempSensor.addTempChangeCallback(this.onTempChange.bind(this));
66
+ this.warmWaterSensor.addTempChangeCallback(this.onWarmWaterTempChange.bind(this));
67
+ this.heatStorageTempSensor.addTempChangeCallback(this.onHeatStorageTempChange.bind(this));
68
68
  }
69
69
  /** @inheritDoc */
70
70
  get info() {
@@ -220,6 +220,7 @@ class Dachs {
220
220
  const shouldDachsBeStarted = this.shouldDachsBeStarted(action, batteryLevel);
221
221
  this.checkHeatingRod(action, batteryLevel);
222
222
  this.checkAlternativeActuator(shouldDachsBeStarted, action);
223
+ this.checkWwPumpDesiredState(action);
223
224
  if (!shouldDachsBeStarted) {
224
225
  return;
225
226
  }
@@ -227,7 +228,15 @@ class Dachs {
227
228
  setStateCommand.overrideCommandSource = models_1.CommandSource.Force;
228
229
  this.setActuator(setStateCommand);
229
230
  }
230
- onTempChange(action) {
231
+ onHeatStorageTempChange(action) {
232
+ var _a, _b;
233
+ this.checkAllDesiredStates(action, (_b = (_a = devices_1.Devices.energymanager) === null || _a === void 0 ? void 0 : _a.batteryLevel) !== null && _b !== void 0 ? _b : 0);
234
+ }
235
+ onWarmWaterTempChange(action) {
236
+ var _a, _b;
237
+ this.checkAllDesiredStates(action, (_b = (_a = devices_1.Devices.energymanager) === null || _a === void 0 ? void 0 : _a.batteryLevel) !== null && _b !== void 0 ? _b : 0);
238
+ }
239
+ checkWwPumpDesiredState(action) {
231
240
  var _a, _b;
232
241
  if (this.warmWaterPump === undefined) {
233
242
  // We have no control over the warm water pump --> nothing to do
@@ -288,7 +297,7 @@ class Dachs {
288
297
  this.heatingRod.setActuator(setAction);
289
298
  }
290
299
  shouldDachsBeStarted(action, batteryLevel) {
291
- var _a;
300
+ var _a, _b;
292
301
  if (this.blockDachsStart !== undefined) {
293
302
  if (batteryLevel > this.settings.batteryLevelPreventStartThreshold) {
294
303
  const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${batteryLevel}%, Dachs should not run any more`, null);
@@ -301,7 +310,7 @@ class Dachs {
301
310
  this.blockDachsStart.setActuator(liftAction);
302
311
  }
303
312
  else if (((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter &&
304
- this.heatStorageTempSensor.temperatureSensor.temperature < 60 &&
313
+ this.heatStorageTempSensor.temperatureSensor.temperature < this.settings.winterMinimumPreNightHeatStorageTemp &&
305
314
  services_1.Utils.dateByTimeSpan(21, 30) < new Date()) {
306
315
  const liftWinterAction = new models_1.ActuatorSetStateCommand(action, false, `Battery at ${batteryLevel}% but it is winter, we are nearing night and heat storage is kinda cold: Dachs is now allowed to run if needed`, null);
307
316
  this.blockDachsStart.setActuator(liftWinterAction);
@@ -315,6 +324,11 @@ class Dachs {
315
324
  // We are already running
316
325
  return false;
317
326
  }
327
+ if (((_b = services_1.SettingsService.settings.heaterSettings) === null || _b === void 0 ? void 0 : _b.mode) === config_1.HeatingMode.Winter &&
328
+ this.heatStorageTempSensor.temperatureSensor.temperature < this.settings.winterMinimumHeatStorageTemp) {
329
+ // It is winter and heat storage is kinda cold --> Start
330
+ return true;
331
+ }
318
332
  const dayType = services_1.TimeCallbackService.dayType(new services_1.SunTimeOffsets());
319
333
  if ((dayType === models_1.TimeOfDay.Daylight || dayType === models_1.TimeOfDay.BeforeSunrise) &&
320
334
  batteryLevel > this.settings.batteryLevelTurnOnThreshold) {
@@ -65,6 +65,11 @@ class DeviceCluster {
65
65
  case deviceType_1.DeviceType.HmIpGriff:
66
66
  clusterTypes.push(device_cluster_type_1.DeviceClusterType.Handle);
67
67
  break;
68
+ case deviceType_1.DeviceType.ZigbeeSodaHandle:
69
+ clusterTypes.push(device_cluster_type_1.DeviceClusterType.Handle);
70
+ clusterTypes.push(device_cluster_type_1.DeviceClusterType.TemperaturSensor);
71
+ clusterTypes.push(device_cluster_type_1.DeviceClusterType.HumiditySensor);
72
+ break;
68
73
  case deviceType_1.DeviceType.HmIpHeizgruppe:
69
74
  clusterTypes.push(device_cluster_type_1.DeviceClusterType.Heater);
70
75
  clusterTypes.push(device_cluster_type_1.DeviceClusterType.TemperaturSensor);
@@ -78,6 +83,7 @@ class DeviceCluster {
78
83
  case deviceType_1.DeviceType.HmIpBewegung:
79
84
  case deviceType_1.DeviceType.ZigbeeAquaraMotion:
80
85
  case deviceType_1.DeviceType.ZigbeeSonoffMotion:
86
+ case deviceType_1.DeviceType.ZigbeeTuyaMotion:
81
87
  case deviceType_1.DeviceType.HmIpPraezenz:
82
88
  clusterTypes.push(device_cluster_type_1.DeviceClusterType.MotionDetection);
83
89
  break;
@@ -39,6 +39,7 @@ export declare enum DeviceType {
39
39
  ZigbeeUbisysLampe = 225,
40
40
  ZigbeeInnr142C = 226,
41
41
  ZigbeeSodaHandle = 227,
42
+ ZigbeeTuyaMotion = 228,
42
43
  JsEnergyManager = 301,
43
44
  RoomScene = 401,
44
45
  ShellyTrv = 402,
@@ -43,6 +43,7 @@ var DeviceType;
43
43
  DeviceType[DeviceType["ZigbeeUbisysLampe"] = 225] = "ZigbeeUbisysLampe";
44
44
  DeviceType[DeviceType["ZigbeeInnr142C"] = 226] = "ZigbeeInnr142C";
45
45
  DeviceType[DeviceType["ZigbeeSodaHandle"] = 227] = "ZigbeeSodaHandle";
46
+ DeviceType[DeviceType["ZigbeeTuyaMotion"] = 228] = "ZigbeeTuyaMotion";
46
47
  DeviceType[DeviceType["JsEnergyManager"] = 301] = "JsEnergyManager";
47
48
  DeviceType[DeviceType["RoomScene"] = 401] = "RoomScene";
48
49
  DeviceType[DeviceType["ShellyTrv"] = 402] = "ShellyTrv";
@@ -223,6 +223,9 @@ class Devices {
223
223
  case 'TuyaValve':
224
224
  d = new zigbee_1.ZigbeeTuyaValve(zigbeeInfo);
225
225
  break;
226
+ case 'TuyaMotion':
227
+ d = new zigbee_1.ZigbeeTuyaMotion(zigbeeInfo);
228
+ break;
226
229
  case 'EuroHeater':
227
230
  d = new zigbee_1.ZigbeeEuroHeater(zigbeeInfo);
228
231
  break;
@@ -44,6 +44,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
44
44
  Kd: 9, // PID: Kd in 1/1000
45
45
  });
46
46
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
47
+ this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
47
48
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
48
49
  this._setAutomaticModeId = `${this.info.fullID}.tmp.automaticTemperatureControl`;
49
50
  this._setExternalTempId = `${this.info.fullID}.ext.temperature`;
@@ -39,6 +39,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
39
39
  });
40
40
  this._seasonTurnOff = false;
41
41
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
42
+ this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
42
43
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
43
44
  this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
44
45
  services_1.TimeCallbackService.addCallback(new models_1.TimeCallback(`${this.info.fullID} Season Check`, models_1.TimeCallbackType.TimeOfDay, () => {
@@ -25,3 +25,4 @@ export * from './zigbeeTuyaValve';
25
25
  export * from './zigbeeUbisysActuator';
26
26
  export * from './zigbeeUbisysLampe';
27
27
  export * from './zigbeeUbisysShutter';
28
+ export { ZigbeeTuyaMotion } from './zigbeeTuyaMotion';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ZigbeeTuyaMotion = void 0;
17
18
  __exportStar(require("./BaseDevices/index"), exports);
18
19
  __exportStar(require("./zigbeeAqaraMagnetContact"), exports);
19
20
  __exportStar(require("./zigbeeAqaraOpple3Switch"), exports);
@@ -41,3 +42,5 @@ __exportStar(require("./zigbeeTuyaValve"), exports);
41
42
  __exportStar(require("./zigbeeUbisysActuator"), exports);
42
43
  __exportStar(require("./zigbeeUbisysLampe"), exports);
43
44
  __exportStar(require("./zigbeeUbisysShutter"), exports);
45
+ var zigbeeTuyaMotion_1 = require("./zigbeeTuyaMotion");
46
+ Object.defineProperty(exports, "ZigbeeTuyaMotion", { enumerable: true, get: function () { return zigbeeTuyaMotion_1.ZigbeeTuyaMotion; } });
@@ -0,0 +1,7 @@
1
+ import { ZigbeeMotionSensor } from './BaseDevices';
2
+ import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
3
+ export declare class ZigbeeTuyaMotion extends ZigbeeMotionSensor {
4
+ constructor(pInfo: IoBrokerDeviceInfo);
5
+ /** @inheritDoc */
6
+ update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZigbeeTuyaMotion = void 0;
4
+ const BaseDevices_1 = require("./BaseDevices");
5
+ const deviceType_1 = require("../deviceType");
6
+ const models_1 = require("../../../models");
7
+ class ZigbeeTuyaMotion extends BaseDevices_1.ZigbeeMotionSensor {
8
+ constructor(pInfo) {
9
+ super(pInfo, deviceType_1.DeviceType.ZigbeeTuyaMotion);
10
+ this._needsMovementResetFallback = false;
11
+ }
12
+ /** @inheritDoc */
13
+ update(idSplit, state, initial = false) {
14
+ this.log(models_1.LogLevel.DeepTrace, `Motion update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
15
+ super.update(idSplit, state, initial, true);
16
+ }
17
+ }
18
+ exports.ZigbeeTuyaMotion = ZigbeeTuyaMotion;