hoffmation-base 1.1.18 → 1.1.20

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,5 +1,5 @@
1
- import { DeviceSettings } from './deviceSettings';
2
- export declare class LedSettings extends DeviceSettings {
1
+ import { DimmerSettings } from './dimmerSettings';
2
+ export declare class LedSettings extends DimmerSettings {
3
3
  defaultColor: string;
4
4
  dayOn: boolean;
5
5
  dayBrightness: number;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LedSettings = void 0;
4
- const deviceSettings_1 = require("./deviceSettings");
5
- class LedSettings extends deviceSettings_1.DeviceSettings {
4
+ const dimmerSettings_1 = require("./dimmerSettings");
5
+ class LedSettings extends dimmerSettings_1.DimmerSettings {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.defaultColor = '#fbbc32';
@@ -23,7 +23,7 @@ class LampenGroup extends base_group_1.BaseGroup {
23
23
  }
24
24
  }
25
25
  for (i = 0; i < this.getLED().length; i++) {
26
- if (this.getLED()[i].on) {
26
+ if (this.getLED()[i].actuatorOn) {
27
27
  return true;
28
28
  }
29
29
  }
@@ -126,7 +126,7 @@ class LampenGroup extends base_group_1.BaseGroup {
126
126
  }
127
127
  setAllLED(pValue, brightness = -1, color = '', colortemp = -1) {
128
128
  this.getLED().forEach((s) => {
129
- s.setLight(pValue, brightness, color, colortemp);
129
+ s.setLight(pValue, undefined, true, brightness, undefined, color, colortemp);
130
130
  });
131
131
  }
132
132
  setAllWled(pValue, brightness = -1, preset) {
@@ -32,9 +32,9 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
32
32
  get iLevel(): number;
33
33
  get sTemperatur(): string;
34
34
  get iTemperature(): number;
35
- protected _roomTemperatur: number;
36
- set roomTemperatur(val: number);
35
+ protected _roomTemperature: number;
37
36
  get roomTemperature(): number;
37
+ set roomTemperatur(val: number);
38
38
  checkAutomaticChange(): void;
39
39
  deleteAutomaticPoint(name: string): void;
40
40
  setAutomaticPoint(name: string, setting: TemperatureSettings): void;
@@ -33,7 +33,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
33
33
  });
34
34
  this._seasonTurnOff = false;
35
35
  this._humidity = 0;
36
- this._roomTemperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
36
+ this._roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
37
37
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
38
38
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
39
39
  this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
@@ -75,14 +75,14 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
75
75
  return this._temperatur;
76
76
  }
77
77
  else {
78
- return this._roomTemperatur;
78
+ return this._roomTemperature;
79
79
  }
80
80
  }
81
- set roomTemperatur(val) {
82
- this._roomTemperatur = val;
83
- }
84
81
  get roomTemperature() {
85
- return this._roomTemperatur;
82
+ return this._roomTemperature;
83
+ }
84
+ set roomTemperatur(val) {
85
+ this._roomTemperature = val;
86
86
  }
87
87
  checkAutomaticChange() {
88
88
  var _a, _b;
@@ -141,8 +141,8 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
141
141
  return 0;
142
142
  }
143
143
  this._pidController.setPoint(this.desiredTemperature);
144
- const newValue = this._pidController.calculate(this._roomTemperatur);
145
- this.log(models_1.LogLevel.Debug, `New PID Value ${newValue}% (cTemp: ${this._roomTemperatur}, dTemp: ${this.desiredTemperature})`);
144
+ const newValue = this._pidController.calculate(this._roomTemperature);
145
+ this.log(models_1.LogLevel.Debug, `New PID Value ${newValue}% (cTemp: ${this._roomTemperature}, dTemp: ${this.desiredTemperature})`);
146
146
  return newValue;
147
147
  }
148
148
  checkSeasonTurnOff() {
@@ -32,7 +32,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
32
32
  this.setMode(this.settings.controlByPid ? 1 : 2);
33
33
  }
34
34
  set roomTemperatur(value) {
35
- this._roomTemperatur = value;
35
+ this._roomTemperature = value;
36
36
  if (this.settings.controlByPid) {
37
37
  //TODO: Implement PID controlling
38
38
  return;
@@ -43,7 +43,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
43
43
  this.recalcLevel();
44
44
  }
45
45
  get roomTemperature() {
46
- return this._roomTemperatur;
46
+ return this._roomTemperature;
47
47
  }
48
48
  get desiredTemperature() {
49
49
  return this._desiredTemperatur;
@@ -127,7 +127,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
127
127
  return;
128
128
  }
129
129
  this._lastRecalc = services_1.Utils.nowMS();
130
- const desiredDiff = services_1.Utils.round(this.desiredTemperature - this._roomTemperatur, 1);
130
+ const desiredDiff = services_1.Utils.round(this.desiredTemperature - this._roomTemperature, 1);
131
131
  const currentDiff = this.tempDiff;
132
132
  const missingDiff = services_1.Utils.round(desiredDiff - currentDiff, 1);
133
133
  if (Math.abs(missingDiff) < 0.15) {
@@ -143,7 +143,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
143
143
  }
144
144
  const newLocalDiff = Math.sign(desiredDiff) * -9;
145
145
  this.setLocalDiff(newLocalDiff);
146
- this.setTargetTemperatur(this._temperatur + this._roomTemperatur + newLocalDiff + this.desiredTemperature);
146
+ this.setTargetTemperatur(this._temperatur + this._roomTemperature + newLocalDiff + this.desiredTemperature);
147
147
  }
