hoffmation-base 0.1.39 → 0.1.41-3

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.
@@ -3,4 +3,15 @@ export declare class ActuatorSettings extends DeviceSettings {
3
3
  dawnOn: boolean;
4
4
  duskOn: boolean;
5
5
  nightOn: boolean;
6
+ /**
7
+ * Indicates if this device controls e.g. an Eltako, which has it's own Turn Off Time logic.
8
+ * @type {boolean}
9
+ */
10
+ isStromStoss: boolean;
11
+ /**
12
+ * If this is an Actuator controling a time based relais,
13
+ * this indicates the time after which we retrigger the relais.
14
+ * @type {number}
15
+ */
16
+ stromStossResendTime: number;
6
17
  }
@@ -8,6 +8,17 @@ class ActuatorSettings extends deviceSettings_1.DeviceSettings {
8
8
  this.dawnOn = true;
9
9
  this.duskOn = true;
10
10
  this.nightOn = true;
11
+ /**
12
+ * Indicates if this device controls e.g. an Eltako, which has it's own Turn Off Time logic.
13
+ * @type {boolean}
14
+ */
15
+ this.isStromStoss = false;
16
+ /**
17
+ * If this is an Actuator controling a time based relais,
18
+ * this indicates the time after which we retrigger the relais.
19
+ * @type {number}
20
+ */
21
+ this.stromStossResendTime = 180;
11
22
  }
12
23
  }
13
24
  exports.ActuatorSettings = ActuatorSettings;
@@ -1,6 +1,6 @@
1
- import { deviceConfig } from '../../models/deviceConfig';
1
+ import { deviceConfig } from '../../models';
2
2
  import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
3
- import { iRoomImportEnforcer } from '../../models/rooms/iRoomImportEnforcer';
3
+ import { iRoomImportEnforcer } from '../../models';
4
4
  import { iEnergyManager } from './iEnergyManager';
5
5
  export declare class Devices {
6
6
  static IDENTIFIER_HOMEMATIC: string;
@@ -15,8 +15,8 @@ export declare class Devices {
15
15
  }, pRoomImportEnforcer?: iRoomImportEnforcer);
16
16
  static midnightReset(): void;
17
17
  static resetPraesenzCount(): void;
18
- private processZigbeeDevice;
19
- private processHMIPDevice;
18
+ private static processZigbeeDevice;
19
+ private static processHMIPDevice;
20
20
  static getBatteryInfo(): string;
21
- private createEnergyManager;
21
+ private static createEnergyManager;
22
22
  }
@@ -1,46 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Devices = void 0;
4
- const hmIpDevice_1 = require("./hmIPDevices/hmIpDevice");
5
- const zigbeeDevice_1 = require("./zigbee/zigbeeDevice");
4
+ const hmIPDevices_1 = require("./hmIPDevices");
5
+ const zigbee_1 = require("./zigbee");
6
6
  const deviceType_1 = require("./deviceType");
7
- const hmIpPraezenz_1 = require("./hmIPDevices/hmIpPraezenz");
8
- const log_service_1 = require("../services/log-service/log-service");
7
+ const hmIPDevices_2 = require("./hmIPDevices");
8
+ const services_1 = require("../services");
9
9
  const DeviceInfo_1 = require("./DeviceInfo");
