hoffmation-base 2.9.11 → 2.9.13

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.
@@ -11,5 +11,4 @@ export * from './shutterSettings';
11
11
  export * from './sonosDeviceSettings';
12
12
  export * from './tvSettings';
13
13
  export * from './victronDeviceSettings';
14
- export * from './windowSettings';
15
14
  export * from './wledSettings';
@@ -27,5 +27,4 @@ __exportStar(require("./shutterSettings"), exports);
27
27
  __exportStar(require("./sonosDeviceSettings"), exports);
28
28
  __exportStar(require("./tvSettings"), exports);
29
29
  __exportStar(require("./victronDeviceSettings"), exports);
30
- __exportStar(require("./windowSettings"), exports);
31
30
  __exportStar(require("./wledSettings"), exports);
@@ -2,6 +2,16 @@ import { DeviceSettings } from './deviceSettings';
2
2
  export declare class ShutterSettings extends DeviceSettings {
3
3
  msTilTop: number;
4
4
  msTilBot: number;
5
+ /**
6
+ * The direction this shutter is facing (0 = North, 180 = South)
7
+ * @type {number}
8
+ */
9
+ direction: number;
10
+ /**
11
+ * The desired position, when the shutter should perform a heat reduction.
12
+ * @type {number}
13
+ */
14
+ heatReductionPosition: number;
5
15
  /**
6
16
  * Some shutter give no position feedback on their own, so by knowing the durations in either direction,
7
17
  * we can programmatically trigger the callbacks.
@@ -8,6 +8,16 @@ class ShutterSettings extends deviceSettings_1.DeviceSettings {
8
8
  super(...arguments);
9
9
  this.msTilTop = -1;
10
10
  this.msTilBot = -1;
11
+ /**
12
+ * The direction this shutter is facing (0 = North, 180 = South)
13
+ * @type {number}
14
+ */
15
+ this.direction = 180;
16
+ /**
17
+ * The desired position, when the shutter should perform a heat reduction.
18
+ * @type {number}
19
+ */
20
+ this.heatReductionPosition = 40;
11
21
  /**
12
22
  * Some shutter give no position feedback on their own, so by knowing the durations in either direction,
13
23
  * we can programmatically trigger the callbacks.
@@ -16,10 +26,11 @@ class ShutterSettings extends deviceSettings_1.DeviceSettings {
16
26
  this.triggerPositionUpdateByTime = false;
17
27
  }
18
28
  fromPartialObject(data) {
19
- var _a, _b, _c;
29
+ var _a, _b, _c, _d;
20
30
  this.msTilTop = (_a = data.msTilTop) !== null && _a !== void 0 ? _a : this.msTilTop;
21
31
  this.msTilBot = (_b = data.msTilBot) !== null && _b !== void 0 ? _b : this.msTilBot;
22
- this.triggerPositionUpdateByTime = (_c = data.triggerPositionUpdateByTime) !== null && _c !== void 0 ? _c : this.triggerPositionUpdateByTime;
32
+ this.direction = (_c = data.direction) !== null && _c !== void 0 ? _c : this.direction;
33
+ this.triggerPositionUpdateByTime = (_d = data.triggerPositionUpdateByTime) !== null && _d !== void 0 ? _d : this.triggerPositionUpdateByTime;
23
34
  super.fromPartialObject(data);
24
35
  }
25
36
  toJSON() {
@@ -1,6 +1,8 @@
1
1
  import { Window } from '../groups';
2
2
  import { iRoomDevice } from './iRoomDevice';
3
+ import { ShutterSettings } from '../../../models';
3
4
  export interface iShutter extends iRoomDevice {
5
+ settings: ShutterSettings;
4
6
  currentLevel: number;
5
7
  desiredWindowShutterLevel: number;
6
8
  window: Window | undefined;
@@ -1,6 +1,5 @@
1
1
  import { HmIpGriff } from '../hmIPDevices';
2
2
  import { WindowPosition } from '../models';
3
- import { WindowSettings } from '../../../models';
4
3
  import { iShutter, iVibrationSensor } from '../baseDeviceInterfaces';
5
4
  import { BaseGroup } from './base-group';
6
5
  import { ZigbeeMagnetContact } from '../zigbee';
@@ -10,7 +9,6 @@ export declare class Window extends BaseGroup {
10
9
  readonly shutterIds: string[];
11
10
  readonly magnetIds: string[];
12
11
  desiredPosition: number;
13
- settings: WindowSettings;
14
12
  constructor(roomName: string, handleIds?: string[], vibrationIds?: string[], shutterIds?: string[], magnetIds?: string[]);
15
13
  /**
16
14
  * sets the desired Pos and moves rollo to this level
@@ -16,7 +16,6 @@ class Window extends base_group_1.BaseGroup {
16
16
  this.shutterIds = shutterIds;
17
17
  this.magnetIds = magnetIds;
18
18
  this.desiredPosition = 0;
19
- this.settings = new models_2.WindowSettings();
20
19
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Handle, new device_list_1.DeviceList(handleIds));
21
20
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Vibration, new device_list_1.DeviceList(vibrationIds));
22
21
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Shutter, new device_list_1.DeviceList(shutterIds));
@@ -70,8 +70,9 @@ class WindowGroup extends base_group_1.BaseGroup {
70
70
  const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset);
71
71
  const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
72
72
  this.windows.forEach((f) => {
73
- var _a, _b, _c, _d;
74
- if (f.getShutter().length === 0) {
73
+ var _a, _b, _c, _d, _e, _f;
74
+ const shutterSettings = (_b = (_a = f.getShutter()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.settings;
75
+ if (!shutterSettings) {
75
76
  return;
76
77
  }
77
78
  if (darkOutside) {
@@ -80,7 +81,7 @@ class WindowGroup extends base_group_1.BaseGroup {
80
81
  }
81
82
  let desiredPos = f.desiredPosition;
82
83
  if (desiredPos > 0) {
83
- desiredPos = services_1.WeatherService.weatherRolloPosition(desiredPos, (_b = (_a = room.HeatGroup) === null || _a === void 0 ? void 0 : _a.desiredTemp) !== null && _b !== void 0 ? _b : -99, (_d = (_c = room.HeatGroup) === null || _c === void 0 ? void 0 : _c.temperature) !== null && _d !== void 0 ? _d : -99, this.log.bind(this), f.settings.direction);
84
+ desiredPos = services_1.WeatherService.weatherRolloPosition(desiredPos, (_d = (_c = room.HeatGroup) === null || _c === void 0 ? void 0 : _c.desiredTemp) !== null && _d !== void 0 ? _d : -99, (_f = (_e = room.HeatGroup) === null || _e === void 0 ? void 0 : _e.temperature) !== null && _f !== void 0 ? _f : -99, this.log.bind(this), shutterSettings);
84
85
  }
85
86
  if (f.griffeInPosition(models_2.WindowPosition.offen) > 0 && desiredPos < 100) {
86
87
  return;
@@ -1,10 +1,12 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
3
  import { Window } from '../groups';
4
+ import { ShutterSettings } from '../../../models';
4
5
  import { iShutter } from '../baseDeviceInterfaces';
5
6
  import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
6
7
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
7
8
  export declare class HmIpRoll extends HmIPDevice implements iShutter {
9
+ settings: ShutterSettings;
8
10
  private _setLevelSwitchID;
9
11
  private _firstCommandRecieved;
10
12
  private _setLevel;
@@ -15,6 +15,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
15
15
  constructor(pInfo) {
16
16
  var _a;
17
17
  super(pInfo, deviceType_1.DeviceType.HmIpRoll);
18
+ this.settings = new models_2.ShutterSettings();
18
19
  this._firstCommandRecieved = false;
19
20
  this._setLevel = -1;
20
21
  this._setLevelTime = -1;
@@ -3,7 +3,7 @@ import { WeatherCurrent } from './weather-current';
3
3
  import { WeatherMinutes } from './weather-minutes';
4
4
  import { WeatherAlert } from './weather-alert';
5
5
  import { iWeatherSettings } from '../../config';
6
- import { LogLevel } from '../../../models';
6
+ import { LogLevel, ShutterSettings } from '../../../models';
7
7
  import { LogDebugType } from '../log-service';
8
8
  import { WeatherDaily } from './weather-daily';
9
9
  import { iSpeaker } from '../../devices';
@@ -40,7 +40,7 @@ export declare class WeatherService {
40
40
  static processHourlyWeather(): void;
41
41
  static getCurrentTemp(): number;
42
42
  static willOutsideBeWarmer(referenceTemperature: number, logger: (level: LogLevel, message: string, debugType?: LogDebugType) => void): boolean;
43
- static weatherRolloPosition(normalPos: number, desiredTemperatur: number, currentTemperatur: number, logger: (level: LogLevel, message: string, debugType?: LogDebugType) => void, windowDirection?: number): number;
43
+ static weatherRolloPosition(normalPos: number, desiredTemperatur: number, currentTemperatur: number, logger: (level: LogLevel, message: string, debugType?: LogDebugType) => void, shutterSettings: ShutterSettings): number;
44
44
  static getCurrentCloudiness(): number;
45
45
  private static getRainNextMinutes;
46
46
  private static getActiveAlerts;
@@ -127,7 +127,7 @@ class WeatherService {
127
127
  logger(models_1.LogLevel.Info, `willOutsideBeWarmer(${referenceTemperature}) --> Today Max Temperature: ${wData.daily[0].temp.max}`);
128
128
  return referenceTemperature < wData.daily[0].temp.max;
129
129
  }
130
- static weatherRolloPosition(normalPos, desiredTemperatur, currentTemperatur, logger, windowDirection) {
130
+ static weatherRolloPosition(normalPos, desiredTemperatur, currentTemperatur, logger, shutterSettings) {
131
131
  let result = normalPos;
132
132
  if (currentTemperatur < desiredTemperatur) {
133
133
  logger(models_1.LogLevel.Trace, `RolloWeatherPosition: Room needs to heat up anyways.`);
@@ -141,8 +141,8 @@ class WeatherService {
141
141
  logger(models_1.LogLevel.Trace, `RolloWeatherPosition: It's close to or after todays sunset`);
142
142
  return result;
143
143
  }
144
- else if (windowDirection !== undefined &&
145
- !utils_1.Utils.degreeInBetween(windowDirection - 50, windowDirection + 50, this.sunDirection)) {
144
+ else if (shutterSettings.direction !== undefined &&
145
+ !utils_1.Utils.degreeInBetween(shutterSettings.direction - 50, shutterSettings.direction + 50, this.sunDirection)) {
146
146
  logger(models_1.LogLevel.Trace, `RolloWeatherPosition: Sun is facing a different direction`);
147
147
  return result;
148
148
  }
@@ -150,7 +150,7 @@ class WeatherService {
150
150
  logger(models_1.LogLevel.Trace, `RolloWeatherPosition: It´s cloudy now.`);
151
151
  }
152
152
  else if (this.willOutsideBeWarmer(26, logger)) {
153
- result = 30;
153
+ result = shutterSettings.heatReductionPosition;
154
154
  }
155
155
  if (result !== normalPos) {
156
156
  logger(models_1.LogLevel.Info, `weatherRolloPosition(${normalPos}, ${desiredTemperatur}, ${currentTemperatur}) --> Target: ${result}`);