hoffmation-base 3.2.0 → 3.2.1-alpha.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/action/baseAction.d.ts +1 -0
- package/lib/action/baseAction.js +3 -0
- package/lib/command/ShutterSetLevelCommand.d.ts +2 -1
- package/lib/command/WindowRestoreDesiredPositionCommand.d.ts +2 -1
- package/lib/command/WindowSetDesiredPositionCommand.d.ts +2 -1
- package/lib/command/WindowSetRolloByWeatherStatusCommand.d.ts +2 -1
- package/lib/command/actuatorSetStateCommand.d.ts +2 -1
- package/lib/command/actuatorToggleCommand.d.ts +2 -1
- package/lib/command/actuatorWriteStateToDeviceCommand.d.ts +2 -1
- package/lib/command/baseCommand.d.ts +10 -3
- package/lib/command/baseCommand.js +20 -1
- package/lib/command/blockAutomaticCommand.d.ts +2 -1
- package/lib/command/blockAutomaticLiftBlockCommand.d.ts +2 -1
- package/lib/command/blockAutomaticUntilCommand.d.ts +2 -1
- package/lib/command/dimmerSetLightCommand.d.ts +2 -2
- package/lib/command/floorSetAllShuttersCommand.d.ts +2 -1
- package/lib/command/iBaseCommand.d.ts +58 -0
- package/lib/command/iBaseCommand.js +2 -0
- package/lib/command/index.d.ts +1 -0
- package/lib/command/lampSetLightCommand.d.ts +2 -2
- package/lib/command/lampSetTimeBasedCommand.d.ts +2 -1
- package/lib/command/lampToggleLightCommand.d.ts +2 -2
- package/lib/command/ledSetLightCommand.d.ts +2 -2
- package/lib/command/lightGroupSwitchTimeConditionalCommand.d.ts +2 -1
- package/lib/command/restoreTargetAutomaticValueCommand.d.ts +2 -1
- package/lib/command/roomRestoreLightCommand.d.ts +2 -1
- package/lib/command/roomRestoreShutterPositionCommand.d.ts +2 -1
- package/lib/command/roomSetLightTimeBasedCommand.d.ts +2 -1
- package/lib/command/shutterSunriseUpCommand.d.ts +2 -1
- package/lib/command/shutterSunsetDownCommand.d.ts +2 -1
- package/lib/command/wledSetLightCommand.d.ts +2 -2
- package/lib/command/wledSetLightCommand.js +1 -1
- package/lib/devices/BaseDevice.d.ts +43 -0
- package/lib/devices/BaseDevice.js +92 -0
- package/lib/devices/CameraDevice.d.ts +6 -15
- package/lib/devices/CameraDevice.js +33 -51
- package/lib/devices/IoBrokerBaseDevice.d.ts +6 -34
- package/lib/devices/IoBrokerBaseDevice.js +5 -68
- package/lib/devices/RoomBaseDevice.d.ts +9 -0
- package/lib/devices/RoomBaseDevice.js +21 -0
- package/lib/devices/dachs/dachs.d.ts +4 -17
- package/lib/devices/dachs/dachs.js +12 -43
- package/lib/devices/dachs/dachsTemperatureSensor.d.ts +4 -19
- package/lib/devices/dachs/dachsTemperatureSensor.js +11 -37
- package/lib/devices/espresense/detectedBluetoothDevice.d.ts +5 -11
- package/lib/devices/espresense/detectedBluetoothDevice.js +15 -17
- package/lib/devices/espresense/espresenseDevice.d.ts +3 -19
- package/lib/devices/espresense/espresenseDevice.js +11 -45
- package/lib/devices/govee/own-govee-device.d.ts +5 -18
- package/lib/devices/govee/own-govee-device.js +30 -69
- package/lib/devices/groups/heatGroup.js +1 -1
- package/lib/devices/groups/lightGroup.js +1 -1
- package/lib/devices/hmIPDevices/hmIpLampe.js +1 -1
- package/lib/devices/hmIPDevices/hmIpRoll.js +2 -2
- package/lib/devices/index.d.ts +1 -0
- package/lib/devices/index.js +3 -1
- package/lib/devices/scene/room-scene.d.ts +2 -23
- package/lib/devices/scene/room-scene.js +12 -57
- package/lib/devices/sharedFunctions/lampUtils.js +4 -3
- package/lib/devices/shelly/shellyActuator.js +1 -1
- package/lib/devices/tv/tvDevice.d.ts +4 -16
- package/lib/devices/tv/tvDevice.js +12 -36
- package/lib/devices/velux/veluxShutter.js +1 -1
- package/lib/devices/victron/victron-device.d.ts +2 -15
- package/lib/devices/victron/victron-device.js +11 -43
- package/lib/devices/wledDevice.js +2 -2
- package/lib/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -1
- package/lib/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +0 -3
- package/lib/devices/zigbee/BaseDevices/zigbeeShutter.js +4 -11
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/interfaces/baseDevices/iAcDevice.d.ts +4 -0
- package/lib/interfaces/baseDevices/iBaseDevice.d.ts +11 -1
- package/lib/services/Sonos/own-sonos-device.d.ts +4 -14
- package/lib/services/Sonos/own-sonos-device.js +8 -46
- package/lib/services/ac/ac-device.d.ts +6 -22
- package/lib/services/ac/ac-device.js +23 -53
- package/lib/services/ac/own-daikin-device.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/utils.d.ts +2 -1
- package/lib/utils/utils.js +15 -2
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { iIdHolder } from '../iIdHolder';
|
|
2
2
|
import { iDeviceSettings } from '../deviceSettings';
|
|
3
|
-
import { DeviceCapability, DeviceType } from '../../enums';
|
|
3
|
+
import { DeviceCapability, DeviceType, LogDebugType, LogLevel } from '../../enums';
|
|
4
4
|
import { iDeviceInfo } from '../iDeviceInfo';
|
|
5
|
+
import { RingStorage } from '../../utils';
|
|
6
|
+
import { iBaseCommand } from '../../command';
|
|
5
7
|
/**
|
|
6
8
|
* This is the main interface for all devices as it ensures certain base functionality.
|
|
7
9
|
*/
|
|
@@ -10,6 +12,10 @@ export interface iBaseDevice extends iIdHolder {
|
|
|
10
12
|
* The settings of the device which are overridden by the specific device implementation
|
|
11
13
|
*/
|
|
12
14
|
readonly settings: iDeviceSettings | undefined;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
readonly lastCommands: RingStorage<iBaseCommand>;
|
|
13
19
|
/**
|
|
14
20
|
* The hardware-type of the device.
|
|
15
21
|
*/
|
|
@@ -22,6 +28,10 @@ export interface iBaseDevice extends iIdHolder {
|
|
|
22
28
|
* The capabilities of the device thus referencing other interfaces which then can be used to treat devices regardless of their hardware-type.
|
|
23
29
|
*/
|
|
24
30
|
readonly deviceCapabilities: DeviceCapability[];
|
|
31
|
+
/**
|
|
32
|
+
* Logs a executed/cancelled Command
|
|
33
|
+
*/
|
|
34
|
+
logCommand(c: iBaseCommand, ignoreReason?: string, logDebugType?: LogDebugType, logLevel?: LogLevel): void;
|
|
25
35
|
/**
|
|
26
36
|
* This method writes the device Info to the configured persistence layer, to ensure having foreign keys for all other persisted data.
|
|
27
37
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DeviceType } from '../../enums';
|
|
2
|
+
import { iSpeaker } from '../../interfaces';
|
|
3
|
+
import { RoomBaseDevice, SonosDeviceSettings } from '../../devices';
|
|
4
4
|
import { SonosDevice } from '@svrooij/sonos/lib';
|
|
5
|
-
export declare class OwnSonosDevice implements iSpeaker {
|
|
5
|
+
export declare class OwnSonosDevice extends RoomBaseDevice implements iSpeaker {
|
|
6
6
|
device: SonosDevice | undefined;
|
|
7
7
|
/** @inheritDoc */
|
|
8
8
|
settings: SonosDeviceSettings;
|
|
@@ -10,13 +10,7 @@ export declare class OwnSonosDevice implements iSpeaker {
|
|
|
10
10
|
readonly deviceType: DeviceType;
|
|
11
11
|
/** @inheritDoc */
|
|
12
12
|
readonly discoveryName: string;
|
|
13
|
-
/** @inheritDoc */
|
|
14
|
-
readonly deviceCapabilities: DeviceCapability[];
|
|
15
|
-
get customName(): string;
|
|
16
13
|
constructor(discoveryName: string, roomName: string, device: SonosDevice | undefined);
|
|
17
|
-
protected _info: DeviceInfo;
|
|
18
|
-
get info(): DeviceInfo;
|
|
19
|
-
get room(): iRoomBase | undefined;
|
|
20
14
|
get id(): string;
|
|
21
15
|
get name(): string;
|
|
22
16
|
playOnDevice(mp3Name: string, duration: number, volume?: number | undefined, onlyWhenPlaying?: boolean | undefined, resolveAfterRevert?: boolean | undefined): void;
|
|
@@ -24,8 +18,4 @@ export declare class OwnSonosDevice implements iSpeaker {
|
|
|
24
18
|
speakOnDevice(pMessage: string, volume?: number | undefined, onlyWhenPlaying?: boolean | undefined, resolveAfterRevert?: boolean | undefined): void;
|
|
25
19
|
stop(): void;
|
|
26
20
|
playUrl(url: string): void;
|
|
27
|
-
log(level: LogLevel, message: string, debugType?: LogDebugType): void;
|
|
28
|
-
toJSON(): Partial<OwnSonosDevice>;
|
|
29
|
-
persistDeviceInfo(): void;
|
|
30
|
-
loadDeviceSettings(): void;
|
|
31
21
|
}
|
|
@@ -1,46 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.OwnSonosDevice = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
4
|
const enums_1 = require("../../enums");
|
|
9
5
|
const devices_1 = require("../../devices");
|
|
10
|
-
const api_1 = require("../../api");
|
|
11
6
|
const settings_service_1 = require("../../settings-service");
|
|
12
7
|
const logging_1 = require("../../logging");
|
|
13
8
|
const utils_1 = require("../../utils");
|
|
14
9
|
const sonos_service_1 = require("./sonos-service");
|
|
15
10
|
const polly_service_1 = require("./polly-service");
|
|
16
|
-
|
|
17
|
-
class OwnSonosDevice {
|
|
18
|
-
get customName() {
|
|
19
|
-
return this.info.customName;
|
|
20
|
-
}
|
|
11
|
+
class OwnSonosDevice extends devices_1.RoomBaseDevice {
|
|
21
12
|
constructor(discoveryName, roomName, device) {
|
|
13
|
+
const info = new devices_1.DeviceInfo();
|
|
14
|
+
info.fullName = `Sonos ${roomName} ${discoveryName}`;
|
|
15
|
+
info.customName = `Sonos ${discoveryName}`;
|
|
16
|
+
info.room = roomName;
|
|
17
|
+
info.allDevicesKey = `sonos-${roomName}-${discoveryName}`;
|
|
18
|
+
super(info, enums_1.DeviceType.Sonos);
|
|
22
19
|
this.device = device;
|
|
23
20
|
/** @inheritDoc */
|
|
24
21
|
this.settings = new devices_1.SonosDeviceSettings();
|
|
25
22
|
/** @inheritDoc */
|
|
26
23
|
this.deviceType = enums_1.DeviceType.Sonos;
|
|
27
|
-
|
|
28
|
-
this.deviceCapabilities = [enums_1.DeviceCapability.speaker];
|
|
24
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.speaker);
|
|
29
25
|
this.discoveryName = discoveryName;
|
|
30
|
-
this._info = new devices_1.DeviceInfo();
|
|
31
|
-
this._info.fullName = `Sonos ${roomName} ${discoveryName}`;
|
|
32
|
-
this._info.customName = `Sonos ${discoveryName}`;
|
|
33
|
-
this._info.room = roomName;
|
|
34
|
-
this._info.allDevicesKey = `sonos-${roomName}-${discoveryName}`;
|
|
35
26
|
devices_1.Devices.alLDevices[`sonos-${roomName}-${discoveryName}`] = this;
|
|
36
|
-
this.persistDeviceInfo();
|
|
37
|
-
utils_1.Utils.guardedTimeout(this.loadDeviceSettings, 4500, this);
|
|
38
|
-
}
|
|
39
|
-
get info() {
|
|
40
|
-
return this._info;
|
|
41
|
-
}
|
|
42
|
-
get room() {
|
|
43
|
-
return api_1.API.getRoom(this.info.room);
|
|
44
27
|
}
|
|
45
28
|
get id() {
|
|
46
29
|
var _a;
|
|
@@ -101,26 +84,5 @@ class OwnSonosDevice {
|
|
|
101
84
|
var _a;
|
|
102
85
|
(_a = this.device) === null || _a === void 0 ? void 0 : _a.SetAVTransportURI(url);
|
|
103
86
|
}
|
|
104
|
-
log(level, message, debugType = enums_1.LogDebugType.None) {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
logging_1.ServerLogService.writeLog(level, `${this.name}: ${message}`, {
|
|
107
|
-
debugType: debugType,
|
|
108
|
-
room: (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.roomName) !== null && _b !== void 0 ? _b : '',
|
|
109
|
-
deviceId: this.name,
|
|
110
|
-
deviceName: this.name,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
toJSON() {
|
|
114
|
-
return utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['room']));
|
|
115
|
-
}
|
|
116
|
-
persistDeviceInfo() {
|
|
117
|
-
utils_1.Utils.guardedTimeout(() => {
|
|
118
|
-
var _a;
|
|
119
|
-
(_a = dbo_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
|
|
120
|
-
}, 5000, this);
|
|
121
|
-
}
|
|
122
|
-
loadDeviceSettings() {
|
|
123
|
-
this.settings.initializeFromDb(this);
|
|
124
|
-
}
|
|
125
87
|
}
|
|
126
88
|
exports.OwnSonosDevice = OwnSonosDevice;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AcSettings,
|
|
2
|
-
import { iAcDevice, iExcessEnergyConsumer,
|
|
3
|
-
import { AcDeviceType, AcMode,
|
|
1
|
+
import { AcSettings, RoomBaseDevice } from '../../devices';
|
|
2
|
+
import { iAcDevice, iExcessEnergyConsumer, iTemporaryDisableAutomatic } from '../../interfaces';
|
|
3
|
+
import { AcDeviceType, AcMode, DeviceType } from '../../enums';
|
|
4
4
|
import { BlockAutomaticHandler } from '../blockAutomaticHandler';
|
|
5
5
|
import { ExcessEnergyConsumerSettings } from '../../settingsObjects';
|
|
6
|
-
export declare abstract class AcDevice implements iExcessEnergyConsumer,
|
|
6
|
+
export declare abstract class AcDevice extends RoomBaseDevice implements iExcessEnergyConsumer, iAcDevice, iTemporaryDisableAutomatic {
|
|
7
7
|
ip: string;
|
|
8
8
|
acDeviceType: AcDeviceType;
|
|
9
9
|
/** @inheritDoc */
|
|
@@ -11,13 +11,9 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
|
|
|
11
11
|
/** @inheritDoc */
|
|
12
12
|
settings: AcSettings;
|
|
13
13
|
/** @inheritDoc */
|
|
14
|
-
deviceCapabilities: DeviceCapability[];
|
|
15
|
-
/** @inheritDoc */
|
|
16
14
|
readonly blockAutomationHandler: BlockAutomaticHandler;
|
|
17
15
|
protected _activatedByExcessEnergy: boolean;
|
|
18
16
|
protected _desiredTemperatur: number;
|
|
19
|
-
protected _info: DeviceInfo;
|
|
20
|
-
protected _room: iRoomBase | undefined;
|
|
21
17
|
protected _mode: AcMode;
|
|
22
18
|
private _movementCallbackAdded;
|
|
23
19
|
/**
|
|
@@ -35,21 +31,14 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
|
|
|
35
31
|
/** @inheritDoc */
|
|
36
32
|
get customName(): string;
|
|
37
33
|
/** @inheritDoc */
|
|
38
|
-
get room(): iRoomBase | undefined;
|
|
39
|
-
/** @inheritDoc */
|
|
40
|
-
set room(room: iRoomBase | undefined);
|
|
41
|
-
/** @inheritDoc */
|
|
42
34
|
get mode(): AcMode;
|
|
43
|
-
protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType);
|
|
35
|
+
protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType, deviceType: DeviceType);
|
|
44
36
|
/** @inheritDoc */
|
|
45
37
|
get energySettings(): ExcessEnergyConsumerSettings;
|
|
46
38
|
private _roomTemperature;
|
|
47
39
|
/** @inheritDoc */
|
|
48
40
|
get roomTemperature(): number;
|
|
49
|
-
/** @inheritDoc */
|
|
50
|
-
get info(): DeviceInfo;
|
|
51
41
|
protected set roomTemperatur(val: number);
|
|
52
|
-
abstract get deviceType(): DeviceType;
|
|
53
42
|
/**
|
|
54
43
|
* The name of this device
|
|
55
44
|
* @returns The human readable name of this device
|
|
@@ -58,6 +47,7 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
|
|
|
58
47
|
/** @inheritDoc */
|
|
59
48
|
get id(): string;
|
|
60
49
|
abstract get on(): boolean;
|
|
50
|
+
initializeRoomCbs(): void;
|
|
61
51
|
/** @inheritDoc */
|
|
62
52
|
restoreTargetAutomaticValue(): void;
|
|
63
53
|
/** @inheritDoc */
|
|
@@ -86,13 +76,7 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
|
|
|
86
76
|
*/
|
|
87
77
|
setState(mode: AcMode, desiredTemp?: number, forceTime?: number): void;
|
|
88
78
|
/** @inheritDoc */
|
|
89
|
-
log(level: LogLevel, message: string, debugType?: LogDebugType): void;
|
|
90
|
-
/** @inheritDoc */
|
|
91
79
|
wasActivatedByExcessEnergy(): boolean;
|
|
92
|
-
/** @inheritDoc */
|
|
93
|
-
loadDeviceSettings(): void;
|
|
94
|
-
/** @inheritDoc */
|
|
95
|
-
persistDeviceInfo(): void;
|
|
96
80
|
protected automaticCheck(): void;
|
|
97
81
|
private onRoomAnyMovement;
|
|
98
82
|
private onRoomLastLeave;
|
|
@@ -14,8 +14,7 @@ const settings_service_1 = require("../../settings-service");
|
|
|
14
14
|
const weather_1 = require("../weather");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const dbo_1 = require("../dbo");
|
|
17
|
-
|
|
18
|
-
class AcDevice {
|
|
17
|
+
class AcDevice extends devices_1.RoomBaseDevice {
|
|
19
18
|
/**
|
|
20
19
|
* Whether the AC is allowed to cool (depends on the season
|
|
21
20
|
* @returns {boolean} True if the AC is allowed to cool
|
|
@@ -48,47 +47,31 @@ class AcDevice {
|
|
|
48
47
|
return this.info.customName;
|
|
49
48
|
}
|
|
50
49
|
/** @inheritDoc */
|
|
51
|
-
get room() {
|
|
52
|
-
return this._room;
|
|
53
|
-
}
|
|
54
|
-
/** @inheritDoc */
|
|
55
|
-
set room(room) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
this._room = room;
|
|
58
|
-
if (room !== undefined && !this._movementCallbackAdded) {
|
|
59
|
-
this._movementCallbackAdded = true;
|
|
60
|
-
// TODO: Maybe change to any Movement
|
|
61
|
-
(_a = room === null || room === void 0 ? void 0 : room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.addAnyMovementCallback(this.onRoomAnyMovement.bind(this));
|
|
62
|
-
(_b = room === null || room === void 0 ? void 0 : room.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.addLastLeftCallback(this.onRoomLastLeave.bind(this));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/** @inheritDoc */
|
|
66
50
|
get mode() {
|
|
67
51
|
return this._mode;
|
|
68
52
|
}
|
|
69
|
-
constructor(name, roomName, ip, acDeviceType) {
|
|
53
|
+
constructor(name, roomName, ip, acDeviceType, deviceType) {
|
|
54
|
+
const info = new devices_1.DeviceInfo();
|
|
55
|
+
info.fullName = `AC ${name}`;
|
|
56
|
+
info.customName = `${roomName} ${name}`;
|
|
57
|
+
info.room = roomName;
|
|
58
|
+
info.allDevicesKey = `ac-${roomName}-${name}`;
|
|
59
|
+
super(info, deviceType);
|
|
70
60
|
this.ip = ip;
|
|
71
61
|
this.acDeviceType = acDeviceType;
|
|
72
62
|
/** @inheritDoc */
|
|
73
63
|
this.currentConsumption = -1;
|
|
74
64
|
/** @inheritDoc */
|
|
75
65
|
this.settings = new devices_1.AcSettings();
|
|
76
|
-
/** @inheritDoc */
|
|
77
|
-
this.deviceCapabilities = [enums_1.DeviceCapability.ac, enums_1.DeviceCapability.blockAutomatic];
|
|
78
66
|
this._activatedByExcessEnergy = false;
|
|
79
67
|
this._desiredTemperatur = interfaces_1.UNDEFINED_TEMP_VALUE;
|
|
80
68
|
this._mode = enums_1.AcMode.Off;
|
|
81
69
|
this._movementCallbackAdded = false;
|
|
82
70
|
this._roomTemperature = 0;
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this._info.customName = `${roomName} ${name}`;
|
|
86
|
-
this._info.room = roomName;
|
|
87
|
-
this._info.allDevicesKey = `ac-${roomName}-${name}`;
|
|
71
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.ac);
|
|
72
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.blockAutomatic);
|
|
88
73
|
utils_1.Utils.guardedInterval(this.automaticCheck, 5 * 60 * 1000, this, false);
|
|
89
74
|
utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
|
|
90
|
-
this.persistDeviceInfo();
|
|
91
|
-
utils_1.Utils.guardedTimeout(this.loadDeviceSettings, 4500, this);
|
|
92
75
|
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
93
76
|
}
|
|
94
77
|
/** @inheritDoc */
|
|
@@ -99,10 +82,6 @@ class AcDevice {
|
|
|
99
82
|
get roomTemperature() {
|
|
100
83
|
return this._roomTemperature;
|
|
101
84
|
}
|
|
102
|
-
/** @inheritDoc */
|
|
103
|
-
get info() {
|
|
104
|
-
return this._info;
|
|
105
|
-
}
|
|
106
85
|
set roomTemperatur(val) {
|
|
107
86
|
this._roomTemperature = val;
|
|
108
87
|
}
|
|
@@ -118,6 +97,18 @@ class AcDevice {
|
|
|
118
97
|
var _a;
|
|
119
98
|
return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `ac-${this.info.room}-${this.info.customName}`;
|
|
120
99
|
}
|
|
100
|
+
initializeRoomCbs() {
|
|
101
|
+
if (this._movementCallbackAdded) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
utils_1.Utils.guardedFunction(() => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
// TODO: Maybe change to any Movement
|
|
107
|
+
(_a = this.room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.addAnyMovementCallback(this.onRoomAnyMovement.bind(this));
|
|
108
|
+
(_b = this.room.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.addLastLeftCallback(this.onRoomLastLeave.bind(this));
|
|
109
|
+
this._movementCallbackAdded = true;
|
|
110
|
+
}, this);
|
|
111
|
+
}
|
|
121
112
|
/** @inheritDoc */
|
|
122
113
|
restoreTargetAutomaticValue() {
|
|
123
114
|
this.log(enums_1.LogLevel.Debug, 'Restore Target Automatic value');
|
|
@@ -269,30 +260,9 @@ class AcDevice {
|
|
|
269
260
|
this.turnOn();
|
|
270
261
|
}
|
|
271
262
|
/** @inheritDoc */
|
|
272
|
-
log(level, message, debugType = enums_1.LogDebugType.None) {
|
|
273
|
-
var _a, _b;
|
|
274
|
-
logging_1.ServerLogService.writeLog(level, `${this.name}: ${message}`, {
|
|
275
|
-
debugType: debugType,
|
|
276
|
-
room: (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.roomName) !== null && _b !== void 0 ? _b : '',
|
|
277
|
-
deviceId: this.name,
|
|
278
|
-
deviceName: this.name,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
/** @inheritDoc */
|
|
282
263
|
wasActivatedByExcessEnergy() {
|
|
283
264
|
return this._activatedByExcessEnergy;
|
|
284
265
|
}
|
|
285
|
-
/** @inheritDoc */
|
|
286
|
-
loadDeviceSettings() {
|
|
287
|
-
this.settings.initializeFromDb(this);
|
|
288
|
-
}
|
|
289
|
-
/** @inheritDoc */
|
|
290
|
-
persistDeviceInfo() {
|
|
291
|
-
utils_1.Utils.guardedTimeout(() => {
|
|
292
|
-
var _a;
|
|
293
|
-
(_a = dbo_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
|
|
294
|
-
}, 5000, this);
|
|
295
|
-
}
|
|
296
266
|
automaticCheck() {
|
|
297
267
|
var _a, _b;
|
|
298
268
|
if (this.blockAutomationHandler.automaticBlockActive) {
|
|
@@ -331,7 +301,7 @@ class AcDevice {
|
|
|
331
301
|
/** @inheritDoc */
|
|
332
302
|
toJSON() {
|
|
333
303
|
// eslint-disable-next-line
|
|
334
|
-
const result = lodash_1.default.omit(
|
|
304
|
+
const result = lodash_1.default.omit(super.toJSON(), ['room', '_room']);
|
|
335
305
|
result['on'] = this.on;
|
|
336
306
|
return utils_1.Utils.jsonFilter(result);
|
|
337
307
|
}
|
|
@@ -15,7 +15,7 @@ const daikin_service_1 = require("./daikin-service");
|
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
17
17
|
constructor(name, roomName, ip, _device, _mac = undefined) {
|
|
18
|
-
super(name, roomName, ip, enums_1.AcDeviceType.Daikin);
|
|
18
|
+
super(name, roomName, ip, enums_1.AcDeviceType.Daikin, enums_1.DeviceType.Daikin);
|
|
19
19
|
this._device = _device;
|
|
20
20
|
this._mac = _mac;
|
|
21
21
|
/**
|
|
@@ -194,7 +194,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
194
194
|
/** @inheritDoc */
|
|
195
195
|
toJSON() {
|
|
196
196
|
// eslint-disable-next-line
|
|
197
|
-
const result = lodash_1.default.omit(
|
|
197
|
+
const result = lodash_1.default.omit(super.toJSON(), ['device', '_device']);
|
|
198
198
|
result['on'] = this.on;
|
|
199
199
|
return utils_1.Utils.jsonFilter(result);
|
|
200
200
|
}
|