hoffmation-base 1.0.67 → 1.1.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.
Files changed (26) hide show
  1. package/lib/server/devices/IoBrokerBaseDevice.d.ts +1 -0
  2. package/lib/server/devices/IoBrokerBaseDevice.js +7 -0
  3. package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +1 -0
  4. package/lib/server/devices/baseDeviceInterfaces/iBaseDevice.d.ts +1 -0
  5. package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.d.ts +1 -0
  6. package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +3 -5
  7. package/lib/server/devices/espresense/detectedBluetoothDevice.d.ts +1 -0
  8. package/lib/server/devices/espresense/detectedBluetoothDevice.js +7 -0
  9. package/lib/server/devices/espresense/espresenseDevice.d.ts +1 -0
  10. package/lib/server/devices/espresense/espresenseDevice.js +7 -0
  11. package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +3 -0
  12. package/lib/server/devices/hmIPDevices/hmIpLampe.js +10 -1
  13. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +1 -0
  14. package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +4 -0
  15. package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +3 -0
  16. package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +10 -1
  17. package/lib/server/devices/zigbee/zigbeeIlluLampe.js +1 -1
  18. package/lib/server/services/Sonos/own-sonos-device.d.ts +1 -0
  19. package/lib/server/services/Sonos/own-sonos-device.js +7 -0
  20. package/lib/server/services/ac/ac-device.d.ts +1 -0
  21. package/lib/server/services/ac/ac-device.js +7 -0
  22. package/lib/server/services/dbo/iPersist.d.ts +3 -2
  23. package/lib/server/services/dbo/postgreSqlPersist.d.ts +3 -2
  24. package/lib/server/services/dbo/postgreSqlPersist.js +44 -7
  25. package/lib/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +1 -1
