hoffmation-base 1.2.1 → 1.2.2

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.
@@ -0,0 +1,4 @@
1
+ import { DeviceSettings } from './deviceSettings';
2
+ export declare class SceneSettings extends DeviceSettings {
3
+ defaultTurnOffTimeout?: number;
4
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SceneSettings = void 0;
4
+ const deviceSettings_1 = require("./deviceSettings");
5
+ class SceneSettings extends deviceSettings_1.DeviceSettings {
6
+ }
7
+ exports.SceneSettings = SceneSettings;
@@ -19,5 +19,6 @@ export declare enum DeviceCapability {
19
19
  tv = 17,
20
20
  ledLamp = 18,
21
21
  bluetoothDetector = 101,
22
- trackableDevice = 102
22
+ trackableDevice = 102,
23
+ scene = 103
23
24
  }
@@ -24,4 +24,5 @@ var DeviceCapability;
24
24
  DeviceCapability[DeviceCapability["ledLamp"] = 18] = "ledLamp";
25
25
  DeviceCapability[DeviceCapability["bluetoothDetector"] = 101] = "bluetoothDetector";
26
26
  DeviceCapability[DeviceCapability["trackableDevice"] = 102] = "trackableDevice";
27
+ DeviceCapability[DeviceCapability["scene"] = 103] = "scene";
27
28
  })(DeviceCapability = exports.DeviceCapability || (exports.DeviceCapability = {}));
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import { iRoomDevice } from './index';
3
+ export interface iScene extends iRoomDevice {
4
+ readonly onSceneStart: () => void;
5
+ readonly onSceneEnd: () => void;
6
+ readonly on: boolean;
7
+ readonly automaticEndTimeout: NodeJS.Timeout | null;
8
+ startScene(timeout?: number): void;
9
+ endScene(): void;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,6 +12,7 @@ export * from './iIlluminationSensor';
12
12
  export * from './iLamp';
13
13
  export * from './iMotionSensor';
14
14
  export * from './iRoomDevice';
15
+ export * from './iScene';
15
16
  export * from './iShutter';
16
17
  export * from './iSpeaker';
17
18
  export * from './iTemperatureSensor';
@@ -28,6 +28,7 @@ __exportStar(require("./iIlluminationSensor"), exports);
28
28
  __exportStar(require("./iLamp"), exports);
29
29
  __exportStar(require("./iMotionSensor"), exports);
30
30
  __exportStar(require("./iRoomDevice"), exports);
31
+ __exportStar(require("./iScene"), exports);
31
32
  __exportStar(require("./iShutter"), exports);
32
33
  __exportStar(require("./iSpeaker"), exports);
33
34
  __exportStar(require("./iTemperatureSensor"), exports);
@@ -35,6 +35,7 @@ export declare enum DeviceType {
35
35
  ZigbeeLinkindLedRgbCct = 221,
36
36
  ZigbeeOsramDimmer = 222,
37
37
  JsEnergyManager = 301,
38
+ RoomScene = 401,
38
39
  WledDevice = 1001,
39
40
  Daikin = 2001,
40
41
  Sonos = 3001,
@@ -39,6 +39,7 @@ var DeviceType;
39
39
  DeviceType[DeviceType["ZigbeeLinkindLedRgbCct"] = 221] = "ZigbeeLinkindLedRgbCct";
40
40
  DeviceType[DeviceType["ZigbeeOsramDimmer"] = 222] = "ZigbeeOsramDimmer";
41
41
  DeviceType[DeviceType["JsEnergyManager"] = 301] = "JsEnergyManager";
42
+ DeviceType[DeviceType["RoomScene"] = 401] = "RoomScene";
42
43
  DeviceType[DeviceType["WledDevice"] = 1001] = "WledDevice";
43
44
  DeviceType[DeviceType["Daikin"] = 2001] = "Daikin";
44
45
  DeviceType[DeviceType["Sonos"] = 3001] = "Sonos";
@@ -5,6 +5,7 @@ export * from './groups/index';
5
5
  export * from './hmIPDevices/index';
6
6
  export * from './jsObject/index';
7
7
  export * from './models/index';
8
+ export * from './scene/index';
8
9
  export * from './zigbee/index';
9
10
  export * from './device-cluster';
10
11
  export * from './device-cluster-type';
@@ -21,6 +21,7 @@ __exportStar(require("./groups/index"), exports);
21
21
  __exportStar(require("./hmIPDevices/index"), exports);
22
22
  __exportStar(require("./jsObject/index"), exports);
23
23
  __exportStar(require("./models/index"), exports);
24
+ __exportStar(require("./scene/index"), exports);
24
25
  __exportStar(require("./zigbee/index"), exports);
25
26
  __exportStar(require("./device-cluster"), exports);
26
27
  __exportStar(require("./device-cluster-type"), exports);
@@ -0,0 +1 @@
1
+ export * from './room-scene';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./room-scene"), exports);
@@ -0,0 +1,36 @@
1
+ /// <reference types="node" />
2
+ import { iScene } from '../baseDeviceInterfaces';
3
+ import { LogLevel, RoomBase } from '../../../models';
4
+ import { TvDevice } from '../tv';
5
+ import { LogDebugType } from '../../services';
6
+ import { DeviceInfo } from '../DeviceInfo';
7
+ import { DeviceCapability } from '../DeviceCapability';
8
+ import { DeviceType } from '../deviceType';
9
+ import { SceneSettings } from '../../../models/deviceSettings/sceneSettings';
10
+ export declare class RoomScene implements iScene {
11
+ room: RoomBase | undefined;
12
+ settings: SceneSettings;
13
+ private readonly _onSceneStart;
14
+ private readonly _onSceneEnd;
15
+ constructor(name: string, roomName: string, onSceneStart: () => void, onSceneEnd: () => void, turnOffTimeout?: number);
16
+ protected _deviceType: DeviceType;
17
+ get deviceType(): DeviceType;
18
+ protected _info: DeviceInfo;
19
+ get info(): DeviceInfo;
20
+ set info(info: DeviceInfo);
21
+ private _automaticEndTimeout;
22
+ get automaticEndTimeout(): NodeJS.Timeout | null;
23
+ private _deviceCapabilities;
24
+ get deviceCapabilities(): DeviceCapability[];
25
+ private _on;
26
+ get on(): boolean;
27
+ get name(): string;
28
+ get id(): string;
29
+ get onSceneEnd(): () => void;
30
+ get onSceneStart(): () => void;
31
+ startScene(timeout?: number | undefined): void;
32
+ endScene(): void;
33
+ log(level: LogLevel, message: string, debugType?: LogDebugType): void;
34
+ persistDeviceInfo(): void;
35
+ toJSON(): Partial<TvDevice>;
36
+ }
@@ -0,0 +1,113 @@
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.RoomScene = void 0;
7
+ const models_1 = require("../../../models");
8
+ const services_1 = require("../../services");
9
+ const DeviceInfo_1 = require("../DeviceInfo");
10
+ const DeviceCapability_1 = require("../DeviceCapability");
11
+ const deviceType_1 = require("../deviceType");
12
+ const devices_1 = require("../devices");
13
+ const lodash_1 = __importDefault(require("lodash"));
14
+ const sceneSettings_1 = require("../../../models/deviceSettings/sceneSettings");
15
+ class RoomScene {
16
+ constructor(name, roomName, onSceneStart, onSceneEnd, turnOffTimeout) {
17
+ this.settings = new sceneSettings_1.SceneSettings();
18
+ this._automaticEndTimeout = null;
19
+ this._deviceCapabilities = [DeviceCapability_1.DeviceCapability.scene];
20
+ this._on = false;
21
+ this._onSceneStart = onSceneStart;
22
+ this._onSceneEnd = onSceneEnd;
23
+ this.settings.defaultTurnOffTimeout = turnOffTimeout;
24
+ this._info = new DeviceInfo_1.DeviceInfo();
25
+ this._info.fullName = `TV ${name}`;
26
+ this._info.customName = `${roomName} ${name}`;
27
+ this._info.room = roomName;
28
+ this._info.allDevicesKey = `tv-${roomName}-${name}`;
29
+ this._deviceType = deviceType_1.DeviceType.RoomScene;
30
+ devices_1.Devices.alLDevices[this._info.allDevicesKey] = this;
31
+ this.persistDeviceInfo();
32
+ }
33
+ get deviceType() {
34
+ return this._deviceType;
35
+ }
36
+ get info() {
37
+ return this._info;
38
+ }
39
+ set info(info) {
40
+ this._info = info;
41
+ }
42
+ get automaticEndTimeout() {
43
+ return this._automaticEndTimeout;
44
+ }
45
+ get deviceCapabilities() {
46
+ return this._deviceCapabilities;
47
+ }
48
+ get on() {
49
+ return this._on;
50
+ }
51
+ get name() {
52
+ return this.info.customName;
53
+ }
54
+ get id() {
55
+ var _a;
56
+ return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `ac-${this.info.room}-${this.info.customName}`;
57
+ }
58
+ get onSceneEnd() {
59
+ return this._onSceneEnd;
60
+ }
61
+ get onSceneStart() {
62
+ return this._onSceneStart;
63
+ }
64
+ startScene(timeout) {
65
+ if (this._automaticEndTimeout != null) {
66
+ clearTimeout(this._automaticEndTimeout);
67
+ this._automaticEndTimeout = null;
68
+ }
69
+ this._on = true;
70
+ this._onSceneStart();
71
+ const turnOffTimeout = timeout !== null && timeout !== void 0 ? timeout : this.settings.defaultTurnOffTimeout;
72
+ this.log(models_1.LogLevel.Info, `Starting scene (timeout: ${turnOffTimeout})`);
73
+ if (turnOffTimeout) {
74
+ this._automaticEndTimeout = services_1.Utils.guardedTimeout(() => {
75
+ this._automaticEndTimeout = null;
76
+ this.endScene();
77
+ }, turnOffTimeout, this);
78
+ }
79
+ }
80
+ endScene() {
81
+ if (this._automaticEndTimeout != null) {
82
+ clearTimeout(this._automaticEndTimeout);
83
+ this._automaticEndTimeout = null;
84
+ }
85
+ if (!this._on) {
86
+ return;
87
+ }
88
+ this.log(models_1.LogLevel.Info, `Ending scene`);
89
+ this._on = false;
90
+ this._onSceneEnd();
91
+ }
92
+ log(level, message, debugType = services_1.LogDebugType.None) {
93
+ var _a, _b;
94
+ services_1.ServerLogService.writeLog(level, `${this.name}: ${message}`, {
95
+ debugType: debugType,
96
+ room: (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.roomName) !== null && _b !== void 0 ? _b : '',
97
+ deviceId: this.name,
98
+ deviceName: this.name,
99
+ });
100
+ }
101
+ persistDeviceInfo() {
102
+ services_1.Utils.guardedTimeout(() => {
103
+ var _a;
104
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
105
+ }, 5000, this);
106
+ }
107
+ toJSON() {
108
+ // eslint-disable-next-line
109
+ const result = lodash_1.default.omit(this, ['room', '_onSceneStart', '_onSceneEnd']);
110
+ return services_1.Utils.jsonFilter(result);
111
+ }
112
+ }
113
+ exports.RoomScene = RoomScene;
@@ -5,10 +5,11 @@ import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
5
5
  import { iActuator } from '../../baseDeviceInterfaces';
6
6
  import { ZigbeeDevice } from './zigbeeDevice';
7
7
  export declare class ZigbeeActuator extends ZigbeeDevice implements iActuator {
8
+ private _actuatorOn;
8
9
  settings: ActuatorSettings;
9
10
  protected readonly actuatorOnSwitchID: string;
10
11
  protected queuedValue: boolean | null;
11
- actuatorOn: boolean;
12
+ get actuatorOn(): boolean;
12
13
  private _turnOffTimeout;
13
14
  private turnOffTime;
14
15
  constructor(pInfo: IoBrokerDeviceInfo, type: DeviceType, actuatorOnSwitchID: string);
@@ -8,14 +8,17 @@ const DeviceCapability_1 = require("../../DeviceCapability");
8
8
  class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
9
9
  constructor(pInfo, type, actuatorOnSwitchID) {
10
10
  super(pInfo, type);
11
+ this._actuatorOn = false;
11
12
  this.settings = new models_1.ActuatorSettings();
12
13
  this.queuedValue = null;
13
- this.actuatorOn = false;
14
14
  this._turnOffTimeout = undefined;
15
15
  this.turnOffTime = 0;
16
16
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.actuator);
17
17
  this.actuatorOnSwitchID = actuatorOnSwitchID;
18
18
  }
19
+ get actuatorOn() {
20
+ return this._actuatorOn;
21
+ }
19
22
  update(idSplit, state, initial = false, handledByChildObject = false) {
20
23
  if (!handledByChildObject) {
21
24
  this.log(models_1.LogLevel.DeepTrace, `Aktuator Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
@@ -27,7 +30,7 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
27
30
  if (!handledByChildObject) {
28
31
  this.log(models_1.LogLevel.Trace, `Aktor Update für ${this.info.customName} auf ${state.val}`);
29
32
  }
30
- this.actuatorOn = state.val;
33
+ this._actuatorOn = state.val;
31
34
  this.persist();
32
35
  break;
33
36
  }
@@ -41,7 +44,7 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
41
44
  this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleTimeString()}`);
42
45
  return;
43
46
  }
44
- if (!force && pValue === this.actuatorOn && this.queuedValue === null) {
47
+ if (!force && pValue === this._actuatorOn && this.queuedValue === null) {
45
48
  this.log(models_1.LogLevel.Debug, `Skip actuator command as it is already ${pValue}`, services_1.LogDebugType.SkipUnchangedActuatorCommand);
46
49
  return;
47
50
  }
@@ -74,7 +77,7 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
74
77
  (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
75
78
  }
76
79
  toggleActuator(force = false) {
77
- const newVal = this.queuedValue !== null ? !this.queuedValue : !this.actuatorOn;
80
+ const newVal = this.queuedValue !== null ? !this.queuedValue : !this._actuatorOn;
78
81
  const timeout = newVal && force ? 30 * 60 * 1000 : -1;
79
82
  this.setActuator(newVal, timeout, force);
80
83
  return newVal;
@@ -4,10 +4,14 @@ import { ZigbeeActuator } from './BaseDevices';
4
4
  import { iExcessEnergyConsumer } from '../baseDeviceInterfaces';
5
5
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
6
6
  export declare class ZigbeeBlitzShp extends ZigbeeActuator implements iExcessEnergyConsumer {
7
- steckerOn: boolean;
8
- current: number;
9
- energy: number;
10
- loadPower: number;
7
+ private _steckerOn;
8
+ get steckerOn(): boolean;
9
+ private _current;
10
+ get current(): number;
11
+ private _energy;
12
+ get energy(): number;
13
+ private _loadPower;
14
+ get loadPower(): number;
11
15
  settings: ActuatorSettings;
12
16
  energyConsumerSettings: ExcessEnergyConsumerSettings;
13
17
  private readonly _availableForExcessEnergy;
@@ -8,21 +8,33 @@ const DeviceCapability_1 = require("../DeviceCapability");
8
8
  class ZigbeeBlitzShp extends BaseDevices_1.ZigbeeActuator {
9
9
  constructor(pInfo) {
10
10
  super(pInfo, deviceType_1.DeviceType.ZigbeeBlitzShp, `${pInfo.fullID}.state`);
11
- this.steckerOn = false;
12
- this.current = 0;
13
- this.energy = 0;
14
- this.loadPower = 0;
11
+ this._steckerOn = false;
12
+ this._current = 0;
13
+ this._energy = 0;
14
+ this._loadPower = 0;
15
15
  this.settings = new models_1.ActuatorSettings();
16
16
  this.energyConsumerSettings = new models_1.ExcessEnergyConsumerSettings();
17
17
  this._availableForExcessEnergy = true;
18
18
  this._activatedByExcessEnergy = false;
19
19
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.excessEnergyConsumer);
20
20
  }
21
+ get steckerOn() {
22
+ return this._steckerOn;
23
+ }
24
+ get current() {
25
+ return this._current;
26
+ }
27
+ get energy() {
28
+ return this._energy;
29
+ }
30
+ get loadPower() {
31
+ return this._loadPower;
32
+ }
21
33
  get currentConsumption() {
22
- return this.loadPower;
34
+ return this._loadPower;
23
35
  }
24
36
  get on() {
25
- return this.steckerOn;
37
+ return this._steckerOn;
26
38
  }
27
39
  isAvailableForExcessEnergy() {
28
40
  return this._availableForExcessEnergy;
@@ -33,23 +45,23 @@ class ZigbeeBlitzShp extends BaseDevices_1.ZigbeeActuator {
33
45
  switch (idSplit[3]) {
34
46
  case 'state':
35
47
  const newSteckerOn = state.val;
36
- this.log(newSteckerOn !== this.steckerOn ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet Update to ${state.val}`);
37
- this.steckerOn = newSteckerOn;
48
+ this.log(newSteckerOn !== this._steckerOn ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet Update to ${state.val}`);
49
+ this._steckerOn = newSteckerOn;
38
50
  break;
39
51
  case 'energy':
40
52
  const newEnergy = state.val;
41
- this.log(newEnergy !== this.energy ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new total consumption: ${state.val}`);
42
- this.energy = newEnergy;
53
+ this.log(newEnergy !== this._energy ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new total consumption: ${state.val}`);
54
+ this._energy = newEnergy;
43
55
  break;
44
56
  case 'current':
45
57
  const newCurrent = state.val;
46
- this.log(Math.abs(newCurrent - this.current) > 0.25 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new current: ${state.val}`);
47
- this.current = newCurrent;
58
+ this.log(Math.abs(newCurrent - this._current) > 0.25 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new current: ${state.val}`);
59
+ this._current = newCurrent;
48
60
  break;
49
61
  case 'load_power':
50
62
  const newLoadPower = state.val;
51
- this.log(Math.abs(newLoadPower - this.loadPower) > 0.25 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new current load power: ${state.val}`);
52
- this.loadPower = newLoadPower;
63
+ this.log(Math.abs(newLoadPower - this._loadPower) > 0.25 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Outlet update, new current load power: ${state.val}`);
64
+ this._loadPower = newLoadPower;
53
65
  break;
54
66
  }
55
67
  }
@@ -3,6 +3,12 @@ import { RoomBase } from '../../../models';
3
3
  import { LogObject } from '../log-service';
4
4
  import { AcDevice } from '../ac';
5
5
  export declare class API {
6
+ /**
7
+ * Endpoint to end a scene manually (or early if it has automatic turn off)
8
+ * @param {string} deviceId
9
+ * @returns {Error | null}
10
+ */
11
+ static endScene(deviceId: string): Error | null;
6
12
  /**
7
13
  * Gets the instance of an Ac Device identified by id
8
14
  * @param {string} id
@@ -67,4 +73,11 @@ export declare class API {
67
73
  static setLedLamp(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): Error | null;
68
74
  static setShutter(deviceId: string, level: number): Error | null;
69
75
  static speakOnDevice(deviceId: string, message: string, volume?: number): Error | null;
76
+ /**
77
+ * Starts a specified scene
78
+ * @param {string} deviceId The targeted scene
79
+ * @param {number} turnOffTimeout If provided the time in ms after which the scene should end automatically
80
+ * @returns {Error | null} In case it failed the Error containing the reason
81
+ */
82
+ static startScene(deviceId: string, turnOffTimeout?: number): Error | null;
70
83
  }
@@ -8,6 +8,22 @@ const log_service_1 = require("../log-service");
8
8
  const ac_1 = require("../ac");
9
9
  const DeviceCapability_1 = require("../../devices/DeviceCapability");
10
10
  class API {
11
+ /**
12
+ * Endpoint to end a scene manually (or early if it has automatic turn off)
13
+ * @param {string} deviceId
14
+ * @returns {Error | null}
15
+ */
16
+ static endScene(deviceId) {
17
+ const d = this.getDevice(deviceId);
18
+ if (d === undefined) {
19
+ return new Error(`Device with ID ${deviceId} not found`);
20
+ }
21
+ if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.scene)) {
22
+ return new Error(`Device with ID ${deviceId} is no scene`);
23
+ }
24
+ d.endScene();
25
+ return null;
26
+ }
11
27
  /**
12
28
  * Gets the instance of an Ac Device identified by id
13
29
  * @param {string} id
@@ -169,5 +185,22 @@ class API {
169
185
  d.speakOnDevice(message, volume);
170
186
  return null;
171
187
  }
188
+ /**
189
+ * Starts a specified scene
190
+ * @param {string} deviceId The targeted scene
191
+ * @param {number} turnOffTimeout If provided the time in ms after which the scene should end automatically
192
+ * @returns {Error | null} In case it failed the Error containing the reason
193
+ */
194
+ static startScene(deviceId, turnOffTimeout) {
195
+ const d = this.getDevice(deviceId);
196
+ if (d === undefined) {
197
+ return new Error(`Device with ID ${deviceId} not found`);
198
+ }
199
+ if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.scene)) {
200
+ return new Error(`Device with ID ${deviceId} is no scene`);
201
+ }
202
+ d.startScene(turnOffTimeout);
203
+ return null;
204
+ }
172
205
  }
173
206
  exports.API = API;
@@ -368,10 +368,10 @@ values ('${device.id}', ${utils_1.Utils.round(device.battery, 1)}, '${new Date()
368
368
  `);
369
369
  }
370
370
  persistZigbeeDevice(device) {
371
- const dateValue = device.lastUpdate.getTime() > 0 ? device.lastUpdate.toISOString() : 'null';
371
+ const dateValue = device.lastUpdate.getTime() > 0 ? `'${device.lastUpdate.toISOString()}'` : 'null';
372
372
  this.query(`
373
373
  insert into hoffmation_schema."ZigbeeDeviceData" ("deviceID", "date", "available", "linkQuality", "lastUpdate")
374
- values ('${device.id}', '${new Date().toISOString()}', ${device.available}, ${device.linkQuality}, '${dateValue}');
374
+ values ('${device.id}', '${new Date().toISOString()}', ${device.available}, ${device.linkQuality}, ${dateValue});
375
375
  `);
376
376
  }
377
377
  persistIlluminationSensor(device) {