10
- const logLevel_1 = require("../../models/logLevel");
11
- const hmIpBewegung_1 = require("./hmIPDevices/hmIpBewegung");
12
- const zigbeeAquaraVibra_1 = require("./zigbee/zigbeeAquaraVibra");
13
- const zigbeeAquaraMotion_1 = require("./zigbee/zigbeeAquaraMotion");
14
- const zigbeeIkeaSteckdose_1 = require("./zigbee/zigbeeIkeaSteckdose");
15
- const zigbeeIlluLedRGBCCT_1 = require("./zigbee/zigbeeIlluLedRGBCCT");
16
- const zigbeeIlluDimmer_1 = require("./zigbee/zigbeeIlluDimmer");
17
- const zigbeeHeimanSmoke_1 = require("./zigbee/zigbeeHeimanSmoke");
18
- const zigbeeAquaraWater_1 = require("./zigbee/zigbeeAquaraWater");
19
- const zigbeeBlitzShp_1 = require("./zigbee/zigbeeBlitzShp");
20
- const zigbeeIlluLampe_1 = require("./zigbee/zigbeeIlluLampe");
21
- const zigbeeIlluActuator_1 = require("./zigbee/zigbeeIlluActuator");
22
- const hmIpLampe_1 = require("./hmIPDevices/hmIpLampe");
23
- const hmIpRoll_1 = require("./hmIPDevices/hmIpRoll");
24
- const hmIpTaster_1 = require("./hmIPDevices/hmIpTaster");
25
- const hmIpWippe_1 = require("./hmIPDevices/hmIpWippe");
26
- const hmIpGriff_1 = require("./hmIPDevices/hmIpGriff");
27
- const hmIpTherm_1 = require("./hmIPDevices/hmIpTherm");
28
- const hmIpHeizung_1 = require("./hmIPDevices/hmIpHeizung");
29
- const hmIpTuer_1 = require("./hmIPDevices/hmIpTuer");
30
- const hmIpHeizgruppe_1 = require("./hmIPDevices/hmIpHeizgruppe");
31
- const zigbeeIlluShutter_1 = require("./zigbee/zigbeeIlluShutter");
32
- const zigbeeSMaBiTMagnetContact_1 = require("./zigbee/zigbeeSMaBiTMagnetContact");
33
- const zigbeeSonoffMotion_1 = require("./zigbee/zigbeeSonoffMotion");
34
- const hmIpAccessPoint_1 = require("./hmIPDevices/hmIpAccessPoint");
35
- const zigbeeAqaraMagnetContact_1 = require("./zigbee/zigbeeAqaraMagnetContact");
36
- const zigbeeSonoffTemp_1 = require("./zigbee/zigbeeSonoffTemp");
37
- const zigbeeAqaraOpple3Switch_1 = require("./zigbee/zigbeeAqaraOpple3Switch");
38
- const jsObjectEnergyManager_1 = require("./jsObject/jsObjectEnergyManager");
10
+ const models_1 = require("../../models");
11
+ const hmIPDevices_3 = require("./hmIPDevices");
12
+ const zigbee_2 = require("./zigbee");
13
+ const zigbee_3 = require("./zigbee");
14
+ const zigbee_4 = require("./zigbee");
15
+ const zigbee_5 = require("./zigbee");
16
+ const zigbee_6 = require("./zigbee");
17
+ const zigbee_7 = require("./zigbee");
18
+ const zigbee_8 = require("./zigbee");
19
+ const zigbee_9 = require("./zigbee");
20
+ const zigbee_10 = require("./zigbee");
21
+ const zigbee_11 = require("./zigbee");
22
+ const hmIPDevices_4 = require("./hmIPDevices");
23
+ const hmIPDevices_5 = require("./hmIPDevices");
24
+ const hmIPDevices_6 = require("./hmIPDevices");
25
+ const hmIPDevices_7 = require("./hmIPDevices");
26
+ const hmIPDevices_8 = require("./hmIPDevices");
27
+ const hmIPDevices_9 = require("./hmIPDevices");
28
+ const hmIPDevices_10 = require("./hmIPDevices");
29
+ const hmIPDevices_11 = require("./hmIPDevices");
30
+ const hmIPDevices_12 = require("./hmIPDevices");
31
+ const zigbee_12 = require("./zigbee");
32
+ const zigbee_13 = require("./zigbee");
33
+ const zigbee_14 = require("./zigbee");
34
+ const hmIPDevices_13 = require("./hmIPDevices");
35
+ const zigbee_15 = require("./zigbee");
36
+ const zigbee_16 = require("./zigbee");
37
+ const zigbee_17 = require("./zigbee");
38
+ const jsObject_1 = require("./jsObject");
39
39
  class Devices {
40
40
  constructor(pDeviceData, pRoomImportEnforcer) {
41
41
  // This forces import of rooms at correct timing, to allow devices to land in proper rooms.
42
42
  pRoomImportEnforcer === null || pRoomImportEnforcer === void 0 ? void 0 : pRoomImportEnforcer.addRoomConstructor();
43
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Constructing devices now`);
43
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Constructing devices now`);
44
44
  for (const cID in pDeviceData) {
45
45
  const cDevConf = pDeviceData[cID];
46
46
  if (!cDevConf.common ||
@@ -52,159 +52,159 @@ class Devices {
52
52
  }
53
53
  const cName = cDevConf.common.name;
54
54
  if (cName.indexOf('00-HmIP') === 0) {
55
- this.processHMIPDevice(cDevConf);
55
+ Devices.processHMIPDevice(cDevConf);
56
56
  }
57
57
  else if (cName.indexOf('00-Zigbee') === 0) {
58
- this.processZigbeeDevice(cDevConf);
58
+ Devices.processZigbeeDevice(cDevConf);
59
59
  }
60
60
  else if (cName.indexOf('00-EnergyManager') === 0) {
61
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Found Energy-Manager in Device json.`);
62
- this.createEnergyManager(cDevConf);
61
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Found Energy-Manager in Device json.`);
62
+ Devices.createEnergyManager(cDevConf);
63
63
  }
64
64
  }
65
- hmIpDevice_1.HmIPDevice.checkMissing();
66
- zigbeeDevice_1.ZigbeeDevice.checkMissing();
65
+ hmIPDevices_1.HmIPDevice.checkMissing();
66
+ zigbee_1.ZigbeeDevice.checkMissing();
67
67
  }
