hoffmation-base 3.2.24 → 3.2.25

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.
@@ -1,7 +1,7 @@
1
1
  import { BaseGroup, DeviceSettings } from '../devices';
2
2
  import { AcMode, ButtonPosition, ButtonPressType, CollisionSolving } from '../enums';
3
3
  import { ActuatorSetStateCommand, BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, DimmerSetLightCommand, LampSetLightCommand, LedSetLightCommand, ShutterSetLevelCommand } from '../command';
4
- import { iAcDevice, iBaseDevice, iRoomBase } from '../interfaces';
4
+ import { iAcDevice, iBaseDevice, iRoomBase, iTemperatureMeasurement } from '../interfaces';
5
5
  import { LogObject } from '../logging';
6
6
  import { GroupSettings } from '../settingsObjects';
7
7
  export declare class API {
@@ -193,4 +193,12 @@ export declare class API {
193
193
  */
194
194
  static blockAutomaticSetBlock(deviceId: string, command: BlockAutomaticCommand): Error | null;
195
195
  static pressButtonSwitch(deviceId: string, position: ButtonPosition, pressType: ButtonPressType): Error | null;
196
+ /**
197
+ * Gets temperature history for a device
198
+ * @param deviceId - The ID of the device to get temperature history for
199
+ * @param startDate - Optional start date for the query (defaults to start of today)
200
+ * @param endDate - Optional end date for the query (defaults to end of today)
201
+ * @returns The temperature measurements or an error if the device is not found or not a temperature sensor
202
+ */
203
+ static getTemperatureHistory(deviceId: string, startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[] | Error>;
196
204
  }
@@ -477,5 +477,23 @@ class API {
477
477
  d.log(enums_1.LogLevel.Info, `API Call to press button ${position} with ${pressType}`);
478
478
  return d.pressButton(position, pressType);
479
479
  }
480
+ /**
481
+ * Gets temperature history for a device
482
+ * @param deviceId - The ID of the device to get temperature history for
483
+ * @param startDate - Optional start date for the query (defaults to start of today)
484
+ * @param endDate - Optional end date for the query (defaults to end of today)
485
+ * @returns The temperature measurements or an error if the device is not found or not a temperature sensor
486
+ */
487
+ static async getTemperatureHistory(deviceId, startDate, endDate) {
488
+ const d = this.getDevice(deviceId, false);
489
+ if (d === undefined) {
490
+ return new Error(`Device with ID ${deviceId} not found`);
491
+ }
492
+ if (!d.deviceCapabilities.includes(enums_1.DeviceCapability.temperatureSensor)) {
493
+ return new Error(`Device with ID ${deviceId} is no temperature sensor`);
494
+ }
495
+ logging_1.ServerLogService.writeLog(enums_1.LogLevel.Debug, `API Call to get temperature history for ${deviceId}`);
496
+ return d.temperatureSensor.getTemperatureHistory(startDate, endDate);
497
+ }
480
498
  }
481
499
  exports.API = API;
@@ -1,5 +1,5 @@
1
1
  import { TemperatureSensorChangeAction } from '../../action';
2
- import { iTemperatureCollector, iTemperatureSensor } from '../../interfaces';
2
+ import { iTemperatureCollector, iTemperatureMeasurement, iTemperatureSensor } from '../../interfaces';
3
3
  export declare class TemperatureSensor implements iTemperatureSensor {
4
4
  private readonly _device;
5
5
  /** @inheritDoc */
@@ -38,4 +38,6 @@ export declare class TemperatureSensor implements iTemperatureSensor {
38
38
  addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
39
39
  dispose(): void;
40
40
  toJSON(): Partial<TemperatureSensor>;
41
+ /** @inheritDoc */
42
+ getTemperatureHistory(startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[]>;
41
43
  }
@@ -4,7 +4,6 @@ exports.TemperatureSensor = void 0;
4
4
  const action_1 = require("../../action");
5
5
  const interfaces_1 = require("../../interfaces");
6
6
  const utils_1 = require("../../utils");
7
- const weather_1 = require("../../services/weather");
8
7
  const services_1 = require("../../services");
9
8
  class TemperatureSensor {
10
9
  constructor(_device) {
@@ -44,8 +43,8 @@ class TemperatureSensor {
44
43
  set temperature(val) {
45
44
  this.lastSeen = utils_1.Utils.nowMS();
46
45
  let correctedValue = val;
47
- if (this.outdoorTemperatureCorrectionCoefficient !== 0 && weather_1.WeatherService.currentTemp !== interfaces_1.UNDEFINED_TEMP_VALUE) {
48
- const tempDiff = 21 - weather_1.WeatherService.currentTemp;
46
+ if (this.outdoorTemperatureCorrectionCoefficient !== 0 && services_1.WeatherService.currentTemp !== interfaces_1.UNDEFINED_TEMP_VALUE) {
47
+ const tempDiff = 21 - services_1.WeatherService.currentTemp;
49
48
  // Use degressive correction: full coefficient up to 10K diff (=11°C outdoor), then reduce
50
49
  // This prevents over-correction at very low outdoor temperatures
51
50
  const maxLinearDiff = 10;
@@ -91,5 +90,12 @@ class TemperatureSensor {
91
90
  toJSON() {
92
91
  return utils_1.Utils.jsonFilter(this, this.jsonOmitKeys);
93
92
  }
93
+ /** @inheritDoc */
94
+ async getTemperatureHistory(startDate, endDate) {
95
+ if (!services_1.Persistence.dbo) {
96
+ return [];
97
+ }
98
+ return services_1.Persistence.dbo.getTemperatureHistory(this._device.id, startDate, endDate);
99
+ }
94
100
  }
95
101
  exports.TemperatureSensor = TemperatureSensor;
@@ -1,5 +1,6 @@
1
1
  import { iJsonOmitKeys } from '../iJsonOmitKeys';
2
2
  import { TemperatureSensorChangeAction } from '../../action';
3
+ import { iTemperatureMeasurement } from '../iTemperatureMeasurement';
3
4
  /**
4
5
  *
5
6
  */
@@ -37,4 +38,11 @@ export interface iTemperatureSensor extends iJsonOmitKeys {
37
38
  *
38
39
  */
39
40
  toJSON(): Partial<iTemperatureSensor>;
41
+ /**
42
+ * Gets temperature history from the database
43
+ * @param startDate - Optional start date for the query (defaults to start of today)
44
+ * @param endDate - Optional end date for the query (defaults to end of today)
45
+ * @returns The temperature measurements
46
+ */
47
+ getTemperatureHistory(startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[]>;
40
48
  }
@@ -1,4 +1,5 @@
1
1
  import { iAcDevice, iActuator, iBaseDevice, iBatteryDevice, iButtonSwitch, iHandle, iHeater, iHumidityCollector, iIlluminationSensor, iMotionSensor, iShutter, iTemperatureCollector, iZigbeeDevice } from './baseDevices';
2
+ import { iTemperatureMeasurement } from './iTemperatureMeasurement';
2
3
  import { iRoomBase } from './iRoomBase';
3
4
  import { ButtonPressType } from '../enums';
4
5
  import { iDesiredShutterPosition } from './IDesiredShutterPosition';
@@ -42,6 +43,14 @@ export interface iPersist {
42
43
  * @returns - The shutter calibration
43
44
  */
44
45
  getShutterCalibration(device: iShutter): Promise<iShutterCalibration>;
46
+ /**
47
+ * Gets temperature measurements for a device by its ID
48
+ * @param deviceId - The ID of the device to load temp measurements for
49
+ * @param startDate - Optional start date for the query (defaults to start of today)
50
+ * @param endDate - Optional end date for the query (defaults to end of today)
51
+ * @returns - The measurements
52
+ */
53
+ getTemperatureHistory(deviceId: string, startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[]>;
45
54
  /**
46
55
  * Initializes the database-connection and prepares the database
47
56
  * @returns - The promise that resolves when the database is initialized
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A measurement in persistence layer
3
+ */
4
+ export interface iTemperatureMeasurement {
5
+ /**
6
+ * The measured temperature in Celsius
7
+ */
8
+ temperature: number;
9
+ /**
10
+ * The date of the measurement
11
+ */
12
+ date: Date;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -52,3 +52,4 @@ export { iIOBrokerConnection } from './iIOBrokerConnection';
52
52
  export { iDeviceCluster } from './iDevicecluster';
53
53
  export { iDaytime } from './iDaytime';
54
54
  export { iBlockAutomaticHandler } from './iBlockAutomaticHandler';
55
+ export { iTemperatureMeasurement } from './iTemperatureMeasurement';
@@ -1,5 +1,5 @@
1
1
  import { PoolConfig } from 'pg';
2
- import { iAcDevice, iActuator, iBaseDevice, iBatteryDevice, iButtonSwitch, iDesiredShutterPosition, iHandle, iHeater, iHumidityCollector, iIlluminationSensor, iMotionSensor, iPersist, iRoomBase, iShutter, iShutterCalibration, iTemperatureCollector, iZigbeeDevice } from '../../interfaces';
2
+ import { iAcDevice, iActuator, iBaseDevice, iBatteryDevice, iButtonSwitch, iDesiredShutterPosition, iHandle, iHeater, iHumidityCollector, iIlluminationSensor, iMotionSensor, iPersist, iRoomBase, iShutter, iShutterCalibration, iTemperatureCollector, iTemperatureMeasurement, iZigbeeDevice } from '../../interfaces';
3
3
  import { CountToday, EnergyCalculation } from '../../models';
4
4
  import { ButtonPressType } from '../../enums';
5
5
  export declare class PostgreSqlPersist implements iPersist {
@@ -18,6 +18,9 @@ export declare class PostgreSqlPersist implements iPersist {
18
18
  motionSensorTodayCount(device: iMotionSensor): Promise<CountToday>;
19
19
  /** @inheritDoc */
20
20
  getShutterCalibration(_device: iShutter): Promise<iShutterCalibration>;
21
+ getTempMeasurements(device: iTemperatureCollector): Promise<iTemperatureMeasurement[]>;
22
+ /** @inheritDoc */
23
+ getTemperatureHistory(deviceId: string, startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[]>;
21
24
  /** @inheritDoc */
22
25
  initialize(): Promise<void>;
23
26
  /** @inheritDoc */
@@ -17,27 +17,27 @@ class PostgreSqlPersist {
17
17
  /** @inheritDoc */
18
18
  addRoom(room) {
19
19
  this.query(`
20
- insert into hoffmation_schema."BasicRooms" (name, etage)
21
- values ('${room.roomName}', ${room.etage}) ON CONFLICT (name)
20
+ insert into hoffmation_schema."BasicRooms" (name, etage)
21
+ values ('${room.roomName}', ${room.etage}) ON CONFLICT (name)
22
22
  DO
23
- UPDATE SET
24
- etage = ${room.etage}
25
- ;
23
+ UPDATE SET
24
+ etage = ${room.etage}
25
+ ;
26
26
  `);
27
27
  }
28
28
  /** @inheritDoc */
29
29
  addDevice(device) {
30
30
  this.query(`
31
- insert into hoffmation_schema."DeviceInfo" ("deviceid", "roomname", "alldeviceskey", "customname", "devtype")
32
- values ('${device.id}', '${device.info.room}', '${device.info.allDevicesKey}', '${device.info.customName}',
33
- ${device.deviceType}) ON CONFLICT ("deviceid")
31
+ insert into hoffmation_schema."DeviceInfo" ("deviceid", "roomname", "alldeviceskey", "customname", "devtype")
32
+ values ('${device.id}', '${device.info.room}', '${device.info.allDevicesKey}', '${device.info.customName}',
33
+ ${device.deviceType}) ON CONFLICT ("deviceid")
34
34
  DO
35
- UPDATE SET
36
- "roomname" = '${device.info.room}',
37
- "alldeviceskey" = '${device.info.allDevicesKey}',
38
- "customname" = '${device.info.customName}',
39
- "devtype" = ${device.deviceType}
40
- ;
35
+ UPDATE SET
36
+ "roomname" = '${device.info.room}',
37
+ "alldeviceskey" = '${device.info.allDevicesKey}',
38
+ "customname" = '${device.info.customName}',
39
+ "devtype" = ${device.deviceType}
40
+ ;
41
41
  `);
42
42
  }
43
43
  /** @inheritDoc */
@@ -49,7 +49,7 @@ class PostgreSqlPersist {
49
49
  AND date
50
50
  < CURRENT_DATE + INTERVAL '1 DAY'
51
51
  ORDER BY date desc
52
- Limit 1`);
52
+ Limit 1`);
53
53
  if (dbResult !== null && dbResult.length > 0) {
54
54
  return dbResult[0];
55
55
  }
@@ -80,6 +80,31 @@ class PostgreSqlPersist {
80
80
  reject('Not Implemented');
81
81
  });
82
82
  }
83
+ async getTempMeasurements(device) {
84
+ return this.getTemperatureHistory(device.id);
85
+ }
86
+ /** @inheritDoc */
87
+ async getTemperatureHistory(deviceId, startDate, endDate) {
88
+ const end = endDate !== null && endDate !== void 0 ? endDate : new Date();
89
+ const start = startDate !== null && startDate !== void 0 ? startDate : new Date(end.getTime() - 24 * 60 * 60 * 1000);
90
+ const dbResult = await this.query(`SELECT temperature, date
91
+ from hoffmation_schema."TemperatureSensorDeviceData"
92
+ WHERE "deviceID" = '${deviceId}'
93
+ and date >= '${start.toISOString()}'
94
+ AND date <= '${end.toISOString()}'
95
+ ORDER BY DATE DESC`);
96
+ if (dbResult === null || dbResult.length === 0) {
97
+ return [];
98
+ }
99
+ const result = [];
100
+ for (const entry of dbResult) {
101
+ result.push({
102
+ temperature: Number(entry.temperature),
103
+ date: new Date(entry.date),
104
+ });
105
+ }
106
+ return result;
107
+ }
83
108
  /** @inheritDoc */
84
109
  async initialize() {
85
110
  await this.psql.connect();
@@ -372,8 +397,8 @@ $$;`);
372
397
  /** @inheritDoc */
373
398
  persistAC(device) {
374
399
  this.query(`
375
- insert into hoffmation_schema."AcDeviceData" ("deviceID", "on", "date", "roomTemperature")
376
- values ('${device.id}', ${device.on}, '${new Date().toISOString()}', ${device.temperature});
400
+ insert into hoffmation_schema."AcDeviceData" ("deviceID", "on", "date", "roomTemperature")
401
+ values ('${device.id}', ${device.on}, '${new Date().toISOString()}', ${device.temperature});
377
402
  `);
378
403
  }
379
404
  /** @inheritDoc */
@@ -383,8 +408,8 @@ $$;`);
383
408
  percentage = device.brightness;
384
409
  }
385
410
  this.query(`
386
- insert into hoffmation_schema."ActuatorDeviceData" ("deviceID", "on", "date", "percentage")
387
- values ('${device.id}', ${device.actuatorOn}, '${new Date().toISOString()}', ${percentage !== null && percentage !== void 0 ? percentage : 'null'});
411
+ insert into hoffmation_schema."ActuatorDeviceData" ("deviceID", "on", "date", "percentage")
412
+ values ('${device.id}', ${device.actuatorOn}, '${new Date().toISOString()}', ${percentage !== null && percentage !== void 0 ? percentage : 'null'});
388
413
  `);
389
414
  }
390
415
  /** @inheritDoc */
@@ -398,31 +423,31 @@ $$;`);
398
423
  desiredTemperature = null;
399
424
  }
400
425
  void this.query(`
401
- insert into hoffmation_schema."HeaterDeviceData"
402
- ("deviceID", "level", "date", "roomTemperature", "desiredTemperature", "seasonTurnOff", "windowOpen")
403
- values ('${device.id}', ${device.iLevel}, '${new Date().toISOString()}', ${roomTemp !== null && roomTemp !== void 0 ? roomTemp : 'null'}, ${desiredTemperature !== null && desiredTemperature !== void 0 ? desiredTemperature : 'null'}, ${device.seasonTurnOff}, ${device.windowOpen});
426
+ insert into hoffmation_schema."HeaterDeviceData"
427
+ ("deviceID", "level", "date", "roomTemperature", "desiredTemperature", "seasonTurnOff", "windowOpen")
428
+ values ('${device.id}', ${device.iLevel}, '${new Date().toISOString()}', ${roomTemp !== null && roomTemp !== void 0 ? roomTemp : 'null'}, ${desiredTemperature !== null && desiredTemperature !== void 0 ? desiredTemperature : 'null'}, ${device.seasonTurnOff}, ${device.windowOpen});
404
429
  `);
405
430
  }
406
431
  /** @inheritDoc */
407
432
  persistHandleSensor(device) {
408
433
  const currentPos = device.position;
409
434
  this.query(`
410
- insert into hoffmation_schema."HandleDeviceData" ("deviceID", "position", "date")
411
- values ('${device.id}', ${currentPos}, '${new Date().toISOString()}');
435
+ insert into hoffmation_schema."HandleDeviceData" ("deviceID", "position", "date")
436
+ values ('${device.id}', ${currentPos}, '${new Date().toISOString()}');
412
437
  `);
413
438
  }
414
439
  /** @inheritDoc */
415
440
  persistSwitchInput(device, pressType, buttonName) {
416
441
  this.query(`
417
- insert into hoffmation_schema."ButtonSwitchPresses" ("deviceID", "pressType", "buttonName", "date")
418
- values ('${device.id}', ${pressType}, '${buttonName}', '${new Date().toISOString()}');
442
+ insert into hoffmation_schema."ButtonSwitchPresses" ("deviceID", "pressType", "buttonName", "date")
443
+ values ('${device.id}', ${pressType}, '${buttonName}', '${new Date().toISOString()}');
419
444
  `);
420
445
  }
421
446
  /** @inheritDoc */
422
447
  persistMotionSensor(device) {
423
448
  this.query(`
424
- insert into hoffmation_schema."MotionSensorDeviceData" ("deviceID", "movementDetected", "date")
425
- values ('${device.id}', ${device.movementDetected}, '${new Date().toISOString()}');
449
+ insert into hoffmation_schema."MotionSensorDeviceData" ("deviceID", "movementDetected", "date")
450
+ values ('${device.id}', ${device.movementDetected}, '${new Date().toISOString()}');
426
451
  `);
427
452
  }
428
453
  /** @inheritDoc */
@@ -430,8 +455,8 @@ $$;`);
430
455
  const currentLevel = device.currentLevel >= 0 ? device.currentLevel : null;
431
456
  const desiredLevel = device.desiredWindowShutterLevel >= 0 ? device.desiredWindowShutterLevel : null;
432
457
  this.query(`
433
- insert into hoffmation_schema."ShutterDeviceData" ("deviceID", "position", "date", "desiredPosition")
434
- values ('${device.id}', ${currentLevel}, '${new Date().toISOString()}', ${desiredLevel});
458
+ insert into hoffmation_schema."ShutterDeviceData" ("deviceID", "position", "date", "desiredPosition")
459
+ values ('${device.id}', ${currentLevel}, '${new Date().toISOString()}', ${desiredLevel});
435
460
  `);
436
461
  }
437
462
  /** @inheritDoc */
@@ -441,38 +466,38 @@ $$;`);
441
466
  roomTemp = null;
442
467
  }
443
468
  this.query(`
444
- insert into hoffmation_schema."TemperatureSensorDeviceData" ("deviceID", "temperature", "date", "roomTemperature")
445
- values ('${device.id}', ${device.iTemperature}, '${new Date().toISOString()}', ${roomTemp !== null && roomTemp !== void 0 ? roomTemp : 'null'});
469
+ insert into hoffmation_schema."TemperatureSensorDeviceData" ("deviceID", "temperature", "date", "roomTemperature")
470
+ values ('${device.id}', ${device.iTemperature}, '${new Date().toISOString()}', ${roomTemp !== null && roomTemp !== void 0 ? roomTemp : 'null'});
446
471
  `);
447
472
  }
448
473
  /** @inheritDoc */
449
474
  persistHumiditySensor(device) {
450
475
  this.query(`
451
- insert into hoffmation_schema."HumiditySensorDeviceData" ("deviceID", "humidity", "date")
452
- values ('${device.id}', ${device.humidity}, '${new Date().toISOString()}');
476
+ insert into hoffmation_schema."HumiditySensorDeviceData" ("deviceID", "humidity", "date")
477
+ values ('${device.id}', ${device.humidity}, '${new Date().toISOString()}');
453
478
  `);
454
479
  }
455
480
  /** @inheritDoc */
456
481
  persistBatteryDevice(device) {
457
482
  this.query(`
458
- insert into hoffmation_schema."BatteryDeviceData" ("deviceID", "battery", "date")
459
- values ('${device.id}', ${utils_1.Utils.round(device.batteryLevel, 1)}, '${new Date().toISOString()}');
483
+ insert into hoffmation_schema."BatteryDeviceData" ("deviceID", "battery", "date")
484
+ values ('${device.id}', ${utils_1.Utils.round(device.batteryLevel, 1)}, '${new Date().toISOString()}');
460
485
  `);
461
486
  }
462
487
  /** @inheritDoc */
463
488
  persistZigbeeDevice(device) {
464
489
  const dateValue = device.lastUpdate.getTime() > 0 ? `'${device.lastUpdate.toISOString()}'` : 'null';
465
490
  this.query(`
466
- insert into hoffmation_schema."ZigbeeDeviceData" ("deviceID", "date", "available", "linkQuality", "lastUpdate")
467
- values ('${device.id}', '${new Date().toISOString()}', ${device.available}, ${device.linkQuality},
468
- ${dateValue});
491
+ insert into hoffmation_schema."ZigbeeDeviceData" ("deviceID", "date", "available", "linkQuality", "lastUpdate")
492
+ values ('${device.id}', '${new Date().toISOString()}', ${device.available}, ${device.linkQuality},
493
+ ${dateValue});
469
494
  `);
470
495
  }
471
496
  /** @inheritDoc */
472
497
  persistIlluminationSensor(device) {
473
498
  this.query(`
474
- insert into hoffmation_schema."IlluminationSensorDeviceData" ("deviceID", "illumination", "date")
475
- values ('${device.id}', ${device.currentIllumination}, '${new Date().toISOString()}');`);
499
+ insert into hoffmation_schema."IlluminationSensorDeviceData" ("deviceID", "illumination", "date")
500
+ values ('${device.id}', ${device.currentIllumination}, '${new Date().toISOString()}');`);
476
501
  }
477
502
  /** @inheritDoc */
478
503
  persistShutterCalibration(_data) {
@@ -481,23 +506,23 @@ $$;`);
481
506
  /** @inheritDoc */
482
507
  persistEnergyManager(calc) {
483
508
  this.query(`
484
- insert into hoffmation_schema."EnergyCalculation" ("startDate", "endDate", "selfConsumedKwH", "injectedKwH",
485
- "drawnKwH", "batteryStoredKwH", "batteryLevel")
486
- values ('${new Date(calc.startMs).toISOString()}', '${new Date(calc.endMs).toISOString()}',
487
- ${calc.selfConsumedKwH}, ${calc.injectedKwH}, ${calc.drawnKwH}, ${calc.batteryStoredKwH},
488
- ${calc.batteryLevel});
509
+ insert into hoffmation_schema."EnergyCalculation" ("startDate", "endDate", "selfConsumedKwH", "injectedKwH",
510
+ "drawnKwH", "batteryStoredKwH", "batteryLevel")
511
+ values ('${new Date(calc.startMs).toISOString()}', '${new Date(calc.endMs).toISOString()}',
512
+ ${calc.selfConsumedKwH}, ${calc.injectedKwH}, ${calc.drawnKwH}, ${calc.batteryStoredKwH},
513
+ ${calc.batteryLevel});
489
514
  `);
490
515
  }
491
516
  /** @inheritDoc */
492
517
  persistSettings(id, settings, customName) {
493
518
  this.query(`
494
- insert into hoffmation_schema."Settings" (id, settings, customname, date)
495
- values ('${id}', '${settings}', '${customName}', '${new Date().toISOString()}') ON CONFLICT (id, date)
519
+ insert into hoffmation_schema."Settings" (id, settings, customname, date)
520
+ values ('${id}', '${settings}', '${customName}', '${new Date().toISOString()}') ON CONFLICT (id, date)
496
521
  DO
497
- UPDATE SET
498
- settings = '${settings}',
499
- customname = '${customName}'
500
- ;
522
+ UPDATE SET
523
+ settings = '${settings}',
524
+ customname = '${customName}'
525
+ ;
501
526
  `);
502
527
  }
503
528
  /** @inheritDoc */
@@ -506,7 +531,7 @@ $$;`);
506
531
  from hoffmation_schema."Settings"
507
532
  WHERE "id" = '${id}'
508
533
  ORDER BY "date" DESC
509
- LIMIT 1`);
534
+ LIMIT 1`);
510
535
  if (dbResult !== null && dbResult.length > 0) {
511
536
  return dbResult[0].settings;
512
537
  }