@@ -48,6 +48,7 @@ export declare abstract class IoBrokerBaseDevice implements iRoomDevice {
48
48
  abstract update(idSplit: string[], state: ioBroker.State, initial: boolean, pOverride: boolean): void;
49
49
  log(level: LogLevel, message: string, logDebugType?: LogDebugType): void;
50
50
  toJSON(): Partial<IoBrokerBaseDevice>;
51
+ persistDeviceInfo(): void;
51
52
  protected addToCorrectRoom(): void;
52
53
  /**
53
54
  * Sets the state of a given data point and returns true if that was successful.
@@ -12,6 +12,7 @@ class IoBrokerBaseDevice {
12
12
  this.deviceCapabilities = [];
13
13
  this.individualStateCallbacks = new Map();
14
14
  this.addToCorrectRoom();
15
+ this.persistDeviceInfo();
15
16
  }
16
17
  get id() {
17
18
  const result = services_1.Utils.guard(this.info.allDevicesKey);
@@ -89,6 +90,12 @@ class IoBrokerBaseDevice {
89
90
  toJSON() {
90
91
  return services_1.Utils.jsonFilter(this, ['individualStateCallbacks']);
91
92
  }
93
+ persistDeviceInfo() {
94
+ services_1.Utils.guardedTimeout(() => {
95
+ var _a;
96
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
97
+ }, 5000, this);
98
+ }
92
99
  addToCorrectRoom() {
93
100
  const settings = IoBrokerBaseDevice.roomAddingSettings[this.info.room];
94
101
  if (settings !== undefined) {
@@ -3,6 +3,7 @@ import { iRoomDevice } from './iRoomDevice';
3
3
  export interface iActuator extends iRoomDevice {
4
4
  settings: ActuatorSettings;
5
5
  actuatorOn: boolean;
6
+ persist(): void;
6
7
  /**
7
8
  * Controls the power state of this actuator
8
9
  * @param {boolean} pValue the new desired State
@@ -8,5 +8,6 @@ export interface iBaseDevice {
8
8
  readonly deviceCapabilities: DeviceCapability[];
9
9
  readonly id: string;
10
10
  log(level: LogLevel, message: string): void;
11
+ persistDeviceInfo(): void;
11
12
  toJSON(): Partial<iBaseDevice>;
12
13
  }
@@ -2,6 +2,7 @@ import { iLamp } from './iLamp';
2
2
  import { DimmerSettings, TimeOfDay } from '../../../models';
3
3
  export interface iDimmableLamp extends iLamp {
4
4
  settings: DimmerSettings;
5
+ readonly brightness: number;
5
6
  toggleLight(time: TimeOfDay, force: boolean, calculateTime: boolean): void;
6
7
  /**
7
8
  * This function sets the light to a specific value
@@ -1,9 +1,7 @@
1
- import { ActuatorSettings, TimeOfDay } from '../../../models';
2
- import { iRoomDevice } from './iRoomDevice';
3
- export interface iLamp extends iRoomDevice {
4
- settings: ActuatorSettings;
1
+ import { TimeOfDay } from '../../../models';
2
+ import { iActuator } from './iActuator';
3
+ export interface iLamp extends iActuator {
5
4
  lightOn: boolean;
6
- persist(): void;
7
5
  setTimeBased(time: TimeOfDay, timeout: number, force: boolean): void;
8
6
  toggleLight(time: TimeOfDay, force: boolean, calculateTime: boolean): void;
9
7
  /**
@@ -23,4 +23,5 @@ export declare class DetectedBluetoothDevice implements iBaseDevice {
23
23
  getDistanceReport(maxAge?: number): string;
24
24
  static getOrCreate(devName: string): DetectedBluetoothDevice;
25
25
  private static deviceKeyBySettings;
26
+ persistDeviceInfo(): void;
26
27
  }
@@ -21,6 +21,7 @@ class DetectedBluetoothDevice {
21
21
  this.info.allDevicesKey = DetectedBluetoothDevice.deviceKeyBySettings(settings);
22
22
  if (settings.activeTracking) {
23
23
  devices_1.Devices.alLDevices[this.info.allDevicesKey] = this;
24
+ this.persistDeviceInfo();
24
25
  }
25
26
  }
26
27
  get name() {
@@ -83,5 +84,11 @@ class DetectedBluetoothDevice {
83
84
  static deviceKeyBySettings(settings) {
84
85
  return `trackedDevice-${settings.customName}`;
85
86
  }
87
+ persistDeviceInfo() {
88
+ services_1.Utils.guardedTimeout(() => {
89
+ var _a;
90
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
91
+ }, 5000, this);
92
+ }
86
93
  }
87
94
  exports.DetectedBluetoothDevice = DetectedBluetoothDevice;
@@ -24,6 +24,7 @@ export declare class EspresenseDevice implements iRoomDevice, iBluetoothDetector
24
24
  update(devName: string, state: ioBroker.State): void;
25
25
  log(level: LogLevel, message: string, debugType?: LogDebugType): void;
26
26
  toJSON(): Partial<iRoomDevice>;
27
+ persistDeviceInfo(): void;
27
28
  addProximityCallback(cb: ProximityCallback): void;
28
29
  private addDeviceTracking;
29
30
  }
@@ -23,6 +23,7 @@ class EspresenseDevice {
23
23
  this._info.allDevicesKey = `espresense-${roomName}-${name}`;
24
24
  devices_1.Devices.alLDevices[this._info.allDevicesKey] = this;
25
25
  espresenseCoordinator_1.EspresenseCoordinator.addDevice(this, name);
26
+ this.persistDeviceInfo();
26
27
  }
27
28
  get info() {
28
29
  return this._info;
@@ -104,6 +105,12 @@ class EspresenseDevice {
104
105
  toJSON() {
105
106
  return services_1.Utils.jsonFilter(this);
106
107
  }
108
+ persistDeviceInfo() {
109
+ services_1.Utils.guardedTimeout(() => {
110
+ var _a;
111
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
112
+ }, 5000, this);
113
+ }
107
114
  addProximityCallback(cb) {
108
115
  let currentValue = this.proximityCallback.get(cb.deviceName);
109
116
  if (currentValue == undefined) {
@@ -11,7 +11,10 @@ export declare class HmIpLampe extends HmIPDevice implements iLamp {
11
11
  private _turnOffTimeout;
12
12
  private turnOffTime;
13
13
  constructor(pInfo: IoBrokerDeviceInfo);
14
+ get actuatorOn(): boolean;
14
15
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
16
+ setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
17
+ toggleActuator(force: boolean): boolean;
15
18
  /** @inheritdoc */
16
19
  setLight(pValue: boolean, timeout?: number, force?: boolean): void;
17
20
  toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
@@ -18,6 +18,9 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
18
18
  this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
19
19
  this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
20
20
  }
21
+ get actuatorOn() {
22
+ return this.lightOn;
23
+ }
21
24
  update(idSplit, state, initial = false) {
22
25
  this.log(models_1.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
23
26
  super.update(idSplit, state, initial, true);
@@ -31,6 +34,12 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
31
34
  break;
32
35
  }
33
36
  }
