hoffmation-base 0.1.34-2 → 0.1.37-1
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/index.js +4 -1
- package/lib/models/actuatorSettings.d.ts +2 -1
- package/lib/models/actuatorSettings.js +3 -1
- package/lib/models/deviceSettings.d.ts +2 -0
- package/lib/models/deviceSettings.js +6 -0
- package/lib/models/ledSettings.d.ts +2 -1
- package/lib/models/ledSettings.js +3 -1
- package/lib/models/logSource.d.ts +4 -0
- package/lib/models/logSource.js +8 -0
- package/lib/models/rooms/RoomBase.d.ts +3 -0
- package/lib/models/rooms/RoomBase.js +6 -1
- package/lib/server/config/iConfig.d.ts +6 -0
- package/lib/server/devices/button.d.ts +24 -0
- package/lib/server/devices/button.js +97 -0
- package/lib/server/devices/device-cluster-type.d.ts +18 -17
- package/lib/server/devices/device-cluster-type.js +18 -17
- package/lib/server/devices/device-cluster.d.ts +2 -0
- package/lib/server/devices/device-cluster.js +87 -0
- 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/tasterGroup.d.ts +2 -2
- package/lib/server/devices/groups/tasterGroup.js +9 -7
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +4 -4
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +4 -7
- package/lib/server/devices/hmIPDevices/hmIpHeizung.d.ts +1 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizung.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +13 -7
- package/lib/server/devices/hmIPDevices/hmIpTaster.js +34 -21
- package/lib/server/devices/hmIPDevices/hmIpWippe.d.ts +13 -6
- package/lib/server/devices/hmIPDevices/hmIpWippe.js +27 -9
- package/lib/server/devices/iButtonSwitch.d.ts +13 -0
- package/lib/server/devices/{iTaster.js → iButtonSwitch.js} +0 -0
- package/lib/server/devices/iHeater.d.ts +11 -0
- package/lib/server/devices/iHeater.js +2 -0
- package/lib/server/devices/iHumiditySensor.d.ts +1 -0
- package/lib/server/devices/index.d.ts +3 -2
- package/lib/server/devices/index.js +3 -2
- package/lib/server/devices/zigbee/index.d.ts +2 -0
- package/lib/server/devices/zigbee/index.js +2 -0
- package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.d.ts +19 -0
- package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.js +105 -0
- package/lib/server/devices/zigbee/zigbeeBlitzShp.js +2 -2
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +16 -3
- package/lib/server/devices/zigbee/zigbeeSwitch.d.ts +19 -0
- package/lib/server/devices/zigbee/zigbeeSwitch.js +13 -0
- package/lib/server/services/Sonos/polly-service.d.ts +1 -1
- package/lib/server/services/Sonos/polly-service.js +3 -2
- package/lib/server/services/Telegram/telegram-Commands.js +1 -1
- package/lib/server/services/https-service.d.ts +6 -0
- package/lib/server/services/https-service.js +12 -0
- package/lib/server/services/log-service/log-filter-data.d.ts +2 -0
- package/lib/server/services/log-service/log-service.js +6 -0
- package/lib/server/services/news-service.d.ts +36 -5
- package/lib/server/services/news-service.js +136 -31
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/lib/server/devices/iTaster.d.ts +0 -7
- package/lib/server/devices/taste.d.ts +0 -15
- package/lib/server/devices/taste.js +0 -64
package/lib/index.js
CHANGED
|
@@ -65,7 +65,10 @@ class HoffmationBase {
|
|
|
65
65
|
server_1.MuellService.intialize(server_1.SettingsService.settings.muell, defaultMuellSonos);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
server_1.Utils.guardedNewThread(
|
|
68
|
+
server_1.Utils.guardedNewThread(() => {
|
|
69
|
+
server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `News settings detected --> initializing`);
|
|
70
|
+
server_1.NewsService.initialize(server_1.SettingsService.settings.news);
|
|
71
|
+
});
|
|
69
72
|
server_1.Utils.guardedNewThread(() => {
|
|
70
73
|
if (server_1.SettingsService.settings.weather) {
|
|
71
74
|
server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Weather settings detected --> initializing`);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActuatorSettings = void 0;
|
|
4
|
-
|
|
4
|
+
const deviceSettings_1 = require("./deviceSettings");
|
|
5
|
+
class ActuatorSettings extends deviceSettings_1.DeviceSettings {
|
|
5
6
|
constructor() {
|
|
7
|
+
super(...arguments);
|
|
6
8
|
this.dawnOn = true;
|
|
7
9
|
this.duskOn = true;
|
|
8
10
|
this.nightOn = true;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LedSettings = void 0;
|
|
4
|
-
|
|
4
|
+
const deviceSettings_1 = require("./deviceSettings");
|
|
5
|
+
class LedSettings extends deviceSettings_1.DeviceSettings {
|
|
5
6
|
constructor() {
|
|
7
|
+
super(...arguments);
|
|
6
8
|
this.defaultColor = '#fbbc32';
|
|
7
9
|
this.dayOn = false;
|
|
8
10
|
this.dayBrightness = 100;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogSource = void 0;
|
|
4
|
+
var LogSource;
|
|
5
|
+
(function (LogSource) {
|
|
6
|
+
LogSource[LogSource["NotSpecified"] = 0] = "NotSpecified";
|
|
7
|
+
LogSource[LogSource["News"] = 1] = "News";
|
|
8
|
+
})(LogSource = exports.LogSource || (exports.LogSource = {}));
|
|
@@ -12,10 +12,13 @@ import { iRoomBase } from './iRoomBase';
|
|
|
12
12
|
import { RoomInfo } from './roomInfo';
|
|
13
13
|
import { BaseGroup } from '../../server/devices/groups/base-group';
|
|
14
14
|
import { GroupType } from '../../server/devices/groups/group-type';
|
|
15
|
+
import { DeviceCluster } from '../../server/devices/device-cluster';
|
|
15
16
|
export declare class RoomBase implements iRoomBase {
|
|
16
17
|
settings: RoomSettings;
|
|
17
18
|
groups: Map<GroupType, BaseGroup>;
|
|
18
19
|
info: RoomInfo;
|
|
20
|
+
protected _deviceCluster: DeviceCluster;
|
|
21
|
+
get deviceCluster(): DeviceCluster;
|
|
19
22
|
get FensterGroup(): FensterGroup | undefined;
|
|
20
23
|
get PraesenzGroup(): PraesenzGroup | undefined;
|
|
21
24
|
get LampenGroup(): LampenGroup | undefined;
|
|
@@ -14,16 +14,21 @@ const group_type_1 = require("../../server/devices/groups/group-type");
|
|
|
14
14
|
const ShutterService_1 = require("../../server/services/ShutterService");
|
|
15
15
|
const utils_1 = require("../../server/services/utils/utils");
|
|
16
16
|
const lodash_1 = __importDefault(require("lodash"));
|
|
17
|
+
const device_cluster_1 = require("../../server/devices/device-cluster");
|
|
17
18
|
class RoomBase {
|
|
18
19
|
constructor(roomName, settings, groups) {
|
|
19
20
|
this.settings = settings;
|
|
20
21
|
this.groups = groups;
|
|
22
|
+
this._deviceCluster = new device_cluster_1.DeviceCluster();
|
|
21
23
|
this.skipNextRolloUp = false;
|
|
22
24
|
this.info = new roomInfo_1.RoomInfo(roomName, settings);
|
|
23
25
|
settings.roomName = roomName;
|
|
24
26
|
this.settings = settings;
|
|
25
27
|
room_service_1.RoomService.addToRoomList(this);
|
|
26
28
|
}
|
|
29
|
+
get deviceCluster() {
|
|
30
|
+
return this._deviceCluster;
|
|
31
|
+
}
|
|
27
32
|
get FensterGroup() {
|
|
28
33
|
return this.groups.get(group_type_1.GroupType.Window);
|
|
29
34
|
}
|
|
@@ -133,7 +138,7 @@ class RoomBase {
|
|
|
133
138
|
toJSON() {
|
|
134
139
|
const result = utils_1.Utils.jsonFilter(this);
|
|
135
140
|
result.groupDict = Object.fromEntries(this.groups);
|
|
136
|
-
return lodash_1.default.omit(result, 'groups');
|
|
141
|
+
return lodash_1.default.omit(result, ['groups', '_deviceCluster']);
|
|
137
142
|
}
|
|
138
143
|
log(level, message) {
|
|
139
144
|
log_service_1.ServerLogService.writeLog(level, message, {
|
|
@@ -13,6 +13,7 @@ export interface iConfig {
|
|
|
13
13
|
translationSettings: iTranslationSettings;
|
|
14
14
|
mp3Server?: iMp3Settings;
|
|
15
15
|
muell?: iMuellSettings;
|
|
16
|
+
news?: iNewsSettings;
|
|
16
17
|
persistence?: iPersistenceSettings;
|
|
17
18
|
polly?: iPollySettings;
|
|
18
19
|
restServer?: iRestSettings;
|
|
@@ -64,6 +65,11 @@ export interface iWeatherSettings {
|
|
|
64
65
|
export interface iMuellSettings {
|
|
65
66
|
calendarURL: string;
|
|
66
67
|
}
|
|
68
|
+
export interface iNewsSettings {
|
|
69
|
+
rssUrl?: string;
|
|
70
|
+
requestInterval?: number;
|
|
71
|
+
keepMaxAge?: number;
|
|
72
|
+
}
|
|
67
73
|
export interface iTranslationSettings {
|
|
68
74
|
language: string;
|
|
69
75
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare class ButtonCapabilities {
|
|
2
|
+
shortPress: boolean;
|
|
3
|
+
doublePress: boolean;
|
|
4
|
+
triplePress: boolean;
|
|
5
|
+
longPress: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare enum ButtonPressType {
|
|
8
|
+
short = 0,
|
|
9
|
+
long = 1,
|
|
10
|
+
double = 2,
|
|
11
|
+
triple = 3
|
|
12
|
+
}
|
|
13
|
+
export declare class Button {
|
|
14
|
+
name: string;
|
|
15
|
+
buttonCapabilities: ButtonCapabilities;
|
|
16
|
+
private _state;
|
|
17
|
+
private _callbacks;
|
|
18
|
+
private _timeouts;
|
|
19
|
+
getState(type: ButtonPressType): boolean;
|
|
20
|
+
constructor(name: string, buttonCapabilities: ButtonCapabilities);
|
|
21
|
+
addCb(buttonType: ButtonPressType, pCallback: (pValue: boolean) => void, description?: string): void;
|
|
22
|
+
getDescription(): string;
|
|
23
|
+
updateState(type: ButtonPressType, pValue: boolean): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = exports.ButtonPressType = exports.ButtonCapabilities = void 0;
|
|
4
|
+
const utils_1 = require("../services/utils/utils");
|
|
5
|
+
const log_service_1 = require("../services/log-service/log-service");
|
|
6
|
+
const logLevel_1 = require("../../models/logLevel");
|
|
7
|
+
class ButtonCapabilities {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.shortPress = true;
|
|
10
|
+
this.doublePress = true;
|
|
11
|
+
this.triplePress = true;
|
|
12
|
+
this.longPress = true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ButtonCapabilities = ButtonCapabilities;
|
|
16
|
+
var ButtonPressType;
|
|
17
|
+
(function (ButtonPressType) {
|
|
18
|
+
ButtonPressType[ButtonPressType["short"] = 0] = "short";
|
|
19
|
+
ButtonPressType[ButtonPressType["long"] = 1] = "long";
|
|
20
|
+
ButtonPressType[ButtonPressType["double"] = 2] = "double";
|
|
21
|
+
ButtonPressType[ButtonPressType["triple"] = 3] = "triple";
|
|
22
|
+
})(ButtonPressType = exports.ButtonPressType || (exports.ButtonPressType = {}));
|
|
23
|
+
class Button {
|
|
24
|
+
constructor(name, buttonCapabilities) {
|
|
25
|
+
this.name = name;
|
|
26
|
+
this.buttonCapabilities = buttonCapabilities;
|
|
27
|
+
this._state = new Map();
|
|
28
|
+
this._callbacks = new Map();
|
|
29
|
+
this._timeouts = new Map();
|
|
30
|
+
if (buttonCapabilities.shortPress) {
|
|
31
|
+
this._callbacks.set(ButtonPressType.short, []);
|
|
32
|
+
this._timeouts.set(ButtonPressType.short, null);
|
|
33
|
+
this._state.set(ButtonPressType.short, false);
|
|
34
|
+
}
|
|
35
|
+
if (buttonCapabilities.longPress) {
|
|
36
|
+
this._callbacks.set(ButtonPressType.long, []);
|
|
37
|
+
this._timeouts.set(ButtonPressType.long, null);
|
|
38
|
+
this._state.set(ButtonPressType.long, false);
|
|
39
|
+
}
|
|
40
|
+
if (buttonCapabilities.doublePress) {
|
|
41
|
+
this._callbacks.set(ButtonPressType.double, []);
|
|
42
|
+
this._timeouts.set(ButtonPressType.double, null);
|
|
43
|
+
this._state.set(ButtonPressType.double, false);
|
|
44
|
+
}
|
|
45
|
+
if (buttonCapabilities.triplePress) {
|
|
46
|
+
this._callbacks.set(ButtonPressType.triple, []);
|
|
47
|
+
this._timeouts.set(ButtonPressType.triple, null);
|
|
48
|
+
this._state.set(ButtonPressType.triple, false);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getState(type) {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = this._state.get(type)) !== null && _a !== void 0 ? _a : false;
|
|
54
|
+
}
|
|
55
|
+
addCb(buttonType, pCallback, description = 'Not described') {
|
|
56
|
+
const cbArr = this._callbacks.get(buttonType);
|
|
57
|
+
if (cbArr === undefined) {
|
|
58
|
+
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Error, `This Button doesn't support press Type ${ButtonPressType[buttonType]}`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
cbArr.push({ cb: pCallback, description: description });
|
|
62
|
+
}
|
|
63
|
+
getDescription() {
|
|
64
|
+
const description = [];
|
|
65
|
+
for (const [key, arr] of this._callbacks.entries()) {
|
|
66
|
+
for (const entry of arr) {
|
|
67
|
+
description.push(`${ButtonPressType[key]}: "${entry.description}"`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return description.join('\n');
|
|
71
|
+
}
|
|
72
|
+
updateState(type, pValue) {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
if (pValue === this._state.get(type)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this._state.set(type, pValue);
|
|
78
|
+
if (!this._callbacks.has(type)) {
|
|
79
|
+
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Error, `This Button doesn't support press Type ${ButtonPressType[type]}`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const c of (_a = this._callbacks.get(type)) !== null && _a !== void 0 ? _a : []) {
|
|
83
|
+
c.cb(pValue);
|
|
84
|
+
}
|
|
85
|
+
if (!pValue) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const timeout = (_b = this._timeouts.get(type)) !== null && _b !== void 0 ? _b : null;
|
|
89
|
+
if (timeout !== null) {
|
|
90
|
+
clearTimeout(timeout);
|
|
91
|
+
}
|
|
92
|
+
this._timeouts.set(type, utils_1.Utils.guardedTimeout(() => {
|
|
93
|
+
this.updateState(type, false);
|
|
94
|
+
}, 5000, this));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.Button = Button;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export declare enum DeviceClusterType {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
all = 0,
|
|
3
|
+
Buttons = 1,
|
|
4
|
+
Heater = 2,
|
|
5
|
+
LED = 3,
|
|
6
|
+
Lamps = 4,
|
|
7
|
+
MotionDetection = 5,
|
|
8
|
+
Outlets = 6,
|
|
9
|
+
PresenceDetection = 7,
|
|
10
|
+
Speaker = 8,
|
|
11
|
+
SmokeDetector = 9,
|
|
12
|
+
WaterDetectors = 10,
|
|
13
|
+
Windows = 11,
|
|
14
|
+
Handle = 12,
|
|
15
|
+
Vibration = 13,
|
|
16
|
+
Shutter = 14,
|
|
17
|
+
MagnetContact = 15,
|
|
18
|
+
TemperaturSensor = 16,
|
|
19
|
+
HumiditySensor = 17
|
|
19
20
|
}
|
|
@@ -3,21 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeviceClusterType = void 0;
|
|
4
4
|
var DeviceClusterType;
|
|
5
5
|
(function (DeviceClusterType) {
|
|
6
|
-
DeviceClusterType[DeviceClusterType["
|
|
7
|
-
DeviceClusterType[DeviceClusterType["
|
|
8
|
-
DeviceClusterType[DeviceClusterType["
|
|
9
|
-
DeviceClusterType[DeviceClusterType["
|
|
10
|
-
DeviceClusterType[DeviceClusterType["
|
|
11
|
-
DeviceClusterType[DeviceClusterType["
|
|
12
|
-
DeviceClusterType[DeviceClusterType["
|
|
13
|
-
DeviceClusterType[DeviceClusterType["
|
|
14
|
-
DeviceClusterType[DeviceClusterType["
|
|
15
|
-
DeviceClusterType[DeviceClusterType["
|
|
16
|
-
DeviceClusterType[DeviceClusterType["
|
|
17
|
-
DeviceClusterType[DeviceClusterType["
|
|
18
|
-
DeviceClusterType[DeviceClusterType["
|
|
19
|
-
DeviceClusterType[DeviceClusterType["
|
|
20
|
-
DeviceClusterType[DeviceClusterType["
|
|
21
|
-
DeviceClusterType[DeviceClusterType["
|
|
22
|
-
DeviceClusterType[DeviceClusterType["
|
|
6
|
+
DeviceClusterType[DeviceClusterType["all"] = 0] = "all";
|
|
7
|
+
DeviceClusterType[DeviceClusterType["Buttons"] = 1] = "Buttons";
|
|
8
|
+
DeviceClusterType[DeviceClusterType["Heater"] = 2] = "Heater";
|
|
9
|
+
DeviceClusterType[DeviceClusterType["LED"] = 3] = "LED";
|
|
10
|
+
DeviceClusterType[DeviceClusterType["Lamps"] = 4] = "Lamps";
|
|
11
|
+
DeviceClusterType[DeviceClusterType["MotionDetection"] = 5] = "MotionDetection";
|
|
12
|
+
DeviceClusterType[DeviceClusterType["Outlets"] = 6] = "Outlets";
|
|
13
|
+
DeviceClusterType[DeviceClusterType["PresenceDetection"] = 7] = "PresenceDetection";
|
|
14
|
+
DeviceClusterType[DeviceClusterType["Speaker"] = 8] = "Speaker";
|
|
15
|
+
DeviceClusterType[DeviceClusterType["SmokeDetector"] = 9] = "SmokeDetector";
|
|
16
|
+
DeviceClusterType[DeviceClusterType["WaterDetectors"] = 10] = "WaterDetectors";
|
|
17
|
+
DeviceClusterType[DeviceClusterType["Windows"] = 11] = "Windows";
|
|
18
|
+
DeviceClusterType[DeviceClusterType["Handle"] = 12] = "Handle";
|
|
19
|
+
DeviceClusterType[DeviceClusterType["Vibration"] = 13] = "Vibration";
|
|
20
|
+
DeviceClusterType[DeviceClusterType["Shutter"] = 14] = "Shutter";
|
|
21
|
+
DeviceClusterType[DeviceClusterType["MagnetContact"] = 15] = "MagnetContact";
|
|
22
|
+
DeviceClusterType[DeviceClusterType["TemperaturSensor"] = 16] = "TemperaturSensor";
|
|
23
|
+
DeviceClusterType[DeviceClusterType["HumiditySensor"] = 17] = "HumiditySensor";
|
|
23
24
|
})(DeviceClusterType = exports.DeviceClusterType || (exports.DeviceClusterType = {}));
|
|
@@ -7,6 +7,8 @@ export declare class DeviceCluster {
|
|
|
7
7
|
constructor(deviceMap?: Map<DeviceClusterType, DeviceList>);
|
|
8
8
|
getIoBrokerDevicesByType(type: DeviceClusterType): IoBrokerBaseDevice[];
|
|
9
9
|
getDevicesByType(type: DeviceClusterType): Array<IoBrokerBaseDevice | OwnSonosDevice>;
|
|
10
|
+
addByDeviceType(device: IoBrokerBaseDevice): void;
|
|
11
|
+
addToList(type: DeviceClusterType, device: IoBrokerBaseDevice): void;
|
|
10
12
|
toJSON(): Partial<DeviceCluster & {
|
|
11
13
|
deviceDict?: {
|
|
12
14
|
[p: string]: DeviceList;
|
|
@@ -5,8 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DeviceCluster = void 0;
|
|
7
7
|
const device_cluster_type_1 = require("./device-cluster-type");
|
|
8
|
+
const device_list_1 = require("./device-list");
|
|
8
9
|
const utils_1 = require("../services/utils/utils");
|
|
9
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const deviceType_1 = require("./deviceType");
|
|
10
12
|
class DeviceCluster {
|
|
11
13
|
constructor(deviceMap = new Map()) {
|
|
12
14
|
this.deviceMap = deviceMap;
|
|
@@ -21,6 +23,91 @@ class DeviceCluster {
|
|
|
21
23
|
var _a, _b;
|
|
22
24
|
return (_b = (_a = this.deviceMap.get(type)) === null || _a === void 0 ? void 0 : _a.getDevices()) !== null && _b !== void 0 ? _b : [];
|
|
23
25
|
}
|
|
26
|
+
addByDeviceType(device) {
|
|
27
|
+
const type = device.deviceType;
|
|
28
|
+
const clusterTypes = [device_cluster_type_1.DeviceClusterType.all];
|
|
29
|
+
switch (type) {
|
|
30
|
+
case deviceType_1.DeviceType.HmIpLampe:
|
|
31
|
+
case deviceType_1.DeviceType.ZigbeeIlluDimmer:
|
|
32
|
+
case deviceType_1.DeviceType.ZigbeeIlluLampe:
|
|
33
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Lamps);
|
|
34
|
+
break;
|
|
35
|
+
case deviceType_1.DeviceType.HmIpWippe:
|
|
36
|
+
case deviceType_1.DeviceType.HmIpTaster:
|
|
37
|
+
case deviceType_1.DeviceType.ZigbeeIkeaFernbedienung:
|
|
38
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Buttons);
|
|
39
|
+
break;
|
|
40
|
+
case deviceType_1.DeviceType.HmIpRoll:
|
|
41
|
+
case deviceType_1.DeviceType.ZigbeeIlluShutter:
|
|
42
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Shutter);
|
|
43
|
+
break;
|
|
44
|
+
case deviceType_1.DeviceType.ZigbeeSonoffTemp:
|
|
45
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.TemperaturSensor);
|
|
46
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.HumiditySensor);
|
|
47
|
+
break;
|
|
48
|
+
case deviceType_1.DeviceType.HmIpPraezenz:
|
|
49
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.PresenceDetection);
|
|
50
|
+
break;
|
|
51
|
+
case deviceType_1.DeviceType.HmIpGriff:
|
|
52
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Handle);
|
|
53
|
+
break;
|
|
54
|
+
case deviceType_1.DeviceType.HmIpHeizgruppe:
|
|
55
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Heater);
|
|
56
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.TemperaturSensor);
|
|
57
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.HumiditySensor);
|
|
58
|
+
break;
|
|
59
|
+
case deviceType_1.DeviceType.HmIpTuer:
|
|
60
|
+
case deviceType_1.DeviceType.ZigbeeSMaBiTMagnetContact:
|
|
61
|
+
case deviceType_1.DeviceType.ZigbeeAqaraMagnetContact:
|
|
62
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.MagnetContact);
|
|
63
|
+
break;
|
|
64
|
+
case deviceType_1.DeviceType.HmIpBewegung:
|
|
65
|
+
case deviceType_1.DeviceType.ZigbeeAquaraMotion:
|
|
66
|
+
case deviceType_1.DeviceType.ZigbeeSonoffMotion:
|
|
67
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.MotionDetection);
|
|
68
|
+
break;
|
|
69
|
+
case deviceType_1.DeviceType.ZigbeeIkeaSteckdose:
|
|
70
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Outlets);
|
|
71
|
+
break;
|
|
72
|
+
case deviceType_1.DeviceType.ZigbeeIlluLedRGBCCT:
|
|
73
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.LED);
|
|
74
|
+
break;
|
|
75
|
+
case deviceType_1.DeviceType.ZigbeeAquaraVibra:
|
|
76
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Vibration);
|
|
77
|
+
break;
|
|
78
|
+
case deviceType_1.DeviceType.ZigbeeHeimanSmoke:
|
|
79
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.SmokeDetector);
|
|
80
|
+
break;
|
|
81
|
+
case deviceType_1.DeviceType.ZigbeeAquaraWater:
|
|
82
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.WaterDetectors);
|
|
83
|
+
break;
|
|
84
|
+
case deviceType_1.DeviceType.ZigbeeBlitzShp:
|
|
85
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Outlets);
|
|
86
|
+
break;
|
|
87
|
+
case deviceType_1.DeviceType.ZigbeeIlluActuator: // Dependent on use case
|
|
88
|
+
case deviceType_1.DeviceType.HmIpTherm: // Humidity and temperatur not yet implemented
|
|
89
|
+
case deviceType_1.DeviceType.HmIpHeizung: // Setting/Controlling via HM-Ip Heizgruppe
|
|
90
|
+
case deviceType_1.DeviceType.unknown:
|
|
91
|
+
case deviceType_1.DeviceType.Wled: // TODO: Implement
|
|
92
|
+
case deviceType_1.DeviceType.HmIpAccessPoint: // You can't really do stuff with it.
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
for (const type of clusterTypes) {
|
|
96
|
+
this.addToList(type, device);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
addToList(type, device) {
|
|
100
|
+
var _a;
|
|
101
|
+
const list = (_a = this.deviceMap.get(type)) === null || _a === void 0 ? void 0 : _a.ids;
|
|
102
|
+
if (list !== undefined) {
|
|
103
|
+
if (list.indexOf(device.id) < 0) {
|
|
104
|
+
list.push(device.id);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
this.deviceMap.set(type, new device_list_1.DeviceList([device.id]));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
24
111
|
toJSON() {
|
|
25
112
|
const result = utils_1.Utils.jsonFilter(this);
|
|
26
113
|
result.deviceDict = Object.fromEntries(this.deviceMap);
|
|
@@ -32,5 +32,6 @@ var DeviceType;
|
|
|
32
32
|
DeviceType[DeviceType["ZigbeeSonoffMotion"] = 214] = "ZigbeeSonoffMotion";
|
|
33
33
|
DeviceType[DeviceType["ZigbeeAqaraMagnetContact"] = 215] = "ZigbeeAqaraMagnetContact";
|
|
34
34
|
DeviceType[DeviceType["ZigbeeSonoffTemp"] = 216] = "ZigbeeSonoffTemp";
|
|
35
|
+
DeviceType[DeviceType["ZigbeeAqaraOpple3Switch"] = 217] = "ZigbeeAqaraOpple3Switch";
|
|
35
36
|
DeviceType[DeviceType["Wled"] = 1001] = "Wled";
|
|
36
37
|
})(DeviceType = exports.DeviceType || (exports.DeviceType = {}));
|
|
@@ -34,6 +34,7 @@ const zigbeeSonoffMotion_1 = require("./zigbee/zigbeeSonoffMotion");
|
|
|
34
34
|
const hmIpAccessPoint_1 = require("./hmIPDevices/hmIpAccessPoint");
|
|
35
35
|
const zigbeeAqaraMagnetContact_1 = require("./zigbee/zigbeeAqaraMagnetContact");
|
|
36
36
|
const zigbeeSonoffTemp_1 = require("./zigbee/zigbeeSonoffTemp");
|
|
37
|
+
const zigbeeAqaraOpple3Switch_1 = require("./zigbee/zigbeeAqaraOpple3Switch");
|
|
37
38
|
class Devices {
|
|
38
39
|
constructor(pDeviceData, pRoomImportEnforcer) {
|
|
39
40
|
// This forces import of rooms at correct timing, to allow devices to land in proper rooms.
|
|
@@ -93,6 +94,9 @@ class Devices {
|
|
|
93
94
|
case 'AqaraMagnetContact':
|
|
94
95
|
d = new zigbeeAqaraMagnetContact_1.ZigbeeAqaraMagnetContact(zigbeeInfo);
|
|
95
96
|
break;
|
|
97
|
+
case 'AqaraOpple3Switch':
|
|
98
|
+
d = new zigbeeAqaraOpple3Switch_1.ZigbeeAqaraOpple3Switch(zigbeeInfo);
|
|
99
|
+
break;
|
|
96
100
|
case 'AquaraMotion':
|
|
97
101
|
d = new zigbeeAquaraMotion_1.ZigbeeAquaraMotion(zigbeeInfo);
|
|
98
102
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HmIpTaster } from '../hmIPDevices/hmIpTaster';
|
|
2
1
|
import { BaseGroup } from './base-group';
|
|
2
|
+
import { iButtonSwitch } from '../iButtonSwitch';
|
|
3
3
|
export declare class TasterGroup extends BaseGroup {
|
|
4
|
-
getButtons():
|
|
4
|
+
getButtons(): iButtonSwitch[];
|
|
5
5
|
constructor(roomName: string, buttonIds: string[]);
|
|
6
6
|
initCallbacks(): void;
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ const base_group_1 = require("./base-group");
|
|
|
5
5
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
6
6
|
const group_type_1 = require("./group-type");
|
|
7
7
|
const device_list_1 = require("../device-list");
|
|
8
|
+
const button_1 = require("../button");
|
|
8
9
|
class TasterGroup extends base_group_1.BaseGroup {
|
|
9
10
|
getButtons() {
|
|
10
11
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.Buttons);
|
|
@@ -15,36 +16,37 @@ class TasterGroup extends base_group_1.BaseGroup {
|
|
|
15
16
|
}
|
|
16
17
|
initCallbacks() {
|
|
17
18
|
this.getButtons().forEach((t) => {
|
|
18
|
-
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
20
|
+
(_a = t.buttonTopLeft) === null || _a === void 0 ? void 0 : _a.addCb(button_1.ButtonPressType.long, (pValue) => {
|
|
19
21
|
var _a;
|
|
20
22
|
pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloDown(false, true));
|
|
21
23
|
}, `Close all Rollos in this room`);
|
|
22
|
-
t.
|
|
24
|
+
(_b = t.buttonTopLeft) === null || _b === void 0 ? void 0 : _b.addCb(button_1.ButtonPressType.short, (pValue) => {
|
|
23
25
|
var _a;
|
|
24
26
|
pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(25, true));
|
|
25
27
|
}, `Nearly closes all Rollos in this room`);
|
|
26
|
-
t.
|
|
28
|
+
(_c = t.buttonTopRight) === null || _c === void 0 ? void 0 : _c.addCb(button_1.ButtonPressType.long, (pValue) => {
|
|
27
29
|
var _a;
|
|
28
30
|
if (!pValue) {
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
31
33
|
(_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloUp(true);
|
|
32
34
|
}, `Open all Rollos in this room`);
|
|
33
|
-
t.
|
|
35
|
+
(_d = t.buttonTopRight) === null || _d === void 0 ? void 0 : _d.addCb(button_1.ButtonPressType.short, (pValue) => {
|
|
34
36
|
var _a;
|
|
35
37
|
pValue && ((_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.allRolloToLevel(50, true));
|
|
36
38
|
}, `All Rollos in this room to middle`);
|
|
37
|
-
t.
|
|
39
|
+
(_e = t.buttonMidLeft) === null || _e === void 0 ? void 0 : _e.addCb(button_1.ButtonPressType.long, (pValue) => {
|
|
38
40
|
var _a;
|
|
39
41
|
pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true, true));
|
|
40
42
|
}, `Turn all Lights in this room on`);
|
|
41
|
-
t.
|
|
43
|
+
(_f = t.buttonMidRight) === null || _f === void 0 ? void 0 : _f.addCb(button_1.ButtonPressType.long, (pValue) => {
|
|
42
44
|
var _a;
|
|
43
45
|
pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false, true));
|
|
44
46
|
}, `Turn all Lights in this room off`);
|
|
45
47
|
const sonosGroup = this.getRoom().SonosGroup;
|
|
46
48
|
if (sonosGroup !== undefined && sonosGroup.getOwnSonosDevices().length > 0) {
|
|
47
|
-
t.
|
|
49
|
+
(_g = t.buttonBotRight) === null || _g === void 0 ? void 0 : _g.addCb(button_1.ButtonPressType.long, () => {
|
|
48
50
|
sonosGroup.trigger(this.getRoom().settings.radioUrl);
|
|
49
51
|
});
|
|
50
52
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { HmIPDevice } from './hmIpDevice';
|
|
3
3
|
import { DeviceInfo } from '../DeviceInfo';
|
|
4
4
|
import { TemperaturSettings } from '../../../models/temperaturSettings';
|
|
5
|
-
import { HmIpHeizung } from './hmIpHeizung';
|
|
6
5
|
import { iTemperaturSensor } from '../iTemperaturSensor';
|
|
7
6
|
import { iHumiditySensor } from '../iHumiditySensor';
|
|
8
|
-
|
|
7
|
+
import { iHeater } from '../iHeater';
|
|
8
|
+
export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperaturSensor, iHumiditySensor, iHeater {
|
|
9
9
|
private _automaticMode;
|
|
10
10
|
private _iAutomaticInterval;
|
|
11
11
|
private _level;
|
|
@@ -27,10 +27,10 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperaturSen
|
|
|
27
27
|
set desiredTemperatur(val: number);
|
|
28
28
|
addHumidityCallback(pCallback: (pValue: number) => void): void;
|
|
29
29
|
deleteAutomaticPoint(name: string): void;
|
|
30
|
-
getBelongingHeizungen():
|
|
30
|
+
getBelongingHeizungen(): iHeater[];
|
|
31
31
|
setAutomaticPoint(name: string, setting: TemperaturSettings): void;
|
|
32
32
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
33
33
|
stopAutomaticCheck(): void;
|
|
34
34
|
private updateBaseInformation;
|
|
35
|
-
|
|
35
|
+
checkAutomaticChange(): void;
|
|
36
36
|
}
|
|
@@ -4,9 +4,9 @@ exports.HmIpHeizgruppe = void 0;
|
|
|
4
4
|
const hmIpDevice_1 = require("./hmIpDevice");
|
|
5
5
|
const deviceType_1 = require("../deviceType");
|
|
6
6
|
const utils_1 = require("../../services/utils/utils");
|
|
7
|
-
const devices_1 = require("../devices");
|
|
8
7
|
const persist_1 = require("../../services/dbo/persist");
|
|
9
8
|
const logLevel_1 = require("../../../models/logLevel");
|
|
9
|
+
const device_cluster_type_1 = require("../device-cluster-type");
|
|
10
10
|
class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
11
11
|
constructor(pInfo) {
|
|
12
12
|
super(pInfo, deviceType_1.DeviceType.HmIpHeizgruppe);
|
|
@@ -64,13 +64,10 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
64
64
|
delete this._automaticPoints[name];
|
|
65
65
|
}
|
|
66
66
|
getBelongingHeizungen() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const d = devices_1.Devices.alLDevices[dID];
|
|
70
|
-
if (d.deviceType === deviceType_1.DeviceType.HmIpHeizung && d.info.room === this.info.room) {
|
|
71
|
-
result.push(d);
|
|
72
|
-
}
|
|
67
|
+
if (!this.room) {
|
|
68
|
+
return [];
|
|
73
69
|
}
|
|
70
|
+
const result = this.room.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Heater);
|
|
74
71
|
return result;
|
|
75
72
|
}
|
|
76
73
|
setAutomaticPoint(name, setting) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HmIpHeizung = void 0;
|
|
4
|
-
const hmIpDevice_1 = require("./hmIpDevice");
|
|
5
4
|
const deviceType_1 = require("../deviceType");
|
|
6
5
|
const logLevel_1 = require("../../../models/logLevel");
|
|
6
|
+
const hmIpDevice_1 = require("./hmIpDevice");
|
|
7
7
|
var HmIpHeizungAdaptionStates;
|
|
8
8
|
(function (HmIpHeizungAdaptionStates) {
|
|
9
9
|
HmIpHeizungAdaptionStates[HmIpHeizungAdaptionStates["StateNotAvailable"] = 0] = "StateNotAvailable";
|