hoffmation-base 2.13.2 → 2.14.1

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 (30) hide show
  1. package/lib/models/deviceSettings/acSettings.d.ts +0 -10
  2. package/lib/models/deviceSettings/acSettings.js +5 -17
  3. package/lib/models/deviceSettings/heaterSettings.d.ts +0 -5
  4. package/lib/models/deviceSettings/heaterSettings.js +10 -30
  5. package/lib/models/groupSettings/groupSettings.d.ts +3 -0
  6. package/lib/models/groupSettings/groupSettings.js +7 -0
  7. package/lib/models/groupSettings/heatGroupSettings.d.ts +16 -0
  8. package/lib/models/groupSettings/heatGroupSettings.js +46 -0
  9. package/lib/models/rooms/RoomBase.js +3 -0
  10. package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +1 -3
  11. package/lib/server/devices/groups/base-group.d.ts +7 -2
  12. package/lib/server/devices/groups/base-group.js +5 -0
  13. package/lib/server/devices/groups/heatGroup.d.ts +6 -0
  14. package/lib/server/devices/groups/heatGroup.js +18 -0
  15. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +1 -3
  16. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +5 -10
  17. package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +1 -3
  18. package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +4 -8
  19. package/lib/server/services/ac/ac-device.d.ts +2 -2
  20. package/lib/server/services/ac/ac-device.js +21 -17
  21. package/lib/server/services/ac/own-daikin-device.d.ts +1 -2
  22. package/lib/server/services/ac/own-daikin-device.js +9 -10
  23. package/lib/server/services/api/api-service.d.ts +6 -2
  24. package/lib/server/services/api/api-service.js +22 -2
  25. package/lib/server/services/dbo/postgreSqlPersist.js +1 -1
  26. package/lib/server/services/room-service/room-service.d.ts +2 -1
  27. package/lib/server/services/room-service/room-service.js +1 -0
  28. package/lib/server/services/victron/victron-device.js +1 -1
  29. package/lib/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +13 -13
@@ -1,7 +1,8 @@
1
- import { ButtonPosition, ButtonPressType, iBaseDevice } from '../../devices';
1
+ import { BaseGroup, ButtonPosition, ButtonPressType, iBaseDevice } from '../../devices';
2
2
  import { CollisionSolving, DeviceSettings, RoomBase } from '../../../models';
3
3
  import { LogObject } from '../log-service';
4
4
  import { AcDevice, AcMode } from '../ac';