68
68
  static midnightReset() {
69
69
  // Nothing yet
70
70
  }
71
71
  static resetPraesenzCount() {
72
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `3 Uhr Reset der Präsenzmelder`);
72
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Info, `3 Uhr Reset der Präsenzmelder`);
73
73
  for (const dID in Devices.alLDevices) {
74
74
  const d = Devices.alLDevices[dID];
75
75
  if (d.deviceType === deviceType_1.DeviceType.HmIpPraezenz) {
76
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
76
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
77
77
  d.detectionsToday = 0;
78
78
  }
79
79
  else if (d.deviceType === deviceType_1.DeviceType.HmIpBewegung) {
80
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
80
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
81
81
  d.detectionsToday = 0;
82
82
  }
83
83
  else if (d.deviceType === deviceType_1.DeviceType.ZigbeeSonoffMotion || d.deviceType === deviceType_1.DeviceType.ZigbeeAquaraMotion) {
84
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
84
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `2 Uhr Reset der Tages Detektionen von ${d.info.customName}`);
85
85
  d.detectionsToday = 0;
86
86
  }
87
87
  }
88
88
  }
89
- processZigbeeDevice(cDevConf) {
89
+ static processZigbeeDevice(cDevConf) {
90
90
  const zigbeeInfo = new DeviceInfo_1.DeviceInfo(cDevConf);
91
91
  const fullName = `${Devices.IDENTIFIER_ZIGBEE}-${zigbeeInfo.devID}`;
92
92
  zigbeeInfo.allDevicesKey = fullName;
93
93
  if (typeof Devices.alLDevices[fullName] !== 'undefined') {
94
94
  return;
95
95
  }
96
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Trace, `${zigbeeInfo.devID} with Type "${zigbeeInfo.deviceType}" doesn't exists --> create it`);
96
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `${zigbeeInfo.devID} with Type "${zigbeeInfo.deviceType}" doesn't exists --> create it`);
97
97
  let d;
