hoffmation-base 0.1.29-4 → 0.1.29-8
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/README.md +31 -0
- package/lib/index.js +3 -1
- package/lib/server/config/iConfig.d.ts +1 -1
- package/lib/server/devices/Fenster.d.ts +1 -1
- package/lib/server/devices/Fenster.js +3 -4
- package/lib/server/devices/Griffe.js +1 -1
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/devices.js +4 -0
- package/lib/server/devices/groups/fensterGroup.js +2 -1
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +1 -1
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpRoll.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpTuer.d.ts +5 -5
- package/lib/server/devices/hmIPDevices/hmIpTuer.js +13 -13
- package/lib/server/devices/hmIPDevices/index.d.ts +2 -2
- package/lib/server/devices/hmIPDevices/index.js +2 -2
- package/lib/server/devices/iShutter.d.ts +1 -1
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/server/devices/{FensterPosition.d.ts → models/FensterPosition.d.ts} +0 -0
- package/lib/server/devices/{FensterPosition.js → models/FensterPosition.js} +0 -0
- package/lib/server/devices/models/MagnetPosition.d.ts +4 -0
- package/lib/server/devices/models/MagnetPosition.js +8 -0
- package/lib/server/devices/models/index.d.ts +2 -0
- package/lib/server/devices/models/index.js +14 -0
- package/lib/server/devices/zigbee/index.d.ts +2 -0
- package/lib/server/devices/zigbee/index.js +2 -0
- package/lib/server/devices/zigbee/zigbeeIlluShutter.js +8 -7
- package/lib/server/devices/zigbee/zigbeeMagnetContact.d.ts +17 -0
- package/lib/server/devices/zigbee/zigbeeMagnetContact.js +81 -0
- package/lib/server/devices/zigbee/zigbeeSMaBiTMagnetContact.d.ts +7 -0
- package/lib/server/devices/zigbee/zigbeeSMaBiTMagnetContact.js +23 -0
- package/lib/server/devices/zigbee/zigbeeShutter.js +3 -2
- package/lib/server/services/ShutterService.js +1 -1
- package/lib/server/services/dbo/persist.js +21 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/lib/server/devices/hmIPDevices/TuerPosition.d.ts +0 -4
- package/lib/server/devices/hmIPDevices/TuerPosition.js +0 -8
|
@@ -11,6 +11,9 @@ const BasicRoomInfo_1 = require("../../../models/persistence/BasicRoomInfo");
|
|
|
11
11
|
const logLevel_1 = require("../../../models/logLevel");
|
|
12
12
|
class Persist {
|
|
13
13
|
static addTemperaturDataPoint(hzGrp) {
|
|
14
|
+
if (!this.MongoClient) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
14
17
|
const dataPoint = new temperaturDataPoint_1.TemperaturDataPoint(hzGrp.info.customName, hzGrp.iTemperatur, hzGrp.desiredTemperatur, hzGrp.iLevel, hzGrp.humidity, new Date());
|
|
15
18
|
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Trace, `Persisting Temperatur Data for ${hzGrp.info.customName}`);
|
|
16
19
|
this.TemperatureHistoryCollection.insertOne(dataPoint).catch((r) => {
|
|
@@ -23,6 +26,9 @@ class Persist {
|
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
28
|
static addRoom(room) {
|
|
29
|
+
if (!this.MongoClient) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Trace, `Persisting Room for ${room.roomName}`);
|
|
27
33
|
this.BasicRoomCollection.updateOne({ roomName: room.roomName }, { $set: new BasicRoomInfo_1.BasicRoomInfo(room.roomName, room.Settings.etage) }, { upsert: true }).catch((r) => {
|
|
28
34
|
this.handleReject(r, 'BasicRoomCollection.updateOne');
|
|
@@ -37,6 +43,11 @@ class Persist {
|
|
|
37
43
|
}
|
|
38
44
|
static async getCount(device) {
|
|
39
45
|
const result = new Promise(async (resolve) => {
|
|
46
|
+
console.log(this.MongoClient);
|
|
47
|
+
if (!this.MongoClient) {
|
|
48
|
+
resolve(new todaysCount_1.CountToday(device.info.fullID, 0));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
40
51
|
const options = {
|
|
41
52
|
limit: 1,
|
|
42
53
|
};
|
|
@@ -64,6 +75,9 @@ class Persist {
|
|
|
64
75
|
this.DailyMovementCountTodayCollection = this.Mongo.collection('DailyMovementCount');
|
|
65
76
|
}
|
|
66
77
|
static persistTodayCount(device, count, oldCount) {
|
|
78
|
+
if (!this.MongoClient) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
67
81
|
const result = this.CountTodayCollection.updateOne({ deviceID: device.info.fullID }, { $set: new todaysCount_1.CountToday(device.info.fullID, count) }, { upsert: true });
|
|
68
82
|
if (count === 0) {
|
|
69
83
|
const date = new Date();
|
|
@@ -76,6 +90,9 @@ class Persist {
|
|
|
76
90
|
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Trace, `Persisting PresenceToday Data for ${device.info.customName} to ${count} resolved with "${result}"`);
|
|
77
91
|
}
|
|
78
92
|
static persistCurrentIllumination(data) {
|
|
93
|
+
if (!this.MongoClient) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
79
96
|
const result = this.CurrentIlluminationCollection.updateOne({ deviceID: data.deviceID, date: data.date }, { $set: data }, { upsert: true }).catch((r) => {
|
|
80
97
|
this.handleReject(r, 'persistCurrentIllumination');
|
|
81
98
|
});
|
|
@@ -83,6 +100,10 @@ class Persist {
|
|
|
83
100
|
}
|
|
84
101
|
static async readTemperaturDataPoint(hzGrp, limit = -1) {
|
|
85
102
|
const result = new Promise(async (resolve) => {
|
|
103
|
+
if (!this.MongoClient) {
|
|
104
|
+
resolve([]);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
86
107
|
const options = {
|
|
87
108
|
limit: limit > 0 ? limit : undefined,
|
|
88
109
|
sort: { date: -1 },
|