37
+ setActuator(pValue, timeout, force) {
38
+ this.setLight(pValue, timeout, force);
39
+ }
40
+ toggleActuator(force) {
41
+ return this.toggleLight(undefined, force);
42
+ }
34
43
  /** @inheritdoc */
35
44
  setLight(pValue, timeout = -1, force = false) {
36
45
  if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
@@ -101,7 +110,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
101
110
  }
102
111
  persist() {
103
112
  var _a;
104
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
113
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
105
114
  }
106
115
  }
107
116
  exports.HmIpLampe = HmIpLampe;
@@ -14,5 +14,6 @@ export declare class ZigbeeActuator extends ZigbeeDevice implements iActuator {
14
14
  constructor(pInfo: IoBrokerDeviceInfo, type: DeviceType, actuatorOnSwitchID: string);
15
15
  update(idSplit: string[], state: ioBroker.State, initial?: boolean, handledByChildObject?: boolean): void;
16
16
  setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
17
+ persist(): void;
17
18
  toggleActuator(force?: boolean): boolean;
18
19
  }
@@ -68,6 +68,10 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
68
68
  }
69
69
  }, timeout, this);
70
70
  }
71
+ persist() {
72
+ var _a;
73
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
74
+ }
71
75
  toggleActuator(force = false) {
72
76
  const newVal = this.queuedValue !== null ? !this.queuedValue : !this.actuatorOn;
73
77
  const timeout = newVal && force ? 30 * 60 * 1000 : -1;
@@ -16,8 +16,11 @@ export declare class ZigbeeIlluDimmer extends ZigbeeDevice implements iDimmableL
16
16
  private turnOffTime;
17
17
  private _lastPersist;
18
18
  constructor(pInfo: IoBrokerDeviceInfo);
19
+ get actuatorOn(): boolean;
19
20
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
20
21
  setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
22
+ setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
23
+ toggleActuator(force: boolean): boolean;
21
24
  /**
22
25
  * @inheritDoc
23
26
  * @param pValue The desired value
@@ -26,6 +26,9 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
26
26
  this.brightnessID = `${this.info.fullID}.brightness`;
27
27
  this.transitionID = `${this.info.fullID}.transition_time`;
28
28
  }
29
+ get actuatorOn() {
30
+ return this.lightOn;
31
+ }
29
32
  update(idSplit, state, initial = false) {
30
33
  this.queuedValue = null;
31
34
  this.log(models_1.LogLevel.DeepTrace, `Dimmer Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
@@ -63,6 +66,12 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
63
66
  break;
64
67
  }
65
68
  }
69
+ setActuator(pValue, timeout, force) {
70
+ this.setLight(pValue, timeout, force);
71
+ }
72
+ toggleActuator(force) {
73
+ return this.toggleLight(undefined, force);
74
+ }
66
75
  /**
67
76
  * @inheritDoc
68
77
  * @param pValue The desired value
@@ -135,7 +144,7 @@ class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDevice {
135
144
  if (this._lastPersist + 1000 < now) {
136
145
  return;
137
146
  }
138
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
147
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
139
148
  this._lastPersist = now;
140
149
  }
141
150
  toggleLight(time, force = false, calculateTime = false) {
@@ -60,7 +60,7 @@ class ZigbeeIlluLampe extends zigbeeIlluActuator_1.ZigbeeIlluActuator {
60
60
  }
61
61
  persist() {
62
62
  var _a;
63
- (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistLamp(this);
63
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
64
64
  }
65
65
  }
66
66
  exports.ZigbeeIlluLampe = ZigbeeIlluLampe;
@@ -23,4 +23,5 @@ export declare class OwnSonosDevice implements iSpeaker {
23
23
  playUrl(url: string): void;
24
24
  log(level: LogLevel, message: string, debugType?: LogDebugType): void;
25
25
  toJSON(): Partial<OwnSonosDevice>;
26
+ persistDeviceInfo(): void;
26
27
  }
@@ -27,6 +27,7 @@ class OwnSonosDevice {
27
27
  this._info.room = roomName;
28
28
  this._info.allDevicesKey = `sonos-${roomName}-${discoveryName}`;
29
29
  devices_1.Devices.alLDevices[`sonos-${roomName}-${discoveryName}`] = this;
30
+ this.persistDeviceInfo();
30
31
  }
31
32
  get info() {
32
33
  return this._info;
@@ -108,5 +109,11 @@ class OwnSonosDevice {
108
109
  toJSON() {
109
110
  return utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['room']));
110
111
  }
112
+ persistDeviceInfo() {
113
+ utils_1.Utils.guardedTimeout(() => {
114
+ var _a;
115
+ (_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
116
+ }, 5000, this);
117
+ }
111
118
  }
112
119
  exports.OwnSonosDevice = OwnSonosDevice;
@@ -44,5 +44,6 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
44
44
  log(level: LogLevel, message: string, debugType?: LogDebugType): void;
45
45
  wasActivatedByExcessEnergy(): boolean;
46
46
  private automaticCheck;
47
+ persistDeviceInfo(): void;
47
48
  toJSON(): Partial<AcDevice>;
48
49
  }
@@ -30,6 +30,7 @@ class AcDevice {
30
30
  this._info.allDevicesKey = `ac-${roomName}-${name}`;
31
31
  utils_1.Utils.guardedInterval(this.automaticCheck, 60000, this, true);
32
32
  utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
33
+ this.persistDeviceInfo();
33
34
  }
34
35
  get roomTemperature() {
35
36
  return this._roomTemperatur;
@@ -133,6 +134,12 @@ class AcDevice {
133
134
  return;
134
135
  }
135
136
  }
137
+ persistDeviceInfo() {
138
+ utils_1.Utils.guardedTimeout(() => {
139
+ var _a;
140
+ (_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
141
+ }, 5000, this);
142
+ }
136
143
  toJSON() {
137
144
  // eslint-disable-next-line
138
145
  const result = lodash_1.default.omit(this, ['room']);
@@ -1,9 +1,10 @@
1
- import { iAcDevice, iHeater, iLamp, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
1
+ import { iAcDevice, iActuator, iBaseDevice, iHeater, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
2
2
  import { CountToday, CurrentIlluminationDataPoint, EnergyCalculation, RoomBase, ShutterCalibration, TemperaturDataPoint } from '../../../models';
3
3
  export interface iPersist {
4
4
  initialized: boolean;
5
5
  addTemperaturDataPoint(heater: iHeater): void;
6
6
  addRoom(room: RoomBase): void;
7
+ addDevice(device: iBaseDevice): void;
7
8
  motionSensorTodayCount(device: iMotionSensor): Promise<CountToday>;
8
9
  getShutterCalibration(device: IoBrokerBaseDevice): Promise<ShutterCalibration>;
9
10
  initialize(): Promise<void>;
@@ -11,7 +12,7 @@ export interface iPersist {
11
12
  persistCurrentIllumination(data: CurrentIlluminationDataPoint): void;
12
13
  persistEnergyManager(energyData: EnergyCalculation): void;
13
14
  persistAC(device: iAcDevice): void;
14
- persistLamp(device: iLamp): void;
15
+ persistActuator(device: iActuator): void;
15
16
  persistMotionSensor(device: iMotionSensor): void;
16
17
  readTemperaturDataPoint(hzGrp: iHeater, limit: number): Promise<TemperaturDataPoint[]>;
17
18
  }
@@ -1,18 +1,19 @@
1
1
  import { iPersist } from './iPersist';
2
2
  import { CountToday, CurrentIlluminationDataPoint, EnergyCalculation, RoomBase, ShutterCalibration, TemperaturDataPoint } from '../../../models';
3
- import { iAcDevice, iHeater, iLamp, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
3
+ import { iAcDevice, iActuator, iBaseDevice, iHeater, iMotionSensor, IoBrokerBaseDevice } from '../../devices';
4
4
  import { iPersistenceSettings } from '../../config';
5
5
  export declare class PostgreSqlPersist implements iPersist {
6
6
  initialized: boolean;
7
7
  private readonly psql;
8
8
  constructor(config: iPersistenceSettings);
9
9
  addRoom(room: RoomBase): void;
10
+ addDevice(device: iBaseDevice): void;
10
11
  addTemperaturDataPoint(heater: iHeater): void;
11
12
  motionSensorTodayCount(device: iMotionSensor): Promise<CountToday>;
12
13
  getShutterCalibration(_device: IoBrokerBaseDevice): Promise<ShutterCalibration>;
13
14
  initialize(): Promise<void>;
14
15
  persistAC(device: iAcDevice): void;
15
- persistLamp(device: iLamp): void;
16
+ persistActuator(device: iActuator): void;
16
17
  persistMotionSensor(device: iMotionSensor): void;
17
18
  persistCurrentIllumination(data: CurrentIlluminationDataPoint): void;
18
19
  persistShutterCalibration(_data: ShutterCalibration): void;
@@ -4,6 +4,7 @@ exports.PostgreSqlPersist = void 0;
4
4
  const models_1 = require("../../../models");
5
5
  const pg_1 = require("pg");
6
6
  const log_service_1 = require("../log-service");
7
+ const DeviceCapability_1 = require("../../devices/DeviceCapability");
7
8
  class PostgreSqlPersist {
8
9
  constructor(config) {
9
10
  this.initialized = false;
@@ -17,6 +18,19 @@ values ('${room.roomName}',${room.settings.etage})
17
18
  ON CONFLICT (name)
18
19
  DO UPDATE SET
19
20
  etage = ${room.settings.etage}
21
+ ;
22
+ `);
23
+ }
24
+ addDevice(device) {
25
+ this.query(`
26
+ insert into hoffmation_schema."DeviceInfo" ("deviceid", "roomname", "alldeviceskey", "customname", "devtype")
27
+ values ('${device.id}','${device.info.room}','${device.info.allDevicesKey}','${device.info.customName}', ${device.deviceType})
28
+ ON CONFLICT ("deviceid")
29
+ DO UPDATE SET
30
+ "roomname" = '${device.info.room}',
31
+ "alldeviceskey" = '${device.info.allDevicesKey}',
32
+ "customname" = '${device.info.customName}',
33
+ "devtype" = ${device.deviceType}
20
34
  ;
21
35
  `);
22
36
  }
@@ -76,6 +90,25 @@ create unique index table_name_name_uindex
76
90
  on "BasicRooms" (name);
77
91
 
78
92
  END IF;
93
+ IF (SELECT to_regclass('hoffmation_schema."DeviceInfo"') IS NULL) Then
94
+ create table hoffmation_schema."DeviceInfo"
95
+ (
96
+ deviceid varchar(60) not null
97
+ constraint deviceinfo_pk
98
+ primary key,
99
+ roomname varchar(30)
100
+ constraint "DeviceInfo_BasicRooms_null_fk"
101
+ references hoffmation_schema."BasicRooms",
102
+ alldeviceskey varchar(30),
103
+ customname varchar(60),
104
+ devtype integer
105
+ );
106
+
107
+ alter table hoffmation_schema."DeviceInfo"
108
+ owner to postgres;
109
+
110
+ END IF;
111
+
79
112
  IF (SELECT to_regclass('hoffmation_schema."CurrentIllumination"') IS NULL) Then
80
113
  create table "CurrentIllumination"
81
114
  (
@@ -147,17 +180,17 @@ IF (SELECT to_regclass('hoffmation_schema."AcDeviceData"') IS NULL) Then
147
180
  END IF;
148
181
 
149
182
 
150
- IF (SELECT to_regclass('hoffmation_schema."LampDeviceData"') IS NULL) Then
151
- create table hoffmation_schema."LampDeviceData"
183
+ IF (SELECT to_regclass('hoffmation_schema."ActuatorDeviceData"') IS NULL) Then
184
+ create table hoffmation_schema."ActuatorDeviceData"
152
185
  (
153
186
  "deviceID" varchar(60) not null,
154
187
  "on" boolean,
155
188
  date timestamp not null,
156
- constraint lampdevicedata_pk
189
+ constraint ActuatorDeviceData_pk
157
190
  primary key ("deviceID", date)
158
191
  );
159
192
 
160
- alter table hoffmation_schema."LampDeviceData"
193
+ alter table hoffmation_schema."ActuatorDeviceData"
161
194
  owner to postgres;
162
195
  END IF;
163
196
 
@@ -202,10 +235,14 @@ insert into hoffmation_schema."AcDeviceData" ("deviceID", "on", "date", "roomTem
202
235
  values ('${device.id}', ${device.on}, '${new Date().toISOString()}', ${device.temperature});
203
236
  `);
204
237
  }
205
- persistLamp(device) {
238
+ persistActuator(device) {
239
+ let percentage = undefined;
240
+ if (device.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.dimmablelamp)) {
241
+ percentage = device.brightness;
242
+ }
206
243
  this.query(`
207
- insert into hoffmation_schema."LampDeviceData" ("deviceID", "on", "date")
208
- values ('${device.id}', ${device.lightOn}, '${new Date().toISOString()}');
244
+ insert into hoffmation_schema."ActuatorDeviceData" ("deviceID", "on", "date", "percentage")
245
+ values ('${device.id}', ${device.actuatorOn}, '${new Date().toISOString()}', ${percentage !== null && percentage !== void 0 ? percentage : 'null'});
209
246
  `);
210
247
  }
211
248
  persistMotionSensor(device) {