98
98
  switch (zigbeeInfo.deviceType) {
99
99
  case 'AqaraMagnetContact':
100
- d = new zigbeeAqaraMagnetContact_1.ZigbeeAqaraMagnetContact(zigbeeInfo);
100
+ d = new zigbee_15.ZigbeeAqaraMagnetContact(zigbeeInfo);
101
101
  break;
102
102
  case 'AqaraOpple3Switch':
103
- d = new zigbeeAqaraOpple3Switch_1.ZigbeeAqaraOpple3Switch(zigbeeInfo);
103
+ d = new zigbee_17.ZigbeeAqaraOpple3Switch(zigbeeInfo);
104
104
  break;
105
105
  case 'AquaraMotion':
106
- d = new zigbeeAquaraMotion_1.ZigbeeAquaraMotion(zigbeeInfo);
106
+ d = new zigbee_3.ZigbeeAquaraMotion(zigbeeInfo);
107
107
  break;
108
108
  case 'AquaraVibra':
109
- d = new zigbeeAquaraVibra_1.ZigbeeAquaraVibra(zigbeeInfo);
109
+ d = new zigbee_2.ZigbeeAquaraVibra(zigbeeInfo);
110
110
  break;
111
111
  case 'AquaraWater':
112
- d = new zigbeeAquaraWater_1.ZigbeeAquaraWater(zigbeeInfo);
112
+ d = new zigbee_8.ZigbeeAquaraWater(zigbeeInfo);
113
113
  break;
114
114
  case 'BlitzShp':
115
- d = new zigbeeBlitzShp_1.ZigbeeBlitzShp(zigbeeInfo);
115
+ d = new zigbee_9.ZigbeeBlitzShp(zigbeeInfo);
116
116
  break;
117
117
  case 'HeimanSmoke':
118
- d = new zigbeeHeimanSmoke_1.ZigbeeHeimanSmoke(zigbeeInfo);
118
+ d = new zigbee_7.ZigbeeHeimanSmoke(zigbeeInfo);
119
119
  break;
120
120
  case 'IkeaStecker':
121
- d = new zigbeeIkeaSteckdose_1.ZigbeeIkeaSteckdose(zigbeeInfo);
121
+ d = new zigbee_4.ZigbeeIkeaSteckdose(zigbeeInfo);
122
122
  break;
123
123
  case 'IlluActuator':
124
- d = new zigbeeIlluActuator_1.ZigbeeIlluActuator(zigbeeInfo);
124
+ d = new zigbee_11.ZigbeeIlluActuator(zigbeeInfo);
125
125
  break;
126
126
  case 'IlluDimmer':
127
- d = new zigbeeIlluDimmer_1.ZigbeeIlluDimmer(zigbeeInfo);
127
+ d = new zigbee_6.ZigbeeIlluDimmer(zigbeeInfo);
128
128
  break;
129
129
  case 'IlluLampe':
130
- d = new zigbeeIlluLampe_1.ZigbeeIlluLampe(zigbeeInfo);
130
+ d = new zigbee_10.ZigbeeIlluLampe(zigbeeInfo);
131
131
  break;
132
132
  case 'IlluShutter':
133
- d = new zigbeeIlluShutter_1.ZigbeeIlluShutter(zigbeeInfo);
133
+ d = new zigbee_12.ZigbeeIlluShutter(zigbeeInfo);
134
134
  break;
135
135
  case 'LedRGBCCT':
136
- d = new zigbeeIlluLedRGBCCT_1.ZigbeeIlluLedRGBCCT(zigbeeInfo);
136
+ d = new zigbee_5.ZigbeeIlluLedRGBCCT(zigbeeInfo);
137
137
  break;
138
138
  case 'SMaBiTMagnet':
139
- d = new zigbeeSMaBiTMagnetContact_1.ZigbeeSMaBiTMagnetContact(zigbeeInfo);
139
+ d = new zigbee_13.ZigbeeSMaBiTMagnetContact(zigbeeInfo);
140
140
  break;
141
141
  case 'SonoffMotion':
142
- d = new zigbeeSonoffMotion_1.ZigbeeSonoffMotion(zigbeeInfo);
142
+ d = new zigbee_14.ZigbeeSonoffMotion(zigbeeInfo);
143
143
  break;
144
144
  case 'SonoffTemp':
145
- d = new zigbeeSonoffTemp_1.ZigbeeSonoffTemp(zigbeeInfo);
145
+ d = new zigbee_16.ZigbeeSonoffTemp(zigbeeInfo);
146
146
  break;
147
147
  default:
148
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Warn, `No zigbee Device Type for ${zigbeeInfo.deviceType} defined`);
149
- d = new zigbeeDevice_1.ZigbeeDevice(zigbeeInfo, deviceType_1.DeviceType.unknown);
148
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `No zigbee Device Type for ${zigbeeInfo.deviceType} defined`);
149
+ d = new zigbee_1.ZigbeeDevice(zigbeeInfo, deviceType_1.DeviceType.unknown);
150
150
  }
151
151
  Devices.alLDevices[fullName] = d;
152
152
  }
153
- processHMIPDevice(cDevConf) {
153
+ static processHMIPDevice(cDevConf) {
154
154
  const hmIPInfo = new DeviceInfo_1.DeviceInfo(cDevConf);
155
155
  const fullName = `${Devices.IDENTIFIER_HOMEMATIC}-${hmIPInfo.devID}`;
156
156
  hmIPInfo.allDevicesKey = fullName;
157
157
  if (typeof Devices.alLDevices[fullName] !== 'undefined') {
158
158
  return;
159
159
  }
160
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Trace, `${hmIPInfo.devID} with Type "${hmIPInfo.deviceType}" doesn't exists --> create it`);
160
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `${hmIPInfo.devID} with Type "${hmIPInfo.deviceType}" doesn't exists --> create it`);
161
161
  let d;
