hoffmation-base 3.0.0-alpha.25 → 3.0.0-alpha.27

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.
@@ -16,7 +16,7 @@ export declare class DimmerSetLightCommand extends LampSetLightCommand {
16
16
  * @param on - The desired value
17
17
  * @param reason - You can provide a reason for clarity
18
18
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
19
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
20
20
  * @param brightness - The desired brightness
21
21
  * @param transitionTime - The transition time during turnOn/turnOff
22
22
  */
@@ -11,7 +11,7 @@ class DimmerSetLightCommand extends lampSetLightCommand_1.LampSetLightCommand {
11
11
  * @param on - The desired value
12
12
  * @param reason - You can provide a reason for clarity
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The desired brightness
16
16
  * @param transitionTime - The transition time during turnOn/turnOff
17
17
  */
@@ -12,7 +12,7 @@ export declare class LampSetLightCommand extends ActuatorSetStateCommand {
12
12
  * @param on - The new state of the light
13
13
  * @param reason - You can provide a reason for clarification
14
14
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
15
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
16
16
  */
17
17
  constructor(source: CommandSource | BaseCommand, on: boolean, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
18
18
  /** @inheritDoc */
@@ -10,7 +10,7 @@ class LampSetLightCommand extends actuatorSetStateCommand_1.ActuatorSetStateComm
10
10
  * @param on - The new state of the light
11
11
  * @param reason - You can provide a reason for clarification
12
12
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
13
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
13
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
14
  */
15
15
  constructor(source, on, reason = '', disableAutomatic) {
16
16
  super(source, on, reason, disableAutomatic);
@@ -19,7 +19,7 @@ export declare class LampSetTimeBasedCommand extends BaseCommand {
19
19
  * @param time - The time to use for calculation of desired state
20
20
  * @param reason - You can provide a reason for clarity
21
21
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
22
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
22
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
23
23
  */
24
24
  constructor(source: CommandSource | BaseCommand, time: TimeOfDay, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
25
25
  }
@@ -10,7 +10,7 @@ class LampSetTimeBasedCommand extends baseCommand_1.BaseCommand {
10
10
  * @param time - The time to use for calculation of desired state
11
11
  * @param reason - You can provide a reason for clarity
12
12
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
13
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
13
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
14
  */
15
15
  constructor(source, time, reason = '', disableAutomatic) {
16
16
  super(source, reason);
@@ -16,7 +16,7 @@ export declare class LedSetLightCommand extends DimmerSetLightCommand {
16
16
  * @param on - The desired state-value
17
17
  * @param reason - You can provide a reason for clarity
18
18
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
19
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
20
20
  * @param brightness - The desired brightness
21
21
  * @param transitionTime - The transition time during turnOn/turnOff
22
22
  * @param color - The desired color in 6 digit hex Code
@@ -11,7 +11,7 @@ class LedSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand {
11
11
  * @param on - The desired state-value
12
12
  * @param reason - You can provide a reason for clarity
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The desired brightness
16
16
  * @param transitionTime - The transition time during turnOn/turnOff
17
17
  * @param color - The desired color in 6 digit hex Code
@@ -15,7 +15,7 @@ export declare class WledSetLightCommand extends DimmerSetLightCommand {
15
15
  * @param on - The desired state of the light
16
16
  * @param reason - You can provide a reason for clarification
17
17
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
18
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
18
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
19
  * @param brightness - The brightness of the light
20
20
  * @param transitionTime - The time in milliseconds the transition should take
21
21
  * @param preset - The preset to use
@@ -11,7 +11,7 @@ class WledSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand
11
11
  * @param on - The desired state of the light
12
12
  * @param reason - You can provide a reason for clarification
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The brightness of the light
16
16
  * @param transitionTime - The time in milliseconds the transition should take
17
17
  * @param preset - The preset to use
@@ -37,7 +37,7 @@ class DeviceUpdater {
37
37
  classifier = devices_1.Devices.IDENTIFIER_ZIGBEE;
38
38
  devId = idSplit[2].substring(2);
39
39
  }
40
- const device = services_1.API.getDevice(`${classifier}-${devId}`);
40
+ const device = services_1.API.getDevice(`${classifier}-${devId}`, false);
41
41
  if (typeof device === 'undefined' || device.update === undefined) {
42
42
  return;
43
43
  }
@@ -69,7 +69,6 @@ class LampUtils {
69
69
  return false;
70
70
  }
71
71
  static setActuator(device, c) {
72
- var _a;
73
72
  if (device.settings.isStromStoss &&
74
73
  c.on &&
75
74
  c.containsType(models_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand)) {
@@ -96,8 +95,13 @@ class LampUtils {
96
95
  if (dontBlock || c.disableAutomaticCommand === null) {
97
96
  return;
98
97
  }
99
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, device.settings));
100
- if (c.disableAutomaticCommand !== null) {
98
+ if (dontBlock) {
99
+ return;
100
+ }
101
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
102
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, device.settings);
103
+ }
104
+ if (c.disableAutomaticCommand) {
101
105
  device.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
102
106
  }
103
107
  }
@@ -57,7 +57,6 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
57
57
  this.setWled(new models_1.WledSetLightCommand(c, c.on, 'Set Wled due to DimmerSetLightCommand', c.disableAutomaticCommand, c.brightness, c.transitionTime, undefined));
58
58
  }
59
59
  setWled(c) {
60
- var _a;
61
60
  if (this._onID === '') {
62
61
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Keine On ID für "${this.info.customName}" bekannt.`);
63
62
  return;
@@ -90,11 +89,14 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
90
89
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Dimmer Helligkeit schalten ergab Fehler: ${err}`);
91
90
  });
92
91
  }
93
- if (!dontBlock && c.disableAutomaticCommand !== null) {
94
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings));
95
- if (c.disableAutomaticCommand !== null) {
96
- this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
97
- }
92
+ if (dontBlock || c.disableAutomaticCommand === null) {
93
+ return;
94
+ }
95
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
96
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings);
97
+ }
98
+ if (c.disableAutomaticCommand) {
99
+ this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
98
100
  }
99
101
  }
100
102
  setTimeBased(c) {
@@ -79,7 +79,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
79
79
  }
80
80
  /** @inheritDoc */
81
81
  setLight(c) {
82
- var _a, _b;
82
+ var _a;
83
83
  if (this._stateIdState === '') {
84
84
  this.log(models_1.LogLevel.Error, 'Keine State ID bekannt.');
85
85
  return;
@@ -99,12 +99,14 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
99
99
  c.brightness = 10;
100
100
  }
101
101
  if (!dontBlock && c.disableAutomaticCommand !== null) {
102
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings));
103
- if (c.disableAutomaticCommand !== null) {
102
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
103
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings);
104
+ }
105
+ if (c.disableAutomaticCommand) {
104
106
  this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
105
107
  }
106
108
  }
107
- if (((_b = services_1.SettingsService.settings.ioBroker) === null || _b === void 0 ? void 0 : _b.useZigbee2mqtt) && !c.on) {
109
+ if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !c.on) {
108
110
  // With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
109
111
  this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on));
110
112
  this.queuedValue = c.on;
@@ -19,7 +19,7 @@ export declare class API {
19
19
  static getDevices(): {
20
20
  [id: string]: iBaseDevice;
21
21
  };
22
- static getDevice(id: string): iBaseDevice;
22
+ static getDevice(id: string, warnIfNotFound?: boolean): iBaseDevice;
23
23
  static getGroup(id: string): BaseGroup | undefined;
24
24
  static getRooms(): Map<string, RoomBase>;
25
25
  static getRoom(id: string): RoomBase | undefined;
@@ -45,9 +45,9 @@ class API {
45
45
  return devices_1.Devices.alLDevices;
46
46
  }
47
47
  // TODO: Missing Comment
48
- static getDevice(id) {
48
+ static getDevice(id, warnIfNotFound = true) {
49
49
  const d = devices_1.Devices.alLDevices[id];
50
- if (d === undefined) {
50
+ if (d === undefined && warnIfNotFound) {
51
51
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Api.getDevice() --> "${id}" not found`);
52
52
  }
53
53
  return d;