hoffmation-base 1.0.43 → 1.0.46
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/DeviceCapability.d.ts +17 -0
- package/lib/server/devices/DeviceCapability.js +21 -0
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +4 -4
- package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +15 -0
- package/lib/server/devices/baseDeviceInterfaces/iActuator.js +2 -0
- package/lib/server/devices/baseDeviceInterfaces/iBaseDevice.d.ts +4 -4
- package/lib/server/devices/baseDeviceInterfaces/iButtonSwitch.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.d.ts +16 -0
- package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.js +2 -0
- package/lib/server/devices/baseDeviceInterfaces/iEnergyManager.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iHandleSensor.d.ts +9 -0
- package/lib/server/devices/baseDeviceInterfaces/iHandleSensor.js +2 -0
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +4 -4
- package/lib/server/devices/baseDeviceInterfaces/iMotionSensor.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iSpeaker.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/iVibrationSensor.d.ts +2 -2
- package/lib/server/devices/baseDeviceInterfaces/index.d.ts +2 -0
- package/lib/server/devices/baseDeviceInterfaces/index.js +2 -0
- package/lib/server/devices/device-cluster.d.ts +4 -4
- package/lib/server/devices/device-list.d.ts +2 -2
- package/lib/server/devices/deviceUpdater.js +2 -1
- package/lib/server/devices/devices.d.ts +2 -2
- package/lib/server/devices/groups/lampenGroup.d.ts +3 -3
- package/lib/server/devices/groups/lampenGroup.js +3 -3
- package/lib/server/devices/hmIPDevices/hmIpBewegung.js +3 -3
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +4 -3
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +4 -4
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpRoll.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpTaster.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpWippe.js +2 -2
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +2 -2
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +4 -3
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +2 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +2 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +2 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +2 -2
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +2 -2
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +2 -2
- package/lib/server/devices/zigbee/zigbeeBlitzShp.js +2 -2
- package/lib/server/devices/zigbee/zigbeeIkeaSteckdose.d.ts +0 -3
- package/lib/server/devices/zigbee/zigbeeIkeaSteckdose.js +0 -9
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +2 -2
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +3 -2
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +2 -2
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +3 -3
- package/lib/server/services/Sonos/own-sonos-device.d.ts +2 -2
- package/lib/server/services/Sonos/own-sonos-device.js +2 -2
- package/lib/server/services/ac/ac-device.d.ts +4 -4
- package/lib/server/services/ac/ac-device.js +2 -2
- package/lib/server/services/api/api-service.d.ts +22 -4
- package/lib/server/services/api/api-service.js +57 -4
- package/lib/server/services/room-service/room-service.d.ts +3 -2
- package/lib/server/services/room-service/room-service.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/lib/server/devices/DeviceCapabilities.d.ts +0 -15
- package/lib/server/devices/DeviceCapabilities.js +0 -19
|
@@ -5,7 +5,7 @@ const zigbeeDevice_1 = require("./zigbeeDevice");
|
|
|
5
5
|
const baseDeviceInterfaces_1 = require("../../baseDeviceInterfaces");
|
|
6
6
|
const models_1 = require("../../../../models");
|
|
7
7
|
const services_1 = require("../../../services");
|
|
8
|
-
const
|
|
8
|
+
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
9
9
|
class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
10
10
|
constructor(pInfo, pType) {
|
|
11
11
|
super(pInfo, pType);
|
|
@@ -19,7 +19,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
19
19
|
this._seasonTurnOff = false;
|
|
20
20
|
this._humidity = 0;
|
|
21
21
|
this._roomTemperatur = 0;
|
|
22
|
-
this.deviceCapabilities.push(
|
|
22
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
23
23
|
this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
|
|
24
24
|
services_1.TimeCallbackService.addCallback(new models_1.TimeCallback(`${this.info.fullID} Season Check`, models_1.TimeCallbackType.TimeOfDay, () => {
|
|
25
25
|
this.checkSeasonTurnOff();
|
|
@@ -4,7 +4,7 @@ exports.ZigbeeMotionSensor = void 0;
|
|
|
4
4
|
const index_1 = require("./index");
|
|
5
5
|
const models_1 = require("../../../../models");
|
|
6
6
|
const services_1 = require("../../../services");
|
|
7
|
-
const
|
|
7
|
+
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
8
8
|
class ZigbeeMotionSensor extends index_1.ZigbeeDevice {
|
|
9
9
|
constructor(pInfo, type) {
|
|
10
10
|
var _a;
|
|
@@ -16,7 +16,7 @@ class ZigbeeMotionSensor extends index_1.ZigbeeDevice {
|
|
|
16
16
|
this._needsMovementResetFallback = true;
|
|
17
17
|
this._timeSinceLastMotion = 0;
|
|
18
18
|
this._detectionsToday = 0;
|
|
19
|
-
this.deviceCapabilities.push(
|
|
19
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.motionSensor);
|
|
20
20
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getCount(this).then((todayCount) => {
|
|
21
21
|
this.detectionsToday = todayCount.counter;
|
|
22
22
|
this.log(models_1.LogLevel.Debug, `Preinitialized movement counter with ${this.detectionsToday}`);
|
|
@@ -9,7 +9,7 @@ const models_1 = require("../../../../models");
|
|
|
9
9
|
const zigbeeDevice_1 = require("./zigbeeDevice");
|
|
10
10
|
const models_2 = require("../../models");
|
|
11
11
|
const lodash_1 = __importDefault(require("lodash"));
|
|
12
|
-
const
|
|
12
|
+
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
13
13
|
class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
14
14
|
constructor(pInfo, pType) {
|
|
15
15
|
var _a;
|
|
@@ -21,7 +21,7 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
21
21
|
this._setLevelTime = -1;
|
|
22
22
|
this._shutterCalibrationData = new models_1.ShutterCalibration(this.info.fullID, 0, 0, 0, 0);
|
|
23
23
|
this._currentLevel = -1;
|
|
24
|
-
this.deviceCapabilities.push(
|
|
24
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.shutter);
|
|
25
25
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getShutterCalibration(this).then((calibrationData) => {
|
|
26
26
|
this._shutterCalibrationData = calibrationData;
|
|
27
27
|
this.log(models_1.LogLevel.DeepTrace, `ZigbeeShutter initialized with calibration data`);
|
|
@@ -5,14 +5,14 @@ const deviceType_1 = require("../deviceType");
|
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const BaseDevices_1 = require("./BaseDevices");
|
|
7
7
|
const services_1 = require("../../services");
|
|
8
|
-
const
|
|
8
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
9
|
class ZigbeeAquaraMotion extends BaseDevices_1.ZigbeeMotionSensor {
|
|
10
10
|
constructor(pInfo) {
|
|
11
11
|
super(pInfo, deviceType_1.DeviceType.ZigbeeAquaraMotion);
|
|
12
12
|
this._illuminance = 0;
|
|
13
13
|
this.occupancyTimeoutID = `occupancy_timeout`;
|
|
14
14
|
this._motionTimeout = 0;
|
|
15
|
-
this.deviceCapabilities.push(
|
|
15
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.illuminationSensor);
|
|
16
16
|
this.occupancyTimeoutID = `${this.info.fullID}.${this.occupancyTimeoutID}`;
|
|
17
17
|
}
|
|
18
18
|
// Time after the last trigger until a motion event gets triggered again
|
|
@@ -5,7 +5,7 @@ const deviceType_1 = require("../deviceType");
|
|
|
5
5
|
const services_1 = require("../../services");
|
|
6
6
|
const models_1 = require("../../../models");
|
|
7
7
|
const BaseDevices_1 = require("./BaseDevices");
|
|
8
|
-
const
|
|
8
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
9
|
class ZigbeeAquaraVibra extends BaseDevices_1.ZigbeeDevice {
|
|
10
10
|
constructor(pInfo) {
|
|
11
11
|
super(pInfo, deviceType_1.DeviceType.ZigbeeAquaraVibra);
|
|
@@ -24,7 +24,7 @@ class ZigbeeAquaraVibra extends BaseDevices_1.ZigbeeDevice {
|
|
|
24
24
|
// TODO Set Sensitivity
|
|
25
25
|
this._vibrationBlockedByGriff = false;
|
|
26
26
|
this._vibrationBlockedByMotion = false;
|
|
27
|
-
this.deviceCapabilities.push(
|
|
27
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.vibrationSensor);
|
|
28
28
|
this._alarmMessage = services_1.Res.vibrationAlarm(this.info.customName);
|
|
29
29
|
services_1.PollyService.preloadTTS(this._alarmMessage);
|
|
30
30
|
this._idSensitivity = `${this.info.fullID}.sensitivity`;
|
|
@@ -4,7 +4,7 @@ exports.ZigbeeBlitzShp = void 0;
|
|
|
4
4
|
const deviceType_1 = require("../deviceType");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const BaseDevices_1 = require("./BaseDevices");
|
|
7
|
-
const
|
|
7
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
8
8
|
class ZigbeeBlitzShp extends BaseDevices_1.ZigbeeDevice {
|
|
9
9
|
constructor(pInfo) {
|
|
10
10
|
super(pInfo, deviceType_1.DeviceType.ZigbeeBlitzShp);
|
|
@@ -17,7 +17,7 @@ class ZigbeeBlitzShp extends BaseDevices_1.ZigbeeDevice {
|
|
|
17
17
|
this._availableForExcessEnergy = true;
|
|
18
18
|
this.steckerOnSwitchID = '';
|
|
19
19
|
this._activatedByExcessEnergy = false;
|
|
20
|
-
this.deviceCapabilities.push(
|
|
20
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.excessEnergyConsumer);
|
|
21
21
|
this.steckerOnSwitchID = `${this.info.fullID}.state`;
|
|
22
22
|
}
|
|
23
23
|
get currentConsumption() {
|
|
@@ -3,8 +3,5 @@ import { ZigbeeActuator } from './BaseDevices';
|
|
|
3
3
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
4
|
export declare class ZigbeeIkeaSteckdose extends ZigbeeActuator {
|
|
5
5
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
6
|
-
get steckerOn(): boolean;
|
|
7
6
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
8
|
-
setStecker(pValue: boolean, timeout?: number, force?: boolean): void;
|
|
9
|
-
toggleStecker(force?: boolean): boolean;
|
|
10
7
|
}
|
|
@@ -8,18 +8,9 @@ class ZigbeeIkeaSteckdose extends BaseDevices_1.ZigbeeActuator {
|
|
|
8
8
|
constructor(pInfo) {
|
|
9
9
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIkeaSteckdose, `${pInfo.fullID}.state`);
|
|
10
10
|
}
|
|
11
|
-
get steckerOn() {
|
|
12
|
-
return super.actuatorOn;
|
|
13
|
-
}
|
|
14
11
|
update(idSplit, state, initial = false) {
|
|
15
12
|
this.log(models_1.LogLevel.DeepTrace, `Stecker Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
16
13
|
super.update(idSplit, state, initial, true);
|
|
17
14
|
}
|
|
18
|
-
setStecker(pValue, timeout = -1, force = false) {
|
|
19
|
-
super.setActuator(pValue, timeout, force);
|
|
20
|
-
}
|
|
21
|
-
toggleStecker(force = false) {
|
|
22
|
-
return super.toggleActuator(force);
|
|
23
|
-
}
|
|
24
15
|
}
|
|
25
16
|
exports.ZigbeeIkeaSteckdose = ZigbeeIkeaSteckdose;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
2
|
import { DimmerSettings, TimeOfDay } from '../../../models';
|
|
3
|
-
import { iLamp } from '../baseDeviceInterfaces';
|
|
4
3
|
import { ZigbeeDevice } from './BaseDevices';
|
|
5
4
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
|
-
|
|
5
|
+
import { iDimmableLamp } from '../baseDeviceInterfaces/iDimmableLamp';
|
|
6
|
+
export declare class ZigbeeIlluDimmer extends ZigbeeDevice implements iDimmableLamp {
|
|
7
7
|
lightOn: boolean;
|
|
8
8
|
queuedValue: boolean | null;
|
|
9
9
|
brightness: number;
|
|
@@ -5,7 +5,7 @@ const models_1 = require("../../../models");
|
|
|
5
5
|
const deviceType_1 = require("../deviceType");
|
|
6
6
|
const services_1 = require("../../services");
|
|
7
7
|
const BaseDevices_1 = require("./BaseDevices");
|
|
8
|
-
const
|
|
8
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
9
|
class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
|
|
10
10
|
constructor(pInfo) {
|
|
11
11
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluDimmer);
|
|
@@ -19,7 +19,8 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
|
|
|
19
19
|
this.transitionID = 'transition_time';
|
|
20
20
|
this._turnOffTimeout = undefined;
|
|
21
21
|
this.turnOffTime = 0;
|
|
22
|
-
this.deviceCapabilities.push(
|
|
22
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
23
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
23
24
|
this.stateID = `${this.info.fullID}.state`;
|
|
24
25
|
this.brightnessID = `${this.info.fullID}.brightness`;
|
|
25
26
|
this.transitionID = `${this.info.fullID}.transition_time`;
|
|
@@ -5,11 +5,11 @@ const deviceType_1 = require("../deviceType");
|
|
|
5
5
|
const zigbeeIlluActuator_1 = require("./zigbeeIlluActuator");
|
|
6
6
|
const models_1 = require("../../../models");
|
|
7
7
|
const services_1 = require("../../services");
|
|
8
|
-
const
|
|
8
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
9
|
class ZigbeeIlluLampe extends zigbeeIlluActuator_1.ZigbeeIlluActuator {
|
|
10
10
|
constructor(pInfo) {
|
|
11
11
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluLampe);
|
|
12
|
-
this.deviceCapabilities.push(
|
|
12
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
13
13
|
}
|
|
14
14
|
get lightOn() {
|
|
15
15
|
return super.actuatorOn;
|
|
@@ -4,7 +4,7 @@ exports.ZigbeeSonoffTemp = void 0;
|
|
|
4
4
|
const BaseDevices_1 = require("./BaseDevices");
|
|
5
5
|
const baseDeviceInterfaces_1 = require("../baseDeviceInterfaces");
|
|
6
6
|
const deviceType_1 = require("../deviceType");
|
|
7
|
-
const
|
|
7
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
8
8
|
class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
|
|
9
9
|
constructor(pInfo) {
|
|
10
10
|
super(pInfo, deviceType_1.DeviceType.ZigbeeSonoffTemp);
|
|
@@ -12,8 +12,8 @@ class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
|
|
|
12
12
|
this._temperaturCallbacks = [];
|
|
13
13
|
this._humidity = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
14
14
|
this._temperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
15
|
-
this.deviceCapabilities.push(
|
|
16
|
-
this.deviceCapabilities.push(
|
|
15
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
16
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.humiditySensor);
|
|
17
17
|
}
|
|
18
18
|
get humidity() {
|
|
19
19
|
return this._humidity;
|
|
@@ -2,14 +2,14 @@ import { DeviceInfo, DeviceType, ISpeaker } from '../../devices';
|
|
|
2
2
|
import { LogLevel, RoomBase } from '../../../models';
|
|
3
3
|
import { SonosDevice } from '@svrooij/sonos/lib';
|
|
4
4
|
import { LogDebugType } from '../log-service';
|
|
5
|
-
import {
|
|
5
|
+
import { DeviceCapability } from '../../devices/DeviceCapability';
|
|
6
6
|
export declare class OwnSonosDevice implements ISpeaker {
|
|
7
7
|
device: SonosDevice | undefined;
|
|
8
8
|
maxPlayOnAllVolume: number;
|
|
9
9
|
room: RoomBase | undefined;
|
|
10
10
|
readonly deviceType: DeviceType;
|
|
11
11
|
readonly discoveryName: string;
|
|
12
|
-
readonly deviceCapabilities:
|
|
12
|
+
readonly deviceCapabilities: DeviceCapability[];
|
|
13
13
|
constructor(discoveryName: string, roomName: string, device: SonosDevice | undefined);
|
|
14
14
|
protected _info: DeviceInfo;
|
|
15
15
|
get info(): DeviceInfo;
|
|
@@ -10,7 +10,7 @@ const log_service_1 = require("../log-service");
|
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const lodash_1 = __importDefault(require("lodash"));
|
|
12
12
|
const sonos_service_1 = require("./sonos-service");
|
|
13
|
-
const
|
|
13
|
+
const DeviceCapability_1 = require("../../devices/DeviceCapability");
|
|
14
14
|
const settings_service_1 = require("../settings-service");
|
|
15
15
|
const polly_service_1 = require("./polly-service");
|
|
16
16
|
class OwnSonosDevice {
|
|
@@ -18,7 +18,7 @@ class OwnSonosDevice {
|
|
|
18
18
|
this.device = device;
|
|
19
19
|
this.maxPlayOnAllVolume = 80;
|
|
20
20
|
this.deviceType = devices_1.DeviceType.Sonos;
|
|
21
|
-
this.deviceCapabilities = [
|
|
21
|
+
this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.speaker];
|
|
22
22
|
this.discoveryName = discoveryName;
|
|
23
23
|
this._info = new devices_1.DeviceInfo();
|
|
24
24
|
this._info.fullName = `Sonos ${roomName} ${discoveryName}`;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { DeviceInfo, DeviceType, iAcDevice,
|
|
1
|
+
import { DeviceInfo, DeviceType, iAcDevice, iBaseDevice, iExcessEnergyConsumer } from '../../devices';
|
|
2
2
|
import { ExcessEnergyConsumerSettings, LogLevel, RoomBase } from '../../../models';
|
|
3
3
|
import { LogDebugType } from '../log-service';
|
|
4
4
|
import { AcMode } from './ac-mode';
|
|
5
5
|
import { AcSettings } from '../../../models/deviceSettings/acSettings';
|
|
6
6
|
import { AcDeviceType } from './acDeviceType';
|
|
7
|
-
import {
|
|
8
|
-
export declare abstract class AcDevice implements iExcessEnergyConsumer,
|
|
7
|
+
import { DeviceCapability } from '../../devices/DeviceCapability';
|
|
8
|
+
export declare abstract class AcDevice implements iExcessEnergyConsumer, iBaseDevice, iAcDevice {
|
|
9
9
|
ip: string;
|
|
10
10
|
acDeviceType: AcDeviceType;
|
|
11
11
|
currentConsumption: number;
|
|
12
12
|
energyConsumerSettings: ExcessEnergyConsumerSettings;
|
|
13
13
|
acSettings: AcSettings;
|
|
14
14
|
room: RoomBase | undefined;
|
|
15
|
-
deviceCapabilities:
|
|
15
|
+
deviceCapabilities: DeviceCapability[];
|
|
16
16
|
protected _info: DeviceInfo;
|
|
17
17
|
protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType);
|
|
18
18
|
get info(): DeviceInfo;
|
|
@@ -11,7 +11,7 @@ const log_service_1 = require("../log-service");
|
|
|
11
11
|
const ac_mode_1 = require("./ac-mode");
|
|
12
12
|
const acSettings_1 = require("../../../models/deviceSettings/acSettings");
|
|
13
13
|
const lodash_1 = __importDefault(require("lodash"));
|
|
14
|
-
const
|
|
14
|
+
const DeviceCapability_1 = require("../../devices/DeviceCapability");
|
|
15
15
|
class AcDevice {
|
|
16
16
|
constructor(name, roomName, ip, acDeviceType) {
|
|
17
17
|
this.ip = ip;
|
|
@@ -19,7 +19,7 @@ class AcDevice {
|
|
|
19
19
|
this.currentConsumption = -1;
|
|
20
20
|
this.energyConsumerSettings = new models_1.ExcessEnergyConsumerSettings();
|
|
21
21
|
this.acSettings = new acSettings_1.AcSettings();
|
|
22
|
-
this.deviceCapabilities = [
|
|
22
|
+
this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.ac];
|
|
23
23
|
this._activatedByExcessEnergy = false;
|
|
24
24
|
this._blockAutomaticTurnOnMS = -1;
|
|
25
25
|
this._info = new devices_1.DeviceInfo();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { iBaseDevice } from '../../devices';
|
|
2
2
|
import { RoomBase } from '../../../models';
|
|
3
3
|
import { LogObject } from '../log-service';
|
|
4
4
|
import { AcDevice } from '../ac';
|
|
@@ -10,9 +10,9 @@ export declare class API {
|
|
|
10
10
|
*/
|
|
11
11
|
static getAc(id: string): AcDevice | undefined;
|
|
12
12
|
static getDevices(): {
|
|
13
|
-
[id: string]:
|
|
13
|
+
[id: string]: iBaseDevice;
|
|
14
14
|
};
|
|
15
|
-
static getDevice(id: string):
|
|
15
|
+
static getDevice(id: string): iBaseDevice;
|
|
16
16
|
static getRooms(): Map<string, RoomBase>;
|
|
17
17
|
static getRoom(id: string): RoomBase | undefined;
|
|
18
18
|
static getLog(): LogObject[];
|
|
@@ -33,5 +33,23 @@ export declare class API {
|
|
|
33
33
|
* @param {boolean} state The desired new state
|
|
34
34
|
* @returns {Error | null} In case it failed the Error containing the reason
|
|
35
35
|
*/
|
|
36
|
-
static
|
|
36
|
+
static setLamp(deviceId: string, state: boolean): Error | null;
|
|
37
|
+
/**
|
|
38
|
+
* Changes the status of a given actuator
|
|
39
|
+
* @param {string} deviceId The device Id of the actuator
|
|
40
|
+
* @param {boolean} state The desired new state
|
|
41
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
42
|
+
*/
|
|
43
|
+
static setActuator(deviceId: string, state: boolean): Error | null;
|
|
44
|
+
/**
|
|
45
|
+
* Changes the status of a given actuator
|
|
46
|
+
* @param {string} deviceId The device Id of the actuator
|
|
47
|
+
* @param {boolean} state The desired new state
|
|
48
|
+
* @param timeout A chosen Timeout after which the light should be reset
|
|
49
|
+
* @param brightness The desired brightness
|
|
50
|
+
* @param transitionTime The transition time during turnOn/turnOff
|
|
51
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
52
|
+
*/
|
|
53
|
+
static setDimmer(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number): Error | null;
|
|
54
|
+
static setShutter(deviceId: string, level: number): Error | null;
|
|
37
55
|
}
|
|
@@ -6,6 +6,7 @@ const models_1 = require("../../../models");
|
|
|
6
6
|
const room_service_1 = require("../room-service");
|
|
7
7
|
const log_service_1 = require("../log-service");
|
|
8
8
|
const ac_1 = require("../ac");
|
|
9
|
+
const DeviceCapability_1 = require("../../devices/DeviceCapability");
|
|
9
10
|
class API {
|
|
10
11
|
/**
|
|
11
12
|
* Gets the instance of an Ac Device identified by id
|
|
@@ -14,7 +15,7 @@ class API {
|
|
|
14
15
|
*/
|
|
15
16
|
static getAc(id) {
|
|
16
17
|
const result = this.getDevice(id);
|
|
17
|
-
if (
|
|
18
|
+
if (!result.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.ac)) {
|
|
18
19
|
return undefined;
|
|
19
20
|
}
|
|
20
21
|
return result;
|
|
@@ -48,7 +49,11 @@ class API {
|
|
|
48
49
|
static setAc(id, desiredState) {
|
|
49
50
|
const d = this.getAc(id);
|
|
50
51
|
if (!d) {
|
|
51
|
-
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `
|
|
52
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `AC Device for id ${id} not found`);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.ac)) {
|
|
56
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Device for id ${id} is not an ac`);
|
|
52
57
|
return false;
|
|
53
58
|
}
|
|
54
59
|
if (desiredState) {
|
|
@@ -72,16 +77,64 @@ class API {
|
|
|
72
77
|
* @param {boolean} state The desired new state
|
|
73
78
|
* @returns {Error | null} In case it failed the Error containing the reason
|
|
74
79
|
*/
|
|
75
|
-
static
|
|
80
|
+
static setLamp(deviceId, state) {
|
|
76
81
|
const d = this.getDevice(deviceId);
|
|
77
82
|
if (d === undefined) {
|
|
78
83
|
return new Error(`Device with ID ${deviceId} not found`);
|
|
79
84
|
}
|
|
80
|
-
if (
|
|
85
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.lamp)) {
|
|
81
86
|
return new Error(`Device with ID ${deviceId} is no Lamp`);
|
|
82
87
|
}
|
|
83
88
|
d.setLight(state, 60 * 60 * 1000, true);
|
|
84
89
|
return null;
|
|
85
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Changes the status of a given actuator
|
|
93
|
+
* @param {string} deviceId The device Id of the actuator
|
|
94
|
+
* @param {boolean} state The desired new state
|
|
95
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
96
|
+
*/
|
|
97
|
+
static setActuator(deviceId, state) {
|
|
98
|
+
const d = this.getDevice(deviceId);
|
|
99
|
+
if (d === undefined) {
|
|
100
|
+
return new Error(`Device with ID ${deviceId} not found`);
|
|
101
|
+
}
|
|
102
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.actuator)) {
|
|
103
|
+
return new Error(`Device with ID ${deviceId} is no actuator`);
|
|
104
|
+
}
|
|
105
|
+
d.setActuator(state, 60 * 60 * 1000, true);
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Changes the status of a given actuator
|
|
110
|
+
* @param {string} deviceId The device Id of the actuator
|
|
111
|
+
* @param {boolean} state The desired new state
|
|
112
|
+
* @param timeout A chosen Timeout after which the light should be reset
|
|
113
|
+
* @param brightness The desired brightness
|
|
114
|
+
* @param transitionTime The transition time during turnOn/turnOff
|
|
115
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
116
|
+
*/
|
|
117
|
+
static setDimmer(deviceId, state, timeout, brightness, transitionTime) {
|
|
118
|
+
const d = this.getDevice(deviceId);
|
|
119
|
+
if (d === undefined) {
|
|
120
|
+
return new Error(`Device with ID ${deviceId} not found`);
|
|
121
|
+
}
|
|
122
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.dimmablelamp)) {
|
|
123
|
+
return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
|
|
124
|
+
}
|
|
125
|
+
d.setLight(state, timeout, true, brightness, transitionTime);
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
static setShutter(deviceId, level) {
|
|
129
|
+
const d = this.getDevice(deviceId);
|
|
130
|
+
if (d === undefined) {
|
|
131
|
+
return new Error(`Device with ID ${deviceId} not found`);
|
|
132
|
+
}
|
|
133
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.shutter)) {
|
|
134
|
+
return new Error(`Device with ID ${deviceId} is no Shutter`);
|
|
135
|
+
}
|
|
136
|
+
d.setLevel(level, false);
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
86
139
|
}
|
|
87
140
|
exports.API = API;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ringStorage } from '../utils';
|
|
2
2
|
import { iRoomBase, RoomBase } from '../../../models';
|
|
3
|
-
import {
|
|
3
|
+
import { iBaseDevice } from '../../devices';
|
|
4
4
|
export declare class RoomService {
|
|
5
5
|
static Rooms: Map<string, RoomBase>;
|
|
6
6
|
static awayModeActive: boolean;
|
|
@@ -25,12 +25,13 @@ export declare class RoomService {
|
|
|
25
25
|
* !!floor -1 sets all lamps in house instead!!
|
|
26
26
|
* @param floor the level on which all lamps shall be changed -1 equals all rooms
|
|
27
27
|
* @param status
|
|
28
|
+
* @param timeout
|
|
28
29
|
*/
|
|
29
30
|
static setAllLampsOfFloor(floor: number, status?: boolean, timeout?: number): void;
|
|
30
31
|
static clearAllAlarms(): void;
|
|
31
32
|
static startAwayMode(): void;
|
|
32
33
|
static startNightAlarmMode(): void;
|
|
33
|
-
static startIntrusionAlarm(room: iRoomBase, device:
|
|
34
|
+
static startIntrusionAlarm(room: iRoomBase, device: iBaseDevice): void;
|
|
34
35
|
static endAlarmModes(): void;
|
|
35
36
|
static getLastMovements(): string;
|
|
36
37
|
private static stopIntrusionAlarm;
|
|
@@ -32,6 +32,7 @@ class RoomService {
|
|
|
32
32
|
* !!floor -1 sets all lamps in house instead!!
|
|
33
33
|
* @param floor the level on which all lamps shall be changed -1 equals all rooms
|
|
34
34
|
* @param status
|
|
35
|
+
* @param timeout
|
|
35
36
|
*/
|
|
36
37
|
static setAllLampsOfFloor(floor, status = false, timeout) {
|
|
37
38
|
var _a, _b, _c, _d;
|