162
162
  switch (hmIPInfo.deviceType) {
163
163
  case 'Lampe':
164
- d = new hmIpLampe_1.HmIpLampe(hmIPInfo);
164
+ d = new hmIPDevices_4.HmIpLampe(hmIPInfo);
165
165
  break;
166
166
  case 'Roll':
167
167
  case 'Broll':
168
- d = new hmIpRoll_1.HmIpRoll(hmIPInfo);
168
+ d = new hmIPDevices_5.HmIpRoll(hmIPInfo);
169
169
  break;
170
170
  case 'Beweg':
171
- d = new hmIpBewegung_1.HmIpBewegung(hmIPInfo);
171
+ d = new hmIPDevices_3.HmIpBewegung(hmIPInfo);
172
172
  break;
173
173
  case 'Taster':
174
- d = new hmIpTaster_1.HmIpTaster(hmIPInfo);
174
+ d = new hmIPDevices_6.HmIpTaster(hmIPInfo);
175
175
  break;
176
176
  case 'Wippe':
177
- d = new hmIpWippe_1.HmIpWippe(hmIPInfo);
177
+ d = new hmIPDevices_7.HmIpWippe(hmIPInfo);
178
178
  break;
179
179
  case 'Praezenz':
180
- d = new hmIpPraezenz_1.HmIpPraezenz(hmIPInfo);
180
+ d = new hmIPDevices_2.HmIpPraezenz(hmIPInfo);
181
181
  break;
182
182
  case 'Griff':
183
- d = new hmIpGriff_1.HmIpGriff(hmIPInfo);
183
+ d = new hmIPDevices_8.HmIpGriff(hmIPInfo);
184
184
  break;
185
185
  case 'Thermostat':
186
- d = new hmIpTherm_1.HmIpTherm(hmIPInfo);
186
+ d = new hmIPDevices_9.HmIpTherm(hmIPInfo);
187
187
  break;
188
188
  case 'Heizung':
189
- d = new hmIpHeizung_1.HmIpHeizung(hmIPInfo);
189
+ d = new hmIPDevices_10.HmIpHeizung(hmIPInfo);
190
190
  break;
191
191
  case 'Tuer':
192
- d = new hmIpTuer_1.HmIpTuer(hmIPInfo);
192
+ d = new hmIPDevices_11.HmIpTuer(hmIPInfo);
193
193
  break;
194
194
  case 'HeizGr':
195
- d = new hmIpHeizgruppe_1.HmIpHeizgruppe(hmIPInfo);
195
+ d = new hmIPDevices_12.HmIpHeizgruppe(hmIPInfo);
196
196
  break;
197
197
  case 'AccessPoint':
198
- d = new hmIpAccessPoint_1.HmIpAccessPoint(hmIPInfo);
198
+ d = new hmIPDevices_13.HmIpAccessPoint(hmIPInfo);
199
199
  break;
200
200
  default:
201
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Warn, `No HmIP Device Type for ${hmIPInfo.deviceType} defined`);
202
- d = new hmIpDevice_1.HmIPDevice(hmIPInfo, deviceType_1.DeviceType.unknown);
201
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `No HmIP Device Type for ${hmIPInfo.deviceType} defined`);
202
+ d = new hmIPDevices_1.HmIPDevice(hmIPInfo, deviceType_1.DeviceType.unknown);
203
203
  }
204
204
  Devices.alLDevices[fullName] = d;
205
205
  }
206
206
  static getBatteryInfo() {
207
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Getting Battery Info`);
207
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Getting Battery Info`);
208
208
  let data = [];
209
209
  const result = [
210
210
  `These are the battery values for each device. Device dependandt some are in volts, some in %`,
@@ -223,11 +223,11 @@ class Devices {
223
223
  }
224
224
  return result.join('\n');
225
225
  }
226
- createEnergyManager(cDevConf) {
226
+ static createEnergyManager(cDevConf) {
227
227
  const devInfo = new DeviceInfo_1.DeviceInfo(cDevConf, true);
228
228
  const fullName = `${Devices.IDENTIFIER_JS}-${devInfo.devID}`;
229
229
  devInfo.allDevicesKey = fullName;
230
- Devices.energymanager = new jsObjectEnergyManager_1.JsObjectEnergyManager(devInfo);
230
+ Devices.energymanager = new jsObject_1.JsObjectEnergyManager(devInfo);
231
231
  Devices.alLDevices[fullName] = Devices.energymanager;
232
232
  }
233
233
  }