148
148
  setLocalDiff(newLocalDiff) {
149
149
  this.log(models_1.LogLevel.Debug, `Setting new Local Calibration Diff (${newLocalDiff}) for Euro Valve`);
@@ -1,5 +1,6 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { DimmerSettings, TimeOfDay } from '../../../models';
3
+ import { DeviceType } from '../deviceType';
3
4
  import { ZigbeeDevice } from './BaseDevices';
4
5
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
6
  import { iDimmableLamp } from '../baseDeviceInterfaces/iDimmableLamp';
@@ -9,13 +10,13 @@ export declare class ZigbeeIlluDimmer extends ZigbeeDevice implements iDimmableL
9
10
  brightness: number;
10
11
  transitionTime: number;
11
12
  settings: DimmerSettings;
12
- private stateID;
13
- private brightnessID;
14
- private transitionID;
13
+ protected readonly stateID: string;
14
+ protected readonly brightnessID: string;
15
+ protected readonly transitionID: string;
15
16
  private _turnOffTimeout;
16
17
  private turnOffTime;
17
18
  private _lastPersist;
18
- constructor(pInfo: IoBrokerDeviceInfo);
19
+ constructor(pInfo: IoBrokerDeviceInfo, deviceType?: DeviceType);
19
20
  get actuatorOn(): boolean;
20
21
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
21
22
  setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
@@ -7,8 +7,8 @@ const services_1 = require("../../services");
7
7
  const BaseDevices_1 = require("./BaseDevices");
8
8
  const DeviceCapability_1 = require("../DeviceCapability");
9
9
  class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
10
- constructor(pInfo) {
11
- super(pInfo, deviceType_1.DeviceType.ZigbeeIlluDimmer);
10
+ constructor(pInfo, deviceType = deviceType_1.DeviceType.ZigbeeIlluDimmer) {
11
+ super(pInfo, deviceType);
12
12
  this.lightOn = false;
13
13
  this.queuedValue = null;
14
14
  this.brightness = 0;
@@ -1,21 +1,16 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { LedSettings, TimeOfDay } from '../../../models';
3
- import { ZigbeeDevice } from './BaseDevices';
4
3
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
- export declare class ZigbeeIlluLedRGBCCT extends ZigbeeDevice {
4
+ import { ZigbeeIlluDimmer } from './zigbeeIlluDimmer';
5
+ export declare class ZigbeeIlluLedRGBCCT extends ZigbeeIlluDimmer {
6
6
  static DEFAULT_COLOR_WARM: string;
7
- on: boolean;
8
- brightness: number;
9
7
  color: string;
10
8
  colortemp: number;
11
9
  settings: LedSettings;
12
- private stateID;
13
- private brightnessID;
14
10
  private colorID;
15
11
  private colorTempID;
16
12
  constructor(pInfo: IoBrokerDeviceInfo);
17
13
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
18
- setTimeBased(time: TimeOfDay): void;
19
- setLight(pValue: boolean, brightness?: number, color?: string, colortemp?: number): void;
20
- toggleLight(): boolean;
14
+ setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
15
+ setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): void;
21
16
  }
@@ -3,38 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZigbeeIlluLedRGBCCT = void 0;
4
4
  const deviceType_1 = require("../deviceType");
5
5
  const models_1 = require("../../../models");
6
- const BaseDevices_1 = require("./BaseDevices");
7
- class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeDevice {
6
+ const zigbeeIlluDimmer_1 = require("./zigbeeIlluDimmer");
7
+ class ZigbeeIlluLedRGBCCT extends zigbeeIlluDimmer_1.ZigbeeIlluDimmer {
8
8
  // private effectID: string = '';
9
9
  constructor(pInfo) {
10
10
  super(pInfo, deviceType_1.DeviceType.ZigbeeIlluLedRGBCCT);
11
- this.on = false;
12
- this.brightness = 0;
13
11
  this.color = '#fcba32';
14
12
  this.colortemp = 500;
15
13
  this.settings = new models_1.LedSettings();
16
- this.stateID = 'state';
17
- this.brightnessID = 'brightness';
18
14
  this.colorID = '';
19
15
  this.colorTempID = '';
20
- this.stateID = `${this.info.fullID}.state`;
21
- this.brightnessID = `${this.info.fullID}.brightness`;
22
16
  this.colorID = `${this.info.fullID}.color`;
23
17
  this.colorTempID = `${this.info.fullID}.colortemp`;
24
18
  // this.effectID = `${this.info.fullID}.effect`;
25
19
  }
26
20
  update(idSplit, state, initial = false) {
27
21
  this.log(models_1.LogLevel.DeepTrace, `LED Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
28
- super.update(idSplit, state, initial, true);
22
+ super.update(idSplit, state, initial);
29
23
  switch (idSplit[3]) {
30
- case 'state':
31
- this.log(models_1.LogLevel.Trace, `LED Update für ${this.info.customName} auf ${state.val}`);
32
- this.on = state.val;
33
- break;
34
- case 'brightness':
35
- this.log(models_1.LogLevel.Trace, `LED Helligkeit Update für ${this.info.customName} auf ${state.val}`);
36
- this.brightness = state.val;
37
- break;
38
24
  case 'color':
39
25
  this.log(models_1.LogLevel.Trace, `LED Color Update für ${this.info.customName} auf ${state.val}`);
40
26
  this.color = state.val;
@@ -45,31 +31,31 @@ class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeDevice {
45
31
  break;
46
32
  }
47
33
  }
48
- setTimeBased(time) {
34
+ setTimeBased(time, timeout = -1, force = false) {
49
35
  switch (time) {
50
36
  case models_1.TimeOfDay.Night:
51
37
  if (this.settings.nightOn) {
52
- this.setLight(true, this.settings.nightBrightness, this.settings.nightColor, this.settings.nightColorTemp);
38
+ this.setLight(true, timeout, force, this.settings.nightBrightness, undefined, this.settings.nightColor, this.settings.nightColorTemp);
53
39
  }
54
40
  break;
55
41
  case models_1.TimeOfDay.AfterSunset:
56
42
  if (this.settings.duskOn) {
57
- this.setLight(true, this.settings.duskBrightness, this.settings.duskColor, this.settings.duskColorTemp);
43
+ this.setLight(true, timeout, force, this.settings.duskBrightness, undefined, this.settings.duskColor, this.settings.duskColorTemp);
58
44
  }
59
45
  break;
60
46
  case models_1.TimeOfDay.BeforeSunrise:
61
47
  if (this.settings.dawnOn) {
62
- this.setLight(true, this.settings.dawnBrightness, this.settings.dawnColor, this.settings.dawnColorTemp);
48
+ this.setLight(true, timeout, force, this.settings.dawnBrightness, undefined, this.settings.dawnColor, this.settings.dawnColorTemp);
63
49
  }
64
50
  break;
65
51
  case models_1.TimeOfDay.Daylight:
66
52
  if (this.settings.dayOn) {
67
- this.setLight(true, this.settings.dayBrightness, this.settings.dayColor, this.settings.dayColorTemp);
53
+ this.setLight(true, timeout, force, this.settings.dayBrightness, undefined, this.settings.dayColor, this.settings.dayColorTemp);
68
54
  }
69
55
  break;
70
56
  }
71
57
  }
72
- setLight(pValue, brightness = -1, color = '', colortemp = -1) {
58
+ setLight(pValue, timeout, force, brightness = -1, transitionTime, color = '', colorTemp = -1) {
73
59
  if (this.stateID === '') {
74
60
  this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
75
61
  return;
@@ -81,7 +67,8 @@ class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeDevice {
81
67
  if (pValue && brightness === -1 && this.brightness < 10) {
82
68
  brightness = 10;
83
69
  }
84
- this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colortemp}`);
70
+ this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
71
+ super.setLight(pValue, timeout, force, brightness, transitionTime);
85
72
  if (color !== '') {
86
73
  this.ioConn.setState(this.colorID, color, (err) => {
87
74
  if (err) {
@@ -89,8 +76,8 @@ class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeDevice {
89
76
  }
90
77
  });
91
78
  }
92
- if (colortemp > -1) {
93
- this.ioConn.setState(this.colorTempID, colortemp, (err) => {
79
+ if (colorTemp > -1) {
80
+ this.ioConn.setState(this.colorTempID, colorTemp, (err) => {
94
81
  if (err) {
95
82
  this.log(models_1.LogLevel.Error, `LED Farbwärme schalten ergab Fehler: ${err}`);
96
83
  }
@@ -101,18 +88,6 @@ class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeDevice {
101
88
  this.log(models_1.LogLevel.Error, `LED schalten ergab Fehler: ${err}`);
102
89
  }
103
90
  });
104
- if (brightness > -1) {
105
- this.ioConn.setState(this.brightnessID, brightness, (err) => {
106
- if (err) {
107
- this.log(models_1.LogLevel.Error, `LED Helligkeit schalten ergab Fehler: ${err}`);
108
- }
109
- });
110
- }
111
- }
112
- toggleLight() {
113
- const newVal = !this.on;
114
- this.setLight(newVal);
115
- return newVal;
116
91
  }
117
92
  }
118
93
  exports.ZigbeeIlluLedRGBCCT = ZigbeeIlluLedRGBCCT;
@@ -10,8 +10,8 @@ export declare class ZigbeeTuyaValve extends ZigbeeHeater {
10
10
  private _mode;
11
11
  constructor(pInfo: IoBrokerDeviceInfo);
12
12
  set seasonTurnOff(value: boolean);
13
- set roomTemperatur(value: number);
14
13
  get roomTemperatur(): number;
14
+ set roomTemperatur(value: number);
15
15
  set desiredTemperature(val: number);
16
16
  private get tempDiff();
17
17
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
@@ -21,16 +21,16 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
21
21
  this._seasonTurnOff = value;
22
22
  this.setMode(value ? 'off' : 'auto');
23
23
  }
24
+ get roomTemperatur() {
25
+ return this._roomTemperature;
26
+ }
24
27
  set roomTemperatur(value) {
25
- this._roomTemperatur = value;
28
+ this._roomTemperature = value;
26
29
  if (this.settings.useOwnTemperatur) {
27
30
  return;
28
31
  }
29
32
  this.checkTempDiff();
30
33
  }
31
- get roomTemperatur() {
32
- return this._roomTemperatur;
33
- }
34
34
  set desiredTemperature(val) {
35
35
  this._desiredTemperatur = val;
36
36
  this.checkTempDiff();
@@ -76,7 +76,7 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
76
76
  if (this.settings.useOwnTemperatur) {
77
77
  return;
78
78
  }
79
- const desiredDiff = services_1.Utils.round(this.desiredTemperature - this._roomTemperatur, 1);
79
+ const desiredDiff = services_1.Utils.round(this.desiredTemperature - this._roomTemperature, 1);
80
80
  const currentDiff = this.tempDiff;
81
81
  const missingDiff = services_1.Utils.round(desiredDiff - currentDiff, 1);
82
82
  if (Math.abs(missingDiff) < 0.15) {
@@ -92,7 +92,7 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
92
92
  }
93
93
  const newLocalDiff = Math.sign(desiredDiff) * -9;
94
94
  this.setLocalDiff(newLocalDiff);
95
- this.setTargetTemperatur(this._localTempVal + this._roomTemperatur + newLocalDiff + this.desiredTemperature);
95
+ this.setTargetTemperatur(this._localTempVal + this._roomTemperature + newLocalDiff + this.desiredTemperature);
96
96
  }
97
97
  setLocalDiff(newLocalDiff) {
98
98
  this.log(models_1.LogLevel.Debug, `Setting new Local Calibration Diff (${newLocalDiff}) for Tuya Valve`);
@@ -14,10 +14,10 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
14
14
  room: RoomBase | undefined;
15
15
  deviceCapabilities: DeviceCapability[];
16
16
  protected _info: DeviceInfo;
17
- get roomTemperature(): number;
18
- protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType);
19
17
  get temperature(): number;
20
- private _roomTemperatur;
18
+ protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType);
19
+ private _roomTemperature;
20
+ get roomTemperature(): number;
21
21
  get info(): DeviceInfo;
22
22
  protected set roomTemperatur(val: number);
23
23
  set info(info: DeviceInfo);
@@ -22,7 +22,7 @@ class AcDevice {
22
22
  this.energyConsumerSettings = new models_1.ExcessEnergyConsumerSettings();
23
23
  this.acSettings = new acSettings_1.AcSettings();
24
24
  this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.ac];
25
- this._roomTemperatur = 0;
25
+ this._roomTemperature = 0;
26
26
  this._activatedByExcessEnergy = false;
27
27
  this._blockAutomaticTurnOnMS = -1;
28
28
  this._info = new devices_1.DeviceInfo();
@@ -34,17 +34,17 @@ class AcDevice {
34
34
  utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
35
35
  this.persistDeviceInfo();
36
36
  }
37
- get roomTemperature() {
38
- return this._roomTemperatur;
39
- }
40
37
  get temperature() {
41
- return this._roomTemperatur;
38
+ return this._roomTemperature;
39
+ }
40
+ get roomTemperature() {
41
+ return this._roomTemperature;
42
42
  }
43
43
  get info() {
44
44
  return this._info;
45
45
  }
46
46
  set roomTemperatur(val) {
47
- this._roomTemperatur = val;
47
+ this._roomTemperature = val;
48
48
  }
49
49
  set info(info) {
50
50
  this._info = info;