5
+ import { GroupSettings } from '../../../models/groupSettings/groupSettings';
5
6
  export declare class API {
6
7
  /**
7
8
  * Endpoint to end a scene manually (or early if it has automatic turn off)
@@ -19,6 +20,7 @@ export declare class API {
19
20
  [id: string]: iBaseDevice;
20
21
  };
21
22
  static getDevice(id: string): iBaseDevice;
23
+ static getGroup(id: string): BaseGroup | undefined;
22
24
  static getRooms(): Map<string, RoomBase>;
23
25
  static getRoom(id: string): RoomBase | undefined;
24
26
  static getLog(): LogObject[];
@@ -27,9 +29,10 @@ export declare class API {
27
29
  * @param id The id of the device, if wrong false will be returned
28
30
  * @param {boolean} desiredState
29
31
  * @param {AcMode} desiredMode
32
+ * @param desiredTemperature
30
33
  * @param forceTime The time in ms this should not change before automatic change is allowed again
31
34
  */
32
- static setAc(id: string, desiredState: boolean, desiredMode?: AcMode, forceTime?: number): boolean;
35
+ static setAc(id: string, desiredState: boolean, desiredMode?: AcMode, desiredTemperature?: number, forceTime?: number): boolean;
33
36
  /**
34
37
  * Turns on/off all AC´s in the home
35
38
  * @param {boolean} desiredState
@@ -96,6 +99,7 @@ export declare class API {
96
99
  * @returns {Error | null} In case it failed the Error containing the reason
97
100
  */
98
101
  static setDeviceSettings(deviceId: string, settings: Partial<DeviceSettings>): Error | null;
102
+ static setGroupSettings(groupId: string, settings: Partial<GroupSettings>): Error | null;
99
103
  /**
100
104
  * Changes the settings of a given room
101
105
  * @param {string} roomName The id of the Room to change the settings
@@ -49,6 +49,13 @@ class API {
49
49
  }
50
50
  return devices_1.Devices.alLDevices[id];
51
51
  }
52
+ static getGroup(id) {
53
+ const g = room_service_1.RoomService.Groups.get(id);
54
+ if (g === undefined) {
55
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Api.getGroup() --> "${id}" not found`);
56
+ }
57
+ return g;
58
+ }
52
59
  static getRooms() {
53
60
  // console.log(inspect(Object.fromEntries(RoomService.Rooms)));
54
61
  return room_service_1.RoomService.Rooms;
@@ -64,9 +71,10 @@ class API {
64
71
  * @param id The id of the device, if wrong false will be returned
65
72
  * @param {boolean} desiredState
66
73
  * @param {AcMode} desiredMode
74
+ * @param desiredTemperature
67
75
  * @param forceTime The time in ms this should not change before automatic change is allowed again
68
76
  */
69
- static setAc(id, desiredState, desiredMode, forceTime = 60 * 60 * 1000) {
77
+ static setAc(id, desiredState, desiredMode, desiredTemperature, forceTime = 60 * 60 * 1000) {
70
78
  const d = this.getAc(id);
71
79
  if (!d) {
72
80
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `AC Device for id ${id} not found`);
@@ -84,7 +92,7 @@ class API {
84
92
  desiredMode = settings_service_1.SettingsService.heatMode == config_1.HeatingMode.Winter ? ac_1.AcMode.Heating : ac_1.AcMode.Cooling;
85
93
  }
86
94
  }
87
- d.setState(desiredMode, forceTime);
95
+ d.setState(desiredMode, desiredTemperature, forceTime);
88
96
  return true;
89
97
  }
90
98
  /**
@@ -242,6 +250,18 @@ class API {
242
250
  d.settings.persist(d);
243
251
  return null;
244
252
  }
253
+ static setGroupSettings(groupId, settings) {
254
+ const g = this.getGroup(groupId);
255
+ if (g === undefined) {
256
+ return new Error(`Group with ID ${groupId} not found`);
257
+ }
258
+ if (g.settings === undefined) {
259
+ return new Error(`Group with ID ${groupId} has no settings`);
260
+ }
261
+ g.settings.fromPartialObject(settings);
262
+ g.settings.persist(g);
263
+ return null;
264
+ }
245
265
  /**
246
266
  * Changes the settings of a given room
247
267
  * @param {string} roomName The id of the Room to change the settings
@@ -325,7 +325,7 @@ BEGIN
325
325
  WHERE table_name = 'EnergyCalculation'
326
326
  and column_name = 'batteryStoredKwH') Then
327
327
  alter table hoffmation_schema."EnergyCalculation"
328
- add "batteryStoredKwH" integer;
328
+ add "batteryStoredKwH" double precision;
329
329
  END IF;
330
330
 
331
331
  IF (SELECT COUNT(column_name) = 0
@@ -1,8 +1,9 @@
1
1
  import { ringStorage } from '../utils';
2
2
  import { iRoomBase, RoomBase } from '../../../models';
3
- import { iRoomDevice } from '../../devices';
3
+ import { BaseGroup, iRoomDevice } from '../../devices';
4
4
  export declare class RoomService {
5
5
  static Rooms: Map<string, RoomBase>;
6
+ static Groups: Map<string, BaseGroup>;
6
7
  static awayModeActive: boolean;
7
8
  static nightAlarmActive: boolean;
8
9
  static movementHistory: ringStorage<string>;
@@ -192,6 +192,7 @@ class RoomService {
192
192
  }
193
193
  exports.RoomService = RoomService;
194
194
  RoomService.Rooms = new Map();
195
+ RoomService.Groups = new Map();
195
196
  RoomService.awayModeActive = false;
196
197
  RoomService.nightAlarmActive = false;
197
198
  RoomService.movementHistory = new utils_1.ringStorage(15);
@@ -56,7 +56,7 @@ class VictronDevice {
56
56
  }
57
57
  get id() {
58
58
  var _a;
59
- return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `sonos-${this.info.room}-${this.info.customName}`;
59
+ return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `victron-${this.info.room}-${this.info.customName}`;
60
60
  }
61
61
  addExcessConsumer(device) {
62
62
  this._excessEnergyConsumer.push(device);