hoffmation-base 1.1.48 → 1.2.0
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.
- package/lib/server/devices/Heizgruppen.d.ts +0 -1
- package/lib/server/devices/Heizgruppen.js +0 -20
- package/lib/server/devices/baseDeviceInterfaces/iBatteryDevice.d.ts +2 -1
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +4 -1
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +6 -2
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +18 -3
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +5 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +24 -4
- package/lib/server/devices/hmIPDevices/hmIpHeizung.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizung.js +11 -2
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +10 -2
- package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTaster.js +10 -2
- package/lib/server/devices/hmIPDevices/hmIpTherm.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTherm.js +11 -2
- package/lib/server/devices/hmIPDevices/hmIpTuer.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTuer.js +6 -0
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +3 -1
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +10 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +12 -4
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.js +31 -11
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +4 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +21 -6
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.d.ts +4 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.js +18 -3
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +3 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +11 -3
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +3 -1
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +11 -3
- package/lib/server/devices/zigbee/zigbeeAquaraWater.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeAquaraWater.js +18 -3
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +18 -3
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +6 -1
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +27 -3
- package/lib/server/ioBroker/connection.d.ts +3 -1
- package/lib/server/ioBroker/connection.js +10 -0
- package/lib/server/services/Telegram/telegram-Commands.js +0 -6
- package/lib/server/services/dbo/iPersist.d.ts +6 -5
- package/lib/server/services/dbo/postgreSqlPersist.d.ts +6 -5
- package/lib/server/services/dbo/postgreSqlPersist.js +66 -62
- package/lib/server/services/time-callback-service.js +2 -2
- package/lib/server/services/utils/iDisposeable.d.ts +3 -0
- package/lib/server/services/utils/iDisposeable.js +2 -0
- package/lib/server/services/utils/index.d.ts +1 -0
- package/lib/server/services/utils/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -32,24 +32,6 @@ values ('${device.id}','${device.info.room}','${device.info.allDevicesKey}','${d
|
|
|
32
32
|
"alldeviceskey" = '${device.info.allDevicesKey}',
|
|
33
33
|
"customname" = '${device.info.customName}',
|
|
34
34
|
"devtype" = ${device.deviceType}
|
|
35
|
-
;
|
|
36
|
-
`);
|
|
37
|
-
}
|
|
38
|
-
addTemperaturDataPoint(heater) {
|
|
39
|
-
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `Persisting Temperatur Data for ${heater.info.customName}`);
|
|
40
|
-
this.query(`
|
|
41
|
-
insert into hoffmation_schema."TemperaturData" ("date", "humidity", "istTemperatur", "level", "name", "sollTemperatur")
|
|
42
|
-
values ('${new Date().toISOString()}',${heater.humidity},${heater.iTemperature},${heater.iLevel / 100},'${heater.info.customName}',${heater.desiredTemperature});`);
|
|
43
|
-
this.query(`
|
|
44
|
-
insert into hoffmation_schema."HeatGroupCollection" ("date", "humidity", "istTemperatur", "level", "name", "sollTemperatur")
|
|
45
|
-
values ('${new Date().toISOString()}',${heater.humidity},${heater.iTemperature},${heater.iLevel},'${heater.info.customName}',${heater.desiredTemperature})
|
|
46
|
-
ON CONFLICT (name)
|
|
47
|
-
DO UPDATE SET
|
|
48
|
-
"date" = '${new Date().toISOString()}',
|
|
49
|
-
"humidity" = ${heater.humidity},
|
|
50
|
-
"istTemperatur" = ${heater.iTemperature},
|
|
51
|
-
"level" = ${heater.iLevel},
|
|
52
|
-
"sollTemperatur" = ${heater.desiredTemperature}
|
|
53
35
|
;
|
|
54
36
|
`);
|
|
55
37
|
}
|
|
@@ -169,23 +151,6 @@ BEGIN
|
|
|
169
151
|
create unique index energycalculation_startdate_uindex
|
|
170
152
|
on hoffmation_schema."EnergyCalculation" ("startDate");
|
|
171
153
|
|
|
172
|
-
END IF;
|
|
173
|
-
IF (SELECT to_regclass('hoffmation_schema."HeatGroupCollection"') IS NULL) Then
|
|
174
|
-
create table hoffmation_schema."HeatGroupCollection"
|
|
175
|
-
(
|
|
176
|
-
date timestamp,
|
|
177
|
-
humidity integer,
|
|
178
|
-
"istTemperatur" double precision,
|
|
179
|
-
level integer,
|
|
180
|
-
name varchar(60) not null
|
|
181
|
-
constraint heatgroupcollection_pk
|
|
182
|
-
primary key,
|
|
183
|
-
"sollTemperatur" double precision
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
create unique index heatgroupcollection_name_uindex
|
|
187
|
-
on hoffmation_schema."HeatGroupCollection" (name);
|
|
188
|
-
|
|
189
154
|
END IF;
|
|
190
155
|
|
|
191
156
|
IF (SELECT to_regclass('hoffmation_schema."AcDeviceData"') IS NULL) Then
|
|
@@ -259,6 +224,53 @@ BEGIN
|
|
|
259
224
|
|
|
260
225
|
END IF;
|
|
261
226
|
|
|
227
|
+
IF (SELECT to_regclass('hoffmation_schema."HumiditySensorDeviceData"') IS NULL) Then
|
|
228
|
+
create table if not exists hoffmation_schema."HumiditySensorDeviceData"
|
|
229
|
+
(
|
|
230
|
+
"deviceID" varchar(60) not null
|
|
231
|
+
constraint "HumiditySensorDeviceData_DeviceInfo_null_fk"
|
|
232
|
+
references hoffmation_schema."DeviceInfo"
|
|
233
|
+
on delete set null,
|
|
234
|
+
humidity double precision,
|
|
235
|
+
date timestamp not null,
|
|
236
|
+
constraint humiditysensordevicedata_pk
|
|
237
|
+
primary key ("deviceID", date)
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
END IF;
|
|
241
|
+
|
|
242
|
+
IF (SELECT to_regclass('hoffmation_schema."BatteryDeviceData"') IS NULL) Then
|
|
243
|
+
create table if not exists hoffmation_schema."BatteryDeviceData"
|
|
244
|
+
(
|
|
245
|
+
"deviceID" varchar(60) not null
|
|
246
|
+
constraint "BatteryDeviceData_DeviceInfo_null_fk"
|
|
247
|
+
references hoffmation_schema."DeviceInfo"
|
|
248
|
+
on delete set null,
|
|
249
|
+
battery double precision,
|
|
250
|
+
date timestamp not null,
|
|
251
|
+
constraint batterydevicedata_pk
|
|
252
|
+
primary key ("deviceID", date)
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
END IF;
|
|
256
|
+
|
|
257
|
+
IF (SELECT to_regclass('hoffmation_schema."ZigbeeDeviceData"') IS NULL) Then
|
|
258
|
+
create table if not exists hoffmation_schema."ZigbeeDeviceData"
|
|
259
|
+
(
|
|
260
|
+
"deviceID" varchar(60) not null
|
|
261
|
+
constraint "ZigbeeDeviceData_DeviceInfo_null_fk"
|
|
262
|
+
references hoffmation_schema."DeviceInfo"
|
|
263
|
+
on delete set null,
|
|
264
|
+
date timestamp not null,
|
|
265
|
+
available boolean,
|
|
266
|
+
linkQuality double precision,
|
|
267
|
+
lastUpdate timestamp,
|
|
268
|
+
constraint zigbeedevicedata_pk
|
|
269
|
+
primary key ("deviceID", date)
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
END IF;
|
|
273
|
+
|
|
262
274
|
|
|
263
275
|
|
|
264
276
|
IF (SELECT to_regclass('hoffmation_schema."HeaterDeviceData"') IS NULL) Then
|
|
@@ -277,21 +289,6 @@ BEGIN
|
|
|
277
289
|
);
|
|
278
290
|
|
|
279
291
|
END IF;
|
|
280
|
-
|
|
281
|
-
IF (SELECT to_regclass('hoffmation_schema."TemperaturData"') IS NULL) Then
|
|
282
|
-
create table hoffmation_schema."TemperaturData"
|
|
283
|
-
(
|
|
284
|
-
date timestamp,
|
|
285
|
-
humidity integer,
|
|
286
|
-
"istTemperatur" double precision,
|
|
287
|
-
level integer,
|
|
288
|
-
name text,
|
|
289
|
-
"sollTemperatur" double precision,
|
|
290
|
-
constraint temperaturdata_pk
|
|
291
|
-
unique (date, name)
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
END IF;
|
|
295
292
|
END
|
|
296
293
|
$$;`);
|
|
297
294
|
this.initialized = true;
|
|
@@ -355,6 +352,25 @@ values ('${device.id}', ${currentLevel}, '${new Date().toISOString()}', ${desire
|
|
|
355
352
|
this.query(`
|
|
356
353
|
insert into hoffmation_schema."TemperatureSensorDeviceData" ("deviceID", "temperature", "date", "roomTemperature")
|
|
357
354
|
values ('${device.id}', ${device.iTemperature}, '${new Date().toISOString()}', ${roomTemp !== null && roomTemp !== void 0 ? roomTemp : 'null'});
|
|
355
|
+
`);
|
|
356
|
+
}
|
|
357
|
+
persistHumiditySensor(device) {
|
|
358
|
+
this.query(`
|
|
359
|
+
insert into hoffmation_schema."HumiditySensorDeviceData" ("deviceID", "humidity", "date")
|
|
360
|
+
values ('${device.id}', ${device.humidity}, '${new Date().toISOString()}');
|
|
361
|
+
`);
|
|
362
|
+
}
|
|
363
|
+
persistBatteryDevice(device) {
|
|
364
|
+
this.query(`
|
|
365
|
+
insert into hoffmation_schema."BatteryDeviceData" ("deviceID", "battery", "date")
|
|
366
|
+
values ('${device.id}', ${device.battery}, '${new Date().toISOString()}');
|
|
367
|
+
`);
|
|
368
|
+
}
|
|
369
|
+
persistZigbeeDevice(device) {
|
|
370
|
+
const dateValue = device.lastUpdate.getTime() > 0 ? device.lastUpdate.toISOString() : 'null';
|
|
371
|
+
this.query(`
|
|
372
|
+
insert into hoffmation_schema."ZigbeeDeviceData" ("deviceID", "date", "available", "linkQuality", "lastUpdate")
|
|
373
|
+
values ('${device.id}', '${new Date().toISOString()}', ${device.available}, ${device.linkQuality}, '${dateValue}');
|
|
358
374
|
`);
|
|
359
375
|
}
|
|
360
376
|
persistIlluminationSensor(device) {
|
|
@@ -365,18 +381,6 @@ values ('${device.id}', ${device.currentIllumination}, '${new Date().toISOString
|
|
|
365
381
|
persistShutterCalibration(_data) {
|
|
366
382
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Postgres doesn't support Shutter Calibration yet.`);
|
|
367
383
|
}
|
|
368
|
-
async readTemperaturDataPoint(heater, limit) {
|
|
369
|
-
const dbResult = await this.query(`
|
|
370
|
-
SELECT * FROM hoffmation_schema."TemperaturData"
|
|
371
|
-
WHERE name = '${heater.info.customName}'
|
|
372
|
-
ORDER BY "date" DESC
|
|
373
|
-
LIMIT ${limit}
|
|
374
|
-
`);
|
|
375
|
-
if (dbResult !== null && dbResult.length > 0) {
|
|
376
|
-
return dbResult;
|
|
377
|
-
}
|
|
378
|
-
return [];
|
|
379
|
-
}
|
|
380
384
|
persistEnergyManager(calc) {
|
|
381
385
|
this.query(`
|
|
382
386
|
insert into hoffmation_schema."EnergyCalculation" ("startDate", "endDate", "selfConsumedKwH", "injectedKwH",
|
|
@@ -62,7 +62,7 @@ class TimeCallbackService {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
let sunset = new Date(TimeCallbackService._todaySunSet.getTime() + pOffset.sunset * 60 * 1000);
|
|
65
|
-
const maximumSunset = pOffset.getNextMaximumSunset();
|
|
65
|
+
const maximumSunset = pOffset.getNextMaximumSunset(now);
|
|
66
66
|
if (maximumSunset.getDate() !== sunset.getDate()) {
|
|
67
67
|
maximumSunset.setDate(maximumSunset.getDate() - 1);
|
|
68
68
|
}
|
|
@@ -73,7 +73,7 @@ class TimeCallbackService {
|
|
|
73
73
|
if (now > sunset) {
|
|
74
74
|
return models_1.TimeOfDay.AfterSunset;
|
|
75
75
|
}
|
|
76
|
-
const minimumSunrise = pOffset.getNextMinimumSunrise();
|
|
76
|
+
const minimumSunrise = pOffset.getNextMinimumSunrise(now);
|
|
77
77
|
let sunrise = new Date(TimeCallbackService._todaySunRise.getTime() + pOffset.sunrise * 60 * 1000);
|
|
78
78
|
if (minimumSunrise.getDate() !== sunrise.getDate()) {
|
|
79
79
|
minimumSunrise.setDate(minimumSunrise.getDate() - 1);
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ringstorage"), exports);
|
|
18
18
|
__exportStar(require("./utils"), exports);
|
|
19
|
+
__exportStar(require("./iDisposeable"), exports);
|