@@ -1,6 +1,6 @@
1
- import { ZigbeeIkeaSteckdose } from '../zigbee/zigbeeIkeaSteckdose';
2
- import { TimeOfDay } from '../../services/time-callback-service';
3
- import { ZigbeeIlluLedRGBCCT } from '../zigbee/zigbeeIlluLedRGBCCT';
1
+ import { ZigbeeIkeaSteckdose } from '../zigbee';
2
+ import { TimeOfDay } from '../../services';
3
+ import { ZigbeeIlluLedRGBCCT } from '../zigbee';
4
4
  import { BaseGroup } from './base-group';
5
5
  import { iLamp } from '../iLamp';
6
6
  export declare class LampenGroup extends BaseGroup {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LampenGroup = void 0;
4
- const time_callback_service_1 = require("../../services/time-callback-service");
4
+ const services_1 = require("../../services");
5
5
  const base_group_1 = require("./base-group");
6
6
  const group_type_1 = require("./group-type");
7
7
  const device_cluster_type_1 = require("../device-cluster-type");
8
8
  const device_list_1 = require("../device-list");
9
- const logLevel_1 = require("../../../models/logLevel");
9
+ const models_1 = require("../../../models");
10
10
  class LampenGroup extends base_group_1.BaseGroup {
11
11
  constructor(roomName, lampenIds = [], steckerIds = [], ledIds = []) {
12
12
  super(roomName, group_type_1.GroupType.Light);
@@ -50,21 +50,21 @@ class LampenGroup extends base_group_1.BaseGroup {
50
50
  });
51
51
  }
52
52
  switchTimeConditional(time) {
53
- const darkOutside = time_callback_service_1.TimeCallbackService.darkOutsideOrNight(time);
53
+ const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(time);
54
54
  let resultLampen = false;
55
55
  let resultSteckdosen = false;
56
56
  if (this.getLED().length > 0) {
57
- this.log(logLevel_1.LogLevel.Trace, `Set LEDs time based for time "${time_callback_service_1.TimeOfDay[time]}"`);
57
+ this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${services_1.TimeOfDay[time]}"`);
58
58
  this.getLED().forEach((s) => {
59
59
  s.setTimeBased(time);
60
60
  });
61
61
  }
62
62
  else if (this.getStecker().length > 0) {
63
- this.log(logLevel_1.LogLevel.Trace, `Set outlets time based for time "${time_callback_service_1.TimeOfDay[time]}"`);
63
+ this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${services_1.TimeOfDay[time]}"`);
64
64
  resultSteckdosen = darkOutside;
65
65
  }
66
66
  else {
67
- this.log(logLevel_1.LogLevel.Trace, `Set Lamps time based for time "${time_callback_service_1.TimeOfDay[time]}"`);
67
+ this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${services_1.TimeOfDay[time]}"`);
68
68
  resultLampen = darkOutside;
69
69
  }
70
70
  this.setAllLampen(resultLampen, time);
@@ -74,12 +74,12 @@ class LampenGroup extends base_group_1.BaseGroup {
74
74
  this.getLampen().forEach((s) => {
75
75
  if (!pValue ||
76
76
  time === undefined ||
77
- (time === time_callback_service_1.TimeOfDay.Night && s.settings.nightOn) ||
78
- (time === time_callback_service_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
79
- (time === time_callback_service_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
77
+ (time === services_1.TimeOfDay.Night && s.settings.nightOn) ||
78
+ (time === services_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
79
+ (time === services_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
80
80
  const timeout = pValue && force ? 30 * 60 * 1000 : -1;
81
81
  if (pValue && time !== undefined) {
82
- s.setTimeBased(time);
82
+ s.setTimeBased(time, timeout, force);
83
83
  }
84
84
  else {
85
85
  s.setLight(pValue, timeout, force);
@@ -91,9 +91,9 @@ class LampenGroup extends base_group_1.BaseGroup {
91
91
  this.getStecker().forEach((s) => {
92
92
  if (!pValue ||
93
93
  time === undefined ||
94
- (time === time_callback_service_1.TimeOfDay.Night && s.settings.nightOn) ||
95
- (time === time_callback_service_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
96
- (time === time_callback_service_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
94
+ (time === services_1.TimeOfDay.Night && s.settings.nightOn) ||
95
+ (time === services_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
96
+ (time === services_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
97
97
  const timeout = pValue && force ? 30 * 60 * 1000 : -1;
98
98
  s.setStecker(pValue, timeout, force);
99
99
  }
@@ -1,29 +1,20 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
- import { ActuatorSettings } from '../../../models/deviceSettings/actuatorSettings';
3
+ import { ActuatorSettings } from '../../../models';
4
4
  import { DeviceInfo } from '../DeviceInfo';
5
5
  import { iLamp } from '../iLamp';
6
- import { TimeOfDay } from '../../services/time-callback-service';
6
+ import { TimeOfDay } from '../../services';
7
7
  export declare class HmIpLampe extends HmIPDevice implements iLamp {
8
8
  lightOn: boolean;
9
9
  queuedLightValue: boolean | null;
10
- isStromStoss: boolean;
11
10
  settings: ActuatorSettings;
12
11
  private lightOnSwitchID;
13
12
  private _turnOffTimeout;
14
13
  private turnOffTime;
15
14
  constructor(pInfo: DeviceInfo);
16
15
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
17
- /**
18
- * This function thats the light to a specific value
19
- * @param pValue The desired value
20
- * @param timeout A chosen Timeout after which the light should be reset
21
- */
16
+ /** @inheritdoc */
22
17
  setLight(pValue: boolean, timeout?: number, force?: boolean): void;
23
- /**
24
- * Switch the current condition of the light
25
- * @param force Whether this is a forcing action skipping delays and locks
26
- */
27
- toggleLight(force?: boolean): boolean;
28
- setTimeBased(time: TimeOfDay): void;
18
+ toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
19
+ setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
29
20
  }
@@ -3,24 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpLampe = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const utils_1 = require("../../services/utils/utils");
7
- const actuatorSettings_1 = require("../../../models/deviceSettings/actuatorSettings");
8
- const logLevel_1 = require("../../../models/logLevel");
9
- const time_callback_service_1 = require("../../services/time-callback-service");
6
+ const services_1 = require("../../services");
7
+ const models_1 = require("../../../models");
8
+ const models_2 = require("../../../models");
9
+ const services_2 = require("../../services");
10
10
  class HmIpLampe extends hmIpDevice_1.HmIPDevice {
11
11
  constructor(pInfo) {
12
12
  super(pInfo, deviceType_1.DeviceType.HmIpLampe);
13
13
  this.lightOn = false;
14
14
  this.queuedLightValue = null;
15
- this.isStromStoss = false;
16
- this.settings = new actuatorSettings_1.ActuatorSettings();
15
+ this.settings = new models_1.ActuatorSettings();
17
16
  this.lightOnSwitchID = '';
18
17
  this._turnOffTimeout = undefined;
19
18
  this.turnOffTime = 0;
20
19
  this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
21
20
  }
22
21
  update(idSplit, state, initial = false) {
23
- this.log(logLevel_1.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
22
+ this.log(models_2.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
24
23
  super.update(idSplit, state, initial, true);
25
24
  this.queuedLightValue = null;
26
25
  switch (idSplit[3]) {
@@ -31,31 +30,33 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
31
30
  break;
32
31
  }
33
32
  }
34
- /**
35
- * This function thats the light to a specific value
36
- * @param pValue The desired value
37
- * @param timeout A chosen Timeout after which the light should be reset
38
- */
33
+ /** @inheritdoc */
39
34
  setLight(pValue, timeout = -1, force = false) {
40
35
  if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
41
- this.log(logLevel_1.LogLevel.DeepTrace, `Skip light command as it is already ${pValue}`);
36
+ this.log(models_2.LogLevel.DeepTrace, `Skip light command as it is already ${pValue}`);
42
37
  return;
43
38
  }
44
39
  if (this.lightOnSwitchID === '') {
45
- this.log(logLevel_1.LogLevel.Error, `Keine Switch ID bekannt.`);
40
+ this.log(models_2.LogLevel.Error, `Keine Switch ID bekannt.`);
46
41
  return;
47
42
  }
48
- if (!force && utils_1.Utils.nowMS() < this.turnOffTime) {
49
- this.log(logLevel_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleString()}`);
43
+ if (!force && services_1.Utils.nowMS() < this.turnOffTime) {
44
+ this.log(models_2.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleString()}`);
50
45
  return;
51
46
  }
52
- this.log(logLevel_1.LogLevel.Debug, `Lampe schalten Wert: ${pValue}`);
47
+ this.log(models_2.LogLevel.Debug, `Lampe schalten Wert: ${pValue}`);
53
48
  this.setState(this.lightOnSwitchID, pValue, undefined, (err) => {
54
- this.log(logLevel_1.LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
49
+ this.log(models_2.LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
55
50
  });
56
51
  this.queuedLightValue = pValue;
57
- if (this.isStromStoss) {
58
- timeout = 5000;
52
+ if (this.settings.isStromStoss) {
53
+ timeout = 3000;
54
+ services_1.Utils.guardedTimeout(() => {
55
+ var _a;
56
+ if (this.room && ((_a = this.room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
57
+ this.setLight(true, -1, true);
58
+ }
59
+ }, this.settings.stromStossResendTime * 1000, this);
59
60
  }
60
61
  if (this._turnOffTimeout !== undefined) {
61
62
  clearTimeout(this._turnOffTimeout);
@@ -64,9 +65,9 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
64
65
  if (timeout < 0 || !pValue) {
65
66
  return;
66
67
  }
67
- this.turnOffTime = utils_1.Utils.nowMS() + timeout;
68
- this._turnOffTimeout = utils_1.Utils.guardedTimeout(() => {
69
- this.log(logLevel_1.LogLevel.Debug, `Delayed Turnoff initiated`);
68
+ this.turnOffTime = services_1.Utils.nowMS() + timeout;
69
+ this._turnOffTimeout = services_1.Utils.guardedTimeout(() => {
70
+ this.log(models_2.LogLevel.Debug, `Delayed Turnoff initiated`);
70
71
  this._turnOffTimeout = undefined;
71
72
  if (!this.room) {
72
73
  this.setLight(false, -1, true);
@@ -76,21 +77,25 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
76
77
  }
77
78
  }, timeout, this);
78
79
  }
79
- /**
80
- * Switch the current condition of the light
81
- * @param force Whether this is a forcing action skipping delays and locks
82
- */
83
- toggleLight(force = false) {
80
+ toggleLight(time, force = false, calculateTime = false) {
81
+ var _a;
84
82
  const newVal = this.queuedLightValue !== null ? !this.queuedLightValue : !this.lightOn;
85
83
  const timeout = newVal && force ? 30 * 60 * 1000 : -1;
84
+ if (newVal && time === undefined && calculateTime && this.room !== undefined) {
85
+ time = services_2.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
86
+ }
87
+ if (newVal && time !== undefined) {
88
+ this.setTimeBased(time, timeout, force);
89
+ return true;
90
+ }
86
91
  this.setLight(newVal, timeout, force);
87
92
  return newVal;
88
93
  }
89
- setTimeBased(time) {
90
- if ((time === time_callback_service_1.TimeOfDay.Night && this.settings.nightOn) ||
91
- (time === time_callback_service_1.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
92
- (time === time_callback_service_1.TimeOfDay.AfterSunset && this.settings.duskOn)) {
93
- this.setLight(true);
94
+ setTimeBased(time, timeout = -1, force = false) {
95
+ if ((time === services_2.TimeOfDay.Night && this.settings.nightOn) ||
96
+ (time === services_2.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
97
+ (time === services_2.TimeOfDay.AfterSunset && this.settings.duskOn)) {
98
+ this.setLight(true, timeout, force);
94
99
  }
95
100
  }
96
101
  }
@@ -1,11 +1,30 @@
1
1
  import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
2
2
  import { iExcessEnergyConsumer } from './iExcessEnergyConsumer';
3
+ export declare class PhaseState {
4
+ private readonly _meterValue;
5
+ private readonly _production;
6
+ get selfConsumingWattage(): number;
7
+ get drawingWattage(): number;
8
+ get injectingWattage(): number;
9
+ get totalConsumptionWattage(): number;
10
+ private readonly _injectingWattage;
11
+ private readonly _drawingWattage;
12
+ private readonly _selfConsumingWattage;
13
+ private readonly _totalConsumption;
14
+ constructor(_meterValue: number, _production: number);
15
+ }
3
16
  export interface iEnergyManager extends IoBrokerBaseDevice {
4
17
  baseConsumption: number;
5
18
  currentProduction: number;
6
19
  excessEnergy: number;
7
20
  excessEnergyConsumerConsumption: number;
8
21
  totalConsumption: number;
22
+ drawingWattage: number;
23
+ selfConsumingWattage: number;
24
+ injectingWattage: number;
25
+ phaseAState: PhaseState;
26
+ phaseBState: PhaseState;
27
+ phaseCState: PhaseState;
9
28
  addExcessConsumer(device: iExcessEnergyConsumer): void;
10
29
  recalculatePowerSharing(): void;
11
30
  cleanup(): void;