hoffmation-base 2.18.5 → 2.18.7

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.
@@ -10,5 +10,5 @@ export interface iCameraDevice extends iMotionSensor {
10
10
  readonly alarmBlockedByGriff: boolean;
11
11
  readonly alarmBlockedByGriffTimeStamp: number;
12
12
  onGriffUpdate(open: boolean): void;
13
- update(stateName: string, state: ioBroker.State): void;
13
+ update(idSplit: string[], state: ioBroker.State): void;
14
14
  }
@@ -17,7 +17,7 @@ class BlueIrisCoordinator {
17
17
  services_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Unknown Blue Iris Device "${devName}"`);
18
18
  return;
19
19
  }
20
- dev.update(idSplit[4], state);
20
+ dev.update(idSplit, state);
21
21
  }
22
22
  }
23
23
  exports.BlueIrisCoordinator = BlueIrisCoordinator;
@@ -6,6 +6,10 @@ import { DeviceCapability } from '../DeviceCapability';
6
6
  import { DeviceType } from '../deviceType';
7
7
  export declare class CameraDevice implements iCameraDevice {
8
8
  readonly blueIrisName: string;
9
+ private _personDetectFallbackTimeout;
10
+ private _movementDetectFallbackTimeout;
11
+ private _personDetectedStateId;
12
+ private _movementDetectedStateId;
9
13
  get lastImage(): string;
10
14
  settings: CameraSettings;
11
15
  readonly deviceCapabilities: DeviceCapability[];
@@ -48,10 +52,12 @@ export declare class CameraDevice implements iCameraDevice {
48
52
  addMovementCallback(pCallback: (newState: boolean) => void): void;
49
53
  onGriffUpdate(open: boolean): void;
50
54
  persistMotionSensor(): void;
51
- update(stateName: string, state: ioBroker.State): void;
55
+ update(idSplit: string[], state: ioBroker.State): void;
52
56
  updateMovement(newState: boolean): void;
53
57
  log(level: LogLevel, message: string, debugType?: LogDebugType): void;
54
58
  toJSON(): Partial<iRoomDevice>;
55
59
  persistDeviceInfo(): void;
56
60
  loadDeviceSettings(): void;
61
+ private resetPersonDetectFallbackTimer;
62
+ private resetMovementFallbackTimer;
57
63
  }
@@ -12,6 +12,7 @@ const devices_1 = require("../devices");
12
12
  const DeviceInfo_1 = require("../DeviceInfo");
13
13
  const DeviceCapability_1 = require("../DeviceCapability");
14
14
  const deviceType_1 = require("../deviceType");
15
+ const ioBroker_1 = require("../../ioBroker");
15
16
  class CameraDevice {
16
17
  get lastImage() {
17
18
  return this._lastImage;
@@ -24,6 +25,10 @@ class CameraDevice {
24
25
  }
25
26
  constructor(mqttName, roomName, blueIrisName) {
26
27
  var _a;
28
+ this._personDetectFallbackTimeout = null;
29
+ this._movementDetectFallbackTimeout = null;
30
+ this._personDetectedStateId = undefined;
31
+ this._movementDetectedStateId = undefined;
27
32
  this.settings = new models_1.CameraSettings();
28
33
  this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.camera, DeviceCapability_1.DeviceCapability.motionSensor];
29
34
  this.deviceType = deviceType_1.DeviceType.Camera;
@@ -126,19 +131,27 @@ class CameraDevice {
126
131
  var _a;
127
132
  (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistMotionSensor(this);
128
133
  }
129
- update(stateName, state) {
134
+ update(idSplit, state) {
135
+ const stateName = idSplit[4];
130
136
  this.log(models_1.LogLevel.Debug, `Update for "${stateName}"`);
131
137
  switch (stateName) {
132
138
  case 'MotionDetected':
139
+ this._movementDetectedStateId = idSplit.join('.');
133
140
  if (this.settings.movementDetectionOnPersonOnly) {
134
141
  return;
135
142
  }
136
- this.updateMovement(state.val === 1);
143
+ const movementDetected = state.val === 1;
144
+ this.updateMovement(movementDetected);
145
+ if (movementDetected) {
146
+ this.resetMovementFallbackTimer();
147
+ }
137
148
  break;
138
149
  case 'PersonDetected':
150
+ this._personDetectedStateId = idSplit.join('.');
139
151
  const newValue = state.val === 1;
140
152
  if (newValue) {
141
153
  this.log(models_1.LogLevel.Info, `Person Detected`);
154
+ this.resetPersonDetectFallbackTimer();
142
155
  }
143
156
  this._personDetected = newValue;
144
157
  if (this.settings.movementDetectionOnPersonOnly) {
@@ -204,5 +217,37 @@ class CameraDevice {
204
217
  var _a;
205
218
  (_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
206
219
  }
220
+ resetPersonDetectFallbackTimer() {
221
+ if (this._personDetectFallbackTimeout !== null) {
222
+ clearTimeout(this._personDetectFallbackTimeout);
223
+ this._personDetectFallbackTimeout = null;
224
+ }
225
+ this._personDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
226
+ var _a;
227
+ this._personDetectFallbackTimeout = null;
228
+ this._personDetected = false;
229
+ if (this.settings.movementDetectionOnPersonOnly) {
230
+ this.updateMovement(false);
231
+ }
232
+ if (this._personDetectedStateId !== undefined) {
233
+ (_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._personDetectedStateId, { val: 0, ack: true });
234
+ }
235
+ }, 120000, this);
236
+ }
237
+ resetMovementFallbackTimer() {
238
+ if (this._movementDetectFallbackTimeout !== null) {
239
+ clearTimeout(this._movementDetectFallbackTimeout);
240
+ this._movementDetectFallbackTimeout = null;
241
+ }
242
+ this._movementDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
243
+ var _a;
244
+ this._movementDetectFallbackTimeout = null;
245
+ this._movementDetected = false;
246
+ this.updateMovement(false);
247
+ if (this._movementDetectedStateId !== undefined) {
248
+ (_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._movementDetectedStateId, { val: 0, ack: true });
249
+ }
250
+ }, 120000, this);
251
+ }
207
252
  }
208
253
  exports.CameraDevice = CameraDevice;
@@ -8,12 +8,14 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater {
8
8
  get lastBatteryPersist(): number;
9
9
  readonly persistHeaterInterval: NodeJS.Timeout;
10
10
  get battery(): number;
11
+ get minimumLevel(): number;
11
12
  private _automaticMode;
12
13
  private _battery;
13
14
  private _iAutomaticInterval;
14
15
  private _initialSeasonCheckDone;
15
16
  private _lastRecalc;
16
17
  private _level;
18
+ private _minimumValveLevel;
17
19
  private _recalcTimeout;
18
20
  private _temperatur;
19
21
  private _targetTempVal;
@@ -22,6 +24,7 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater {
22
24
  private _pidController;
23
25
  private _lastBatteryPersist;
24
26
  private readonly _batteryId;
27
+ private readonly _minumumLevelId;
25
28
  private readonly _setAutomaticModeId;
26
29
  private readonly _setExternalTempId;
27
30
  private readonly _setEnableExternalTempId;
@@ -57,4 +60,5 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater {
57
60
  private setExternalTemperature;
58
61
  private setExternalTemperatureEnabled;
59
62
  private setValve;
63
+ private setMinimumLevel;
60
64
  }
@@ -15,6 +15,9 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
15
15
  get battery() {
16
16
  return this._battery;
17
17
  }
18
+ get minimumLevel() {
19
+ return this._minimumValveLevel;
20
+ }
18
21
  constructor(pInfo) {
19
22
  super(pInfo, deviceType_1.DeviceType.ShellyTrv);
20
23
  this.settings = new models_1.HeaterSettings();
@@ -26,6 +29,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
26
29
  this._initialSeasonCheckDone = false;
27
30
  this._lastRecalc = 0;
28
31
  this._level = 0;
32
+ this._minimumValveLevel = 0;
29
33
  this._recalcTimeout = null;
30
34
  this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
31
35
  this._targetTempVal = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
@@ -52,7 +56,8 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
52
56
  this._setExternalTempId = `${this.info.fullID}.ext.temperature`;
53
57
  this._setEnableExternalTempId = `${this.info.fullID}.ext.enabled`;
54
58
  this._setPointTemperaturID = `${this.info.fullID}.tmp.shelly.temperatureTargetC`;
55
- this._temperatureId = `${this.info.fullID}.tmp..temperatureC`;
59
+ this._minumumLevelId = `${this.info.fullID}.tmp.minimumValvePosition`;
60
+ this._temperatureId = `${this.info.fullID}.tmp.temperatureC`;
56
61
  this._valvePosId = `${this.info.fullID}.tmp.valvePosition`;
57
62
  this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
58
63
  services_1.TimeCallbackService.addCallback(new models_1.TimeCallback(`${this.info.fullID} Season Check`, models_1.TimeCallbackType.TimeOfDay, () => {
@@ -126,6 +131,9 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
126
131
  if (this.seasonTurnOff) {
127
132
  return;
128
133
  }
134
+ if (this.settings.pidForcedMinimum !== this.minimumLevel) {
135
+ this.setMinimumLevel(this.settings.pidForcedMinimum);
136
+ }
129
137
  if (!this.settings.useOwnTemperatur && !this.settings.controlByPid) {
130
138
  this.setExternalTemperatureEnabled(true);
131
139
  }
@@ -167,6 +175,9 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
167
175
  case this._setEnableExternalTempId:
168
176
  this._useExternalTemperatureEnabled = state.val;
169
177
  break;
178
+ case this._minumumLevelId:
179
+ this._minimumValveLevel = state.val;
180
+ break;
170
181
  case this._temperatureId:
171
182
  this._temperatur = state.val;
172
183
  break;
@@ -259,5 +270,8 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
259
270
  this.log(models_1.LogLevel.Info, `Setting Valve to new value: "${target}%"`);
260
271
  this.setState(this._valvePosId, target);
261
272
  }
273
+ setMinimumLevel(pidForcedMinimum) {
274
+ this.setState(this._minumumLevelId, pidForcedMinimum);
275
+ }
262
276
  }
263
277
  exports.ShellyTrv = ShellyTrv;