hoffmation-base 3.0.0-alpha.76 → 3.0.0-alpha.78
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/device-cluster.js +1 -0
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/deviceUpdater.js +8 -0
- package/lib/server/devices/devices.d.ts +5 -0
- package/lib/server/devices/devices.js +16 -5
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/server/devices/velux/index.d.ts +4 -0
- package/lib/server/devices/velux/index.js +11 -0
- package/lib/server/devices/velux/veluxDevice.d.ts +13 -0
- package/lib/server/devices/velux/veluxDevice.js +43 -0
- package/lib/server/devices/velux/veluxDeviceRegistrationInfo.d.ts +9 -0
- package/lib/server/devices/velux/veluxDeviceRegistrationInfo.js +13 -0
- package/lib/server/devices/velux/veluxService.d.ts +7 -0
- package/lib/server/devices/velux/veluxService.js +44 -0
- package/lib/server/devices/velux/veluxShutter.d.ts +27 -0
- package/lib/server/devices/velux/veluxShutter.js +122 -0
- package/lib/server/services/ShutterService.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
|
@@ -51,6 +51,7 @@ class DeviceCluster {
|
|
|
51
51
|
case deviceType_1.DeviceType.HmIpRoll:
|
|
52
52
|
case deviceType_1.DeviceType.ZigbeeIlluShutter:
|
|
53
53
|
case deviceType_1.DeviceType.ZigbeeUbisysShutter:
|
|
54
|
+
case deviceType_1.DeviceType.VeluxShutter:
|
|
54
55
|
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Shutter);
|
|
55
56
|
break;
|
|
56
57
|
case deviceType_1.DeviceType.ZigbeeSonoffTemp:
|
|
@@ -50,6 +50,7 @@ var DeviceType;
|
|
|
50
50
|
DeviceType[DeviceType["SmartGardenValve"] = 601] = "SmartGardenValve";
|
|
51
51
|
DeviceType[DeviceType["SmartGardenMower"] = 602] = "SmartGardenMower";
|
|
52
52
|
DeviceType[DeviceType["SmartGardenSensor"] = 603] = "SmartGardenSensor";
|
|
53
|
+
DeviceType[DeviceType["VeluxShutter"] = 701] = "VeluxShutter";
|
|
53
54
|
DeviceType[DeviceType["WledDevice"] = 1001] = "WledDevice";
|
|
54
55
|
DeviceType[DeviceType["GoveeLed"] = 1002] = "GoveeLed";
|
|
55
56
|
DeviceType[DeviceType["Daikin"] = 2001] = "Daikin";
|
|
@@ -48,6 +48,14 @@ class DeviceUpdater {
|
|
|
48
48
|
classifier = devices_1.Devices.IDENTIFIER_SMART_GARDEN;
|
|
49
49
|
devId = idSplit[3].replace(/-2D/g, '-');
|
|
50
50
|
}
|
|
51
|
+
else if (idSplit[0] == devices_1.Devices.IDENTIFIER_VELUX) {
|
|
52
|
+
if (idSplit[1] === 'admin' || idSplit[2].indexOf('DEVICE') !== 0) {
|
|
53
|
+
// This is no update for a velux device
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
classifier = devices_1.Devices.IDENTIFIER_VELUX;
|
|
57
|
+
devId = idSplit[3];
|
|
58
|
+
}
|
|
51
59
|
const allDevicesKey = `${classifier}-${devId}`;
|
|
52
60
|
const device = services_1.API.getDevice(allDevicesKey, false);
|
|
53
61
|
if (typeof device === 'undefined' || device.update === undefined) {
|
|
@@ -35,6 +35,10 @@ export declare class Devices {
|
|
|
35
35
|
* A constant for the identifier of SmartGarden devices.
|
|
36
36
|
*/
|
|
37
37
|
static readonly IDENTIFIER_SMART_GARDEN: string;
|
|
38
|
+
/**
|
|
39
|
+
* A constant for the identifier of Velux Adapter devices.
|
|
40
|
+
*/
|
|
41
|
+
static readonly IDENTIFIER_VELUX: string;
|
|
38
42
|
/**
|
|
39
43
|
* A Map containing all devices
|
|
40
44
|
*/
|
|
@@ -65,6 +69,7 @@ export declare class Devices {
|
|
|
65
69
|
private static processShellyDevice;
|
|
66
70
|
private static processTuyaDevice;
|
|
67
71
|
private static processZigbeeDevice;
|
|
72
|
+
private static processVeluxDevice;
|
|
68
73
|
private static processSmartGardenDevice;
|
|
69
74
|
private static processWledDevice;
|
|
70
75
|
private static processHMIPDevice;
|
|
@@ -13,6 +13,7 @@ const DeviceCapability_1 = require("./DeviceCapability");
|
|
|
13
13
|
const shelly_1 = require("./shelly");
|
|
14
14
|
const tuya_1 = require("./tuya");
|
|
15
15
|
const smartGarden_1 = require("./smartGarden");
|
|
16
|
+
const velux_1 = require("./velux");
|
|
16
17
|
class Devices {
|
|
17
18
|
constructor(pDeviceData, pRoomImportEnforcer, config) {
|
|
18
19
|
var _a;
|
|
@@ -21,14 +22,17 @@ class Devices {
|
|
|
21
22
|
services_1.ServerLogService.writeLog(models_1.LogLevel.Info, 'Constructing devices now');
|
|
22
23
|
for (const cID in pDeviceData) {
|
|
23
24
|
const cDevConf = pDeviceData[cID];
|
|
24
|
-
if (!cDevConf.common ||
|
|
25
|
-
!cDevConf.common.name ||
|
|
26
|
-
typeof cDevConf.common.name === 'object' ||
|
|
27
|
-
!cDevConf.type ||
|
|
28
|
-
cDevConf.type === 'channel') {
|
|
25
|
+
if (!cDevConf.common || !cDevConf.common.name || typeof cDevConf.common.name === 'object' || !cDevConf.type) {
|
|
29
26
|
continue;
|
|
30
27
|
}
|
|
31
28
|
const cName = cDevConf.common.name;
|
|
29
|
+
if (cDevConf.type === 'channel') {
|
|
30
|
+
// Velux has the name in the root channel of a device
|
|
31
|
+
if (cName.indexOf('00-Velux') === 0) {
|
|
32
|
+
Devices.processVeluxDevice(cDevConf);
|
|
33
|
+
}
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
32
36
|
if (cName.indexOf('00-HmIP') === 0) {
|
|
33
37
|
Devices.processHMIPDevice(cDevConf);
|
|
34
38
|
}
|
|
@@ -228,6 +232,9 @@ class Devices {
|
|
|
228
232
|
}
|
|
229
233
|
Devices.alLDevices[fullName] = d;
|
|
230
234
|
}
|
|
235
|
+
static processVeluxDevice(cDevConf) {
|
|
236
|
+
velux_1.VeluxService.processVeluxDevice(cDevConf);
|
|
237
|
+
}
|
|
231
238
|
static processSmartGardenDevice(cDevConf) {
|
|
232
239
|
smartGarden_1.SmartGardenService.processSmartGardenDevice(cDevConf);
|
|
233
240
|
}
|
|
@@ -338,6 +345,10 @@ Devices.IDENTIFIER_WLED = 'wled';
|
|
|
338
345
|
* A constant for the identifier of SmartGarden devices.
|
|
339
346
|
*/
|
|
340
347
|
Devices.IDENTIFIER_SMART_GARDEN = 'smartgarden';
|
|
348
|
+
/**
|
|
349
|
+
* A constant for the identifier of Velux Adapter devices.
|
|
350
|
+
*/
|
|
351
|
+
Devices.IDENTIFIER_VELUX = 'klf200';
|
|
341
352
|
/**
|
|
342
353
|
* A Map containing all devices
|
|
343
354
|
*/
|
|
@@ -13,6 +13,7 @@ export * from './shelly/index';
|
|
|
13
13
|
export * from './smartGarden/index';
|
|
14
14
|
export * from './tuya/index';
|
|
15
15
|
export * from './tv/index';
|
|
16
|
+
export * from './velux/index';
|
|
16
17
|
export * from './zigbee/index';
|
|
17
18
|
export * from './device-cluster';
|
|
18
19
|
export * from './device-cluster-type';
|
|
@@ -30,6 +30,7 @@ __exportStar(require("./shelly/index"), exports);
|
|
|
30
30
|
__exportStar(require("./smartGarden/index"), exports);
|
|
31
31
|
__exportStar(require("./tuya/index"), exports);
|
|
32
32
|
__exportStar(require("./tv/index"), exports);
|
|
33
|
+
__exportStar(require("./velux/index"), exports);
|
|
33
34
|
__exportStar(require("./zigbee/index"), exports);
|
|
34
35
|
__exportStar(require("./device-cluster"), exports);
|
|
35
36
|
__exportStar(require("./device-cluster-type"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeluxService = exports.VeluxDeviceRegistrationInfo = exports.VeluxShutter = exports.VeluxDevice = void 0;
|
|
4
|
+
var veluxDevice_1 = require("./veluxDevice");
|
|
5
|
+
Object.defineProperty(exports, "VeluxDevice", { enumerable: true, get: function () { return veluxDevice_1.VeluxDevice; } });
|
|
6
|
+
var veluxShutter_1 = require("./veluxShutter");
|
|
7
|
+
Object.defineProperty(exports, "VeluxShutter", { enumerable: true, get: function () { return veluxShutter_1.VeluxShutter; } });
|
|
8
|
+
var veluxDeviceRegistrationInfo_1 = require("./veluxDeviceRegistrationInfo");
|
|
9
|
+
Object.defineProperty(exports, "VeluxDeviceRegistrationInfo", { enumerable: true, get: function () { return veluxDeviceRegistrationInfo_1.VeluxDeviceRegistrationInfo; } });
|
|
10
|
+
var veluxService_1 = require("./veluxService");
|
|
11
|
+
Object.defineProperty(exports, "VeluxService", { enumerable: true, get: function () { return veluxService_1.VeluxService; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
2
|
+
import { iDisposable } from '../../services';
|
|
3
|
+
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
|
+
import { DeviceType } from '../deviceType';
|
|
5
|
+
export declare class VeluxDevice extends IoBrokerBaseDevice implements iDisposable {
|
|
6
|
+
private _lastUpdate;
|
|
7
|
+
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
8
|
+
get lastUpdate(): Date;
|
|
9
|
+
/** @inheritDoc */
|
|
10
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
11
|
+
/** @inheritDoc */
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeluxDevice = void 0;
|
|
4
|
+
const IoBrokerBaseDevice_1 = require("../IoBrokerBaseDevice");
|
|
5
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
class VeluxDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
8
|
+
constructor(pInfo, pType) {
|
|
9
|
+
super(pInfo, pType);
|
|
10
|
+
this._lastUpdate = new Date(0);
|
|
11
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
12
|
+
}
|
|
13
|
+
get lastUpdate() {
|
|
14
|
+
return this._lastUpdate;
|
|
15
|
+
}
|
|
16
|
+
/** @inheritDoc */
|
|
17
|
+
update(idSplit, state, initial = false, pOverride = false) {
|
|
18
|
+
this.log(models_1.LogLevel.DeepTrace, `Velux: ${initial ? 'Initiales ' : ''}Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
19
|
+
if (!pOverride) {
|
|
20
|
+
this.log(models_1.LogLevel.Warn, `Keine Update Überschreibung:\n\tID: ${idSplit.join('.')}\n\tData: ${JSON.stringify(state)}`);
|
|
21
|
+
}
|
|
22
|
+
const stateLastUpdate = new Date(state.ts);
|
|
23
|
+
if (stateLastUpdate > this._lastUpdate) {
|
|
24
|
+
this._lastUpdate = stateLastUpdate;
|
|
25
|
+
}
|
|
26
|
+
if (idSplit.length < 5) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const stateName = idSplit[4];
|
|
30
|
+
this.stateMap.set(stateName, state);
|
|
31
|
+
const individualCallbacks = this.individualStateCallbacks.get(stateName);
|
|
32
|
+
if (individualCallbacks !== undefined) {
|
|
33
|
+
for (const cb of individualCallbacks) {
|
|
34
|
+
cb(state.val);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** @inheritDoc */
|
|
39
|
+
dispose() {
|
|
40
|
+
// Nothing yet
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.VeluxDevice = VeluxDevice;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeviceType } from '../deviceType';
|
|
2
|
+
export declare class VeluxDeviceRegistrationInfo {
|
|
3
|
+
readonly deviceType: DeviceType;
|
|
4
|
+
readonly deviceId: string;
|
|
5
|
+
readonly deviceName: string;
|
|
6
|
+
readonly room: string;
|
|
7
|
+
readonly roomIndex: number;
|
|
8
|
+
constructor(deviceType: DeviceType, deviceId: string, deviceName: string, room: string, roomIndex: number);
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeluxDeviceRegistrationInfo = void 0;
|
|
4
|
+
class VeluxDeviceRegistrationInfo {
|
|
5
|
+
constructor(deviceType, deviceId, deviceName, room, roomIndex) {
|
|
6
|
+
this.deviceType = deviceType;
|
|
7
|
+
this.deviceId = deviceId;
|
|
8
|
+
this.deviceName = deviceName;
|
|
9
|
+
this.room = room;
|
|
10
|
+
this.roomIndex = roomIndex;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.VeluxDeviceRegistrationInfo = VeluxDeviceRegistrationInfo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { deviceConfig } from '../../../models';
|
|
2
|
+
import { VeluxDeviceRegistrationInfo } from './veluxDeviceRegistrationInfo';
|
|
3
|
+
export declare class VeluxService {
|
|
4
|
+
private static readonly _registeredDevices;
|
|
5
|
+
static preRegisterDevice(devName: string, registrationInfo: VeluxDeviceRegistrationInfo): void;
|
|
6
|
+
static processVeluxDevice(cDevConf: deviceConfig): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeluxService = void 0;
|
|
4
|
+
const models_1 = require("../../../models");
|
|
5
|
+
const services_1 = require("../../services");
|
|
6
|
+
const IoBrokerDeviceInfo_1 = require("../IoBrokerDeviceInfo");
|
|
7
|
+
const deviceType_1 = require("../deviceType");
|
|
8
|
+
const devices_1 = require("../devices");
|
|
9
|
+
const veluxShutter_1 = require("./veluxShutter");
|
|
10
|
+
class VeluxService {
|
|
11
|
+
static preRegisterDevice(devName, registrationInfo) {
|
|
12
|
+
this._registeredDevices.set(devName, registrationInfo);
|
|
13
|
+
}
|
|
14
|
+
static processVeluxDevice(cDevConf) {
|
|
15
|
+
var _a;
|
|
16
|
+
const devName = (_a = cDevConf.common) === null || _a === void 0 ? void 0 : _a.name;
|
|
17
|
+
if (!devName || typeof devName !== 'string') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const registrationInfo = this._registeredDevices.get(devName);
|
|
21
|
+
if (!registrationInfo) {
|
|
22
|
+
services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Velux Device ${devName} not registered`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const ioBrokerDeviceInfo = new IoBrokerDeviceInfo_1.IoBrokerDeviceInfo(cDevConf, registrationInfo.deviceId, deviceType_1.DeviceType[registrationInfo.deviceType], registrationInfo.room, registrationInfo.roomIndex);
|
|
26
|
+
const fullName = `${devices_1.Devices.IDENTIFIER_VELUX}-${ioBrokerDeviceInfo.devID}`;
|
|
27
|
+
if (typeof devices_1.Devices.alLDevices[fullName] !== 'undefined') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
ioBrokerDeviceInfo.allDevicesKey = fullName;
|
|
31
|
+
let d;
|
|
32
|
+
switch (registrationInfo.deviceType) {
|
|
33
|
+
case deviceType_1.DeviceType.VeluxShutter:
|
|
34
|
+
d = new veluxShutter_1.VeluxShutter(ioBrokerDeviceInfo);
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
services_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `No Velux Device Type for ${registrationInfo.deviceType} defined`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
devices_1.Devices.alLDevices[fullName] = d;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.VeluxService = VeluxService;
|
|
44
|
+
VeluxService._registeredDevices = new Map();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Window } from '../groups';
|
|
2
|
+
import { ShutterSetLevelCommand, ShutterSettings } from '../../../models';
|
|
3
|
+
import { iShutter } from '../baseDeviceInterfaces';
|
|
4
|
+
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
5
|
+
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
|
+
import { VeluxDevice } from './veluxDevice';
|
|
7
|
+
export declare class VeluxShutter extends VeluxDevice implements iShutter {
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
settings: ShutterSettings;
|
|
10
|
+
private readonly _setLevelSwitchID;
|
|
11
|
+
private _firstCommandRecieved;
|
|
12
|
+
private _setLevel;
|
|
13
|
+
private _setLevelTime;
|
|
14
|
+
private _currentLevel;
|
|
15
|
+
private _window?;
|
|
16
|
+
constructor(pInfo: IoBrokerDeviceInfo);
|
|
17
|
+
get currentLevel(): number;
|
|
18
|
+
get window(): Window | undefined;
|
|
19
|
+
set window(value: Window | undefined);
|
|
20
|
+
get desiredWindowShutterLevel(): number;
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
23
|
+
persist(): void;
|
|
24
|
+
setLevel(command: ShutterSetLevelCommand): void;
|
|
25
|
+
toJSON(): Partial<IoBrokerBaseDevice>;
|
|
26
|
+
private setCurrentLevel;
|
|
27
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VeluxShutter = void 0;
|
|
7
|
+
const deviceType_1 = require("../deviceType");
|
|
8
|
+
const services_1 = require("../../services");
|
|
9
|
+
const models_1 = require("../models");
|
|
10
|
+
const models_2 = require("../../../models");
|
|
11
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
12
|
+
const DeviceCapability_1 = require("../DeviceCapability");
|
|
13
|
+
const veluxDevice_1 = require("./veluxDevice");
|
|
14
|
+
class VeluxShutter extends veluxDevice_1.VeluxDevice {
|
|
15
|
+
constructor(pInfo) {
|
|
16
|
+
var _a;
|
|
17
|
+
super(pInfo, deviceType_1.DeviceType.VeluxShutter);
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
this.settings = new models_2.ShutterSettings();
|
|
20
|
+
this._firstCommandRecieved = false;
|
|
21
|
+
this._setLevel = -1;
|
|
22
|
+
this._setLevelTime = -1;
|
|
23
|
+
this._currentLevel = -1;
|
|
24
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.shutter);
|
|
25
|
+
this._setLevelSwitchID = `${this.info.fullID}.targetPosition`;
|
|
26
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getLastDesiredPosition(this).then((val) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (val.desiredPosition === -1) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
(_a = this._window) === null || _a === void 0 ? void 0 : _a.setDesiredPosition(new models_2.WindowSetDesiredPositionCommand(models_2.CommandSource.Automatic, val.desiredPosition, 'Found persisted last desired position in DB'));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
get currentLevel() {
|
|
35
|
+
if (this._setLevel !== -1 && this._currentLevel !== this._setLevel) {
|
|
36
|
+
return this._setLevel;
|
|
37
|
+
}
|
|
38
|
+
return this._currentLevel;
|
|
39
|
+
}
|
|
40
|
+
get window() {
|
|
41
|
+
return this._window;
|
|
42
|
+
}
|
|
43
|
+
set window(value) {
|
|
44
|
+
this._window = value;
|
|
45
|
+
}
|
|
46
|
+
get desiredWindowShutterLevel() {
|
|
47
|
+
if (this._window === undefined) {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
return this._window.desiredPosition;
|
|
51
|
+
}
|
|
52
|
+
/** @inheritDoc */
|
|
53
|
+
update(idSplit, state, initial = false) {
|
|
54
|
+
this.log(models_2.LogLevel.DeepTrace, `Rollo Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
55
|
+
super.update(idSplit, state, initial, true);
|
|
56
|
+
switch (idSplit[4]) {
|
|
57
|
+
case 'targetPosition':
|
|
58
|
+
this.setCurrentLevel(state.val, true);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
persist() {
|
|
63
|
+
var _a;
|
|
64
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistShutter(this);
|
|
65
|
+
}
|
|
66
|
+
setLevel(command) {
|
|
67
|
+
let targetLevel = command.level;
|
|
68
|
+
if (!this._firstCommandRecieved && !command.isInitial) {
|
|
69
|
+
this._firstCommandRecieved = true;
|
|
70
|
+
}
|
|
71
|
+
if (this._firstCommandRecieved && command.isInitial) {
|
|
72
|
+
this.log(models_2.LogLevel.Debug, `Skipped initial Rollo to ${targetLevel} as we recieved a command already`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (this.currentLevel === targetLevel && !command.isForceAction) {
|
|
76
|
+
this.log(models_2.LogLevel.Debug, `Skip Rollo command to Position ${targetLevel} as this is the current one, commandLog: ${command.logMessage}`, services_1.LogDebugType.SkipUnchangedRolloPosition);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (this._setLevelSwitchID === '') {
|
|
80
|
+
this.log(models_2.LogLevel.Error, 'Keine Switch ID bekannt.');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!this.checkIoConnection(true)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.log(models_2.LogLevel.Debug, command.logMessage);
|
|
87
|
+
if (this._window !== undefined) {
|
|
88
|
+
if (this._window.griffeInPosition(models_1.WindowPosition.offen) > 0 && command.level < 100) {
|
|
89
|
+
if (!command.skipOpenWarning) {
|
|
90
|
+
this.log(models_2.LogLevel.Alert, 'Not closing the shutter, as the window is open!');
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (this._window.griffeInPosition(models_1.WindowPosition.kipp) > 0 && targetLevel < 50) {
|
|
95
|
+
targetLevel = 50;
|
|
96
|
+
if (!command.skipOpenWarning) {
|
|
97
|
+
this.log(models_2.LogLevel.Alert, 'Not closing the shutter, as the window is half open!');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
this._setLevel = targetLevel;
|
|
102
|
+
this.log(models_2.LogLevel.Debug, `Fahre Rollo auf Position ${targetLevel}`);
|
|
103
|
+
this.setState(this._setLevelSwitchID, targetLevel);
|
|
104
|
+
}
|
|
105
|
+
toJSON() {
|
|
106
|
+
return lodash_1.default.omit(super.toJSON(), ['_window']);
|
|
107
|
+
}
|
|
108
|
+
setCurrentLevel(value, initial = false) {
|
|
109
|
+
if (value !== this._setLevel && services_1.Utils.nowMS() - this._setLevelTime < 60 * 10000) {
|
|
110
|
+
value = this._setLevel;
|
|
111
|
+
}
|
|
112
|
+
if (value !== this._currentLevel && this._window && !initial) {
|
|
113
|
+
services_1.Utils.guardedNewThread(() => {
|
|
114
|
+
var _a;
|
|
115
|
+
(_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(new models_2.ShutterPositionChangedAction(this, value));
|
|
116
|
+
}, this);
|
|
117
|
+
this.persist();
|
|
118
|
+
}
|
|
119
|
+
this._currentLevel = value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.VeluxShutter = VeluxShutter;
|
|
@@ -46,6 +46,7 @@ class ShutterService {
|
|
|
46
46
|
const d = devices_1.Devices.alLDevices[dID];
|
|
47
47
|
if (d.deviceType === devices_1.DeviceType.HmIpRoll ||
|
|
48
48
|
d.deviceType === devices_1.DeviceType.ZigbeeIlluShutter ||
|
|
49
|
+
d.deviceType === devices_1.DeviceType.VeluxShutter ||
|
|
49
50
|
d.deviceType === devices_1.DeviceType.ZigbeeUbisysShutter) {
|
|
50
51
|
rollos.push(d);
|
|
51
52
|
}
|