hoffmation-base 3.0.0-alpha.30 → 3.0.0-alpha.31

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 (103) hide show
  1. package/lib/models/action/baseAction.d.ts +4 -0
  2. package/lib/models/action/baseAction.js +10 -0
  3. package/lib/models/action/humiditySensorChangeAction.d.ts +16 -0
  4. package/lib/models/action/humiditySensorChangeAction.js +15 -0
  5. package/lib/models/action/index.d.ts +1 -0
  6. package/lib/models/action/index.js +5 -0
  7. package/lib/models/action/motionSensorAction.d.ts +16 -0
  8. package/lib/models/action/motionSensorAction.js +15 -0
  9. package/lib/models/action/presenceGroupFirstEnterAction.d.ts +7 -0
  10. package/lib/models/action/presenceGroupFirstEnterAction.js +13 -0
  11. package/lib/models/action/presenceGroupLastLeftAction.d.ts +7 -0
  12. package/lib/models/action/presenceGroupLastLeftAction.js +13 -0
  13. package/lib/models/action/shutterPositionChangedAction.d.ts +13 -0
  14. package/lib/models/action/shutterPositionChangedAction.js +15 -0
  15. package/lib/models/action/temperatureSensorChangeAction.d.ts +16 -0
  16. package/lib/models/action/temperatureSensorChangeAction.js +15 -0
  17. package/lib/models/command/ShutterSetLevelCommand.d.ts +1 -1
  18. package/lib/models/command/ShutterSetLevelCommand.js +1 -1
  19. package/lib/models/command/WindowRestoreDesiredPositionCommand.d.ts +1 -1
  20. package/lib/models/command/WindowRestoreDesiredPositionCommand.js +1 -1
  21. package/lib/models/command/WindowSetDesiredPositionCommand.d.ts +1 -1
  22. package/lib/models/command/WindowSetDesiredPositionCommand.js +1 -1
  23. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.d.ts +1 -1
  24. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +1 -1
  25. package/lib/models/command/actuatorSetStateCommand.d.ts +1 -1
  26. package/lib/models/command/actuatorSetStateCommand.js +1 -1
  27. package/lib/models/command/actuatorToggleCommand.d.ts +1 -1
  28. package/lib/models/command/actuatorToggleCommand.js +1 -1
  29. package/lib/models/command/actuatorWriteStateToDeviceCommand.d.ts +1 -1
  30. package/lib/models/command/actuatorWriteStateToDeviceCommand.js +1 -1
  31. package/lib/models/command/baseCommand.d.ts +1 -1
  32. package/lib/models/command/baseCommand.js +2 -2
  33. package/lib/models/command/blockAutomaticCommand.d.ts +1 -1
  34. package/lib/models/command/blockAutomaticCommand.js +1 -1
  35. package/lib/models/command/blockAutomaticLiftBlockCommand.d.ts +1 -1
  36. package/lib/models/command/blockAutomaticLiftBlockCommand.js +1 -1
  37. package/lib/models/command/blockAutomaticUntilCommand.d.ts +1 -1
  38. package/lib/models/command/blockAutomaticUntilCommand.js +1 -1
  39. package/lib/models/command/commandType.d.ts +6 -0
  40. package/lib/models/command/commandType.js +6 -0
  41. package/lib/models/command/dimmerSetLightCommand.d.ts +1 -1
  42. package/lib/models/command/dimmerSetLightCommand.js +1 -1
  43. package/lib/models/command/floorSetAllShuttersCommand.d.ts +1 -1
  44. package/lib/models/command/floorSetAllShuttersCommand.js +1 -1
  45. package/lib/models/command/lampSetLightCommand.d.ts +1 -1
  46. package/lib/models/command/lampSetLightCommand.js +1 -1
  47. package/lib/models/command/lampSetTimeBasedCommand.d.ts +1 -1
  48. package/lib/models/command/lampSetTimeBasedCommand.js +1 -1
  49. package/lib/models/command/lampToggleLightCommand.d.ts +1 -1
  50. package/lib/models/command/lampToggleLightCommand.js +1 -1
  51. package/lib/models/command/ledSetLightCommand.d.ts +1 -1
  52. package/lib/models/command/ledSetLightCommand.js +1 -1
  53. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.d.ts +1 -1
  54. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +1 -1
  55. package/lib/models/command/restoreTargetAutomaticValueCommand.d.ts +1 -1
  56. package/lib/models/command/restoreTargetAutomaticValueCommand.js +1 -1
  57. package/lib/models/command/roomRestoreLightCommand.d.ts +1 -1
  58. package/lib/models/command/roomRestoreLightCommand.js +1 -1
  59. package/lib/models/command/roomRestoreShutterPositionCommand.d.ts +1 -1
  60. package/lib/models/command/roomRestoreShutterPositionCommand.js +1 -1
  61. package/lib/models/command/roomSetLightTimeBasedCommand.d.ts +1 -1
  62. package/lib/models/command/roomSetLightTimeBasedCommand.js +1 -1
  63. package/lib/models/command/shutterSunriseUpCommand.d.ts +1 -1
  64. package/lib/models/command/shutterSunriseUpCommand.js +1 -1
  65. package/lib/models/command/shutterSunsetDownCommand.d.ts +1 -1
  66. package/lib/models/command/shutterSunsetDownCommand.js +1 -1
  67. package/lib/models/command/wledSetLightCommand.d.ts +1 -1
  68. package/lib/models/command/wledSetLightCommand.js +1 -1
  69. package/lib/models/index.d.ts +1 -0
  70. package/lib/models/index.js +1 -0
  71. package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +2 -1
  72. package/lib/server/devices/baseDeviceInterfaces/iMotionSensor.d.ts +2 -1
  73. package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +1 -1
  74. package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +2 -1
  75. package/lib/server/devices/blueIris/cameraDevice.d.ts +2 -1
  76. package/lib/server/devices/blueIris/cameraDevice.js +2 -1
  77. package/lib/server/devices/dachs/dachsTemperatureSensor.d.ts +2 -1
  78. package/lib/server/devices/dachs/dachsTemperatureSensor.js +3 -2
  79. package/lib/server/devices/groups/Window.d.ts +2 -1
  80. package/lib/server/devices/groups/Window.js +4 -4
  81. package/lib/server/devices/groups/presenceGroup.d.ts +5 -2
  82. package/lib/server/devices/groups/presenceGroup.js +36 -39
  83. package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +2 -1
  84. package/lib/server/devices/hmIPDevices/hmIpBewegung.js +2 -1
  85. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +4 -2
  86. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +6 -4
  87. package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +8 -7
  88. package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +10 -9
  89. package/lib/server/devices/hmIPDevices/hmIpRoll.js +2 -1
  90. package/lib/server/devices/sharedFunctions/lampUtils.d.ts +10 -2
  91. package/lib/server/devices/sharedFunctions/lampUtils.js +29 -5
  92. package/lib/server/devices/wledDevice.js +7 -0
  93. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +7 -0
  94. package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +3 -2
  95. package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +2 -1
  96. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +1 -1
  97. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +2 -1
  98. package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +4 -2
  99. package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +6 -4
  100. package/lib/server/services/ac/ac-device.js +3 -3
  101. package/lib/server/services/govee/own-govee-device.js +7 -0
  102. package/lib/tsconfig.tsbuildinfo +1 -1
  103. package/package.json +1 -1
@@ -2,29 +2,30 @@ import { HmIPDevice } from './hmIpDevice';
2
2
  import { MotionSensorSettings } from '../../../models';
3
3
  import { iBatteryDevice, iIlluminationSensor, iMotionSensor } from '../baseDeviceInterfaces';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
+ import { MotionSensorAction } from '../../../models/action/motionSensorAction';
5
6
  export declare class HmIpPraezenz extends HmIPDevice implements iIlluminationSensor, iBatteryDevice, iMotionSensor {
6
- private _battery;
7
- private _lastBatteryPersist;
8
- get lastBatteryPersist(): number;
9
7
  private static PRESENCE_DETECTION;
10
8
  private static CURRENT_ILLUMINATION;
11
9
  /** @inheritDoc */
12
10
  movementDetected: boolean;
13
- get battery(): number;
14
11
  /** @inheritDoc */
15
12
  settings: MotionSensorSettings;
13
+ private _battery;
14
+ private _lastBatteryPersist;
16
15
  private _movementDetectedCallback;
17
16
  private initialized;
18
17
  private _lastMotionTime;
18
+ private _detectionsToday;
19
+ private _currentIllumination;
19
20
  constructor(pInfo: IoBrokerDeviceInfo);
21
+ get lastBatteryPersist(): number;
22
+ get battery(): number;
20
23
  get timeSinceLastMotion(): number;
21
- private _detectionsToday;
22
24
  get detectionsToday(): number;
23
25
  set detectionsToday(pVal: number);
24
- private _currentIllumination;
25
26
  get currentIllumination(): number;
26
27
  private set currentIllumination(value);
27
- addMovementCallback(pCallback: (pValue: boolean) => void): void;
28
+ addMovementCallback(pCallback: (action: MotionSensorAction) => void): void;
28
29
  /** @inheritDoc */
29
30
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
30
31
  updatePresence(pVal: boolean): void;
@@ -6,22 +6,17 @@ const deviceType_1 = require("../deviceType");
6
6
  const models_1 = require("../../../models");
7
7
  const services_1 = require("../../services");
8
8
  const DeviceCapability_1 = require("../DeviceCapability");
9
+ const motionSensorAction_1 = require("../../../models/action/motionSensorAction");
9
10
  class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
10
- get lastBatteryPersist() {
11
- return this._lastBatteryPersist;
12
- }
13
- get battery() {
14
- return this._battery;
15
- }
16
11
  constructor(pInfo) {
17
12
  var _a;
18
13
  super(pInfo, deviceType_1.DeviceType.HmIpPraezenz);
19
- this._battery = -99;
20
- this._lastBatteryPersist = 0;
21
14
  /** @inheritDoc */
22
15
  this.movementDetected = false;
23
16
  /** @inheritDoc */
24
17
  this.settings = new models_1.MotionSensorSettings();
18
+ this._battery = -99;
19
+ this._lastBatteryPersist = 0;
25
20
  this._movementDetectedCallback = [];
26
21
  // private presenceStateID: string;
27
22
  this.initialized = false;
@@ -46,6 +41,12 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
46
41
  });
47
42
  }
48
43
  }
44
+ get lastBatteryPersist() {
45
+ return this._lastBatteryPersist;
46
+ }
47
+ get battery() {
48
+ return this._battery;
49
+ }
49
50
  get timeSinceLastMotion() {
50
51
  return Math.floor((services_1.Utils.nowMS() - this._lastMotionTime) / 1000);
51
52
  }
@@ -112,7 +113,7 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
112
113
  this.log(models_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
113
114
  }
114
115
  for (const c of this._movementDetectedCallback) {
115
- c(pVal);
116
+ c(new motionSensorAction_1.MotionSensorAction(this));
116
117
  }
117
118
  }
118
119
  persistMotionSensor() {
@@ -11,6 +11,7 @@ const models_1 = require("../models");
11
11
  const models_2 = require("../../../models");
12
12
  const lodash_1 = __importDefault(require("lodash"));
13
13
  const DeviceCapability_1 = require("../DeviceCapability");
14
+ const shutterPositionChangedAction_1 = require("../../../models/action/shutterPositionChangedAction");
14
15
  class HmIpRoll extends hmIpDevice_1.HmIPDevice {
15
16
  constructor(pInfo) {
16
17
  var _a;
@@ -44,7 +45,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
44
45
  if (value !== this._currentLevel && this._window) {
45
46
  services_1.Utils.guardedNewThread(() => {
46
47
  var _a;
47
- (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(value);
48
+ (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(new shutterPositionChangedAction_1.ShutterPositionChangedAction(this, value));
48
49
  }, this);
49
50
  this.persist();
50
51
  }
@@ -1,5 +1,6 @@
1
1
  import { iActuator, iLamp } from '../baseDeviceInterfaces';
2
- import { ActuatorSetStateCommand, LampSetTimeBasedCommand, LampToggleLightCommand } from '../../../models';
2
+ import { ActuatorSetStateCommand, DimmerSetLightCommand, LampSetTimeBasedCommand, LampToggleLightCommand } from '../../../models';
3
+ import { iDimmableLamp } from '../baseDeviceInterfaces/iDimmableLamp';
3
4
  export declare class LampUtils {
4
5
  private static stromStossContinueTimeouts;
5
6
  static stromStossOn(actuator: iActuator): void;
@@ -7,6 +8,13 @@ export declare class LampUtils {
7
8
  static checkUnBlock(device: iActuator, command: ActuatorSetStateCommand): boolean;
8
9
  static toggleLight(device: iLamp, c: LampToggleLightCommand): boolean;
9
10
  static checkBlockActive(device: iActuator, c: ActuatorSetStateCommand): boolean;
10
- static checkUnchanged(device: iActuator, c: ActuatorSetStateCommand): boolean;
11
+ /**
12
+ * Check if the dimmer is already in the desired state thus allowing to skip this command
13
+ * @param {iDimmableLamp} device - The device to check
14
+ * @param {DimmerSetLightCommand} c - The command to check
15
+ * @returns {boolean} - True if the command can be skipped
16
+ */
17
+ static checkDimmerUnchanged(device: iDimmableLamp, c: DimmerSetLightCommand): boolean;
18
+ static checkUnchanged(device: iActuator, c: ActuatorSetStateCommand, noLog?: boolean): boolean;
11
19
  static setActuator(device: iActuator, c: ActuatorSetStateCommand): void;
12
20
  }
@@ -61,12 +61,36 @@ class LampUtils {
61
61
  }
62
62
  return false;
63
63
  }
64
- static checkUnchanged(device, c) {
65
- if (!c.isForceAction && c.on === device.actuatorOn && device.queuedValue === null) {
66
- device.log(models_1.LogLevel.DeepTrace, `Skip light command as it is already ${c.on}`, services_1.LogDebugType.SkipUnchangedActuatorCommand);
67
- return true;
64
+ /**
65
+ * Check if the dimmer is already in the desired state thus allowing to skip this command
66
+ * @param {iDimmableLamp} device - The device to check
67
+ * @param {DimmerSetLightCommand} c - The command to check
68
+ * @returns {boolean} - True if the command can be skipped
69
+ */
70
+ static checkDimmerUnchanged(device, c) {
71
+ if (c.isForceAction) {
72
+ return false;
73
+ }
74
+ if (!this.checkUnchanged(device, c, true)) {
75
+ return false;
76
+ }
77
+ if (c.brightness !== device.brightness) {
78
+ return false;
79
+ }
80
+ device.log(models_1.LogLevel.DeepTrace, `Light command can be skipped as the device is already in desired state: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedActuatorCommand);
81
+ return true;
82
+ }
83
+ static checkUnchanged(device, c, noLog = false) {
84
+ if (c.isForceAction) {
85
+ return false;
68
86
  }
69
- return false;
87
+ if (c.on !== device.queuedValue || (device.queuedValue === null && device.actuatorOn !== c.on)) {
88
+ return false;
89
+ }
90
+ if (!noLog) {
91
+ device.log(models_1.LogLevel.DeepTrace, `Light command can be skipped as device is already in desired state; command: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedActuatorCommand);
92
+ }
93
+ return true;
70
94
  }
71
95
  static setActuator(device, c) {
72
96
  if (device.settings.isStromStoss &&
@@ -69,6 +69,13 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
69
69
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
70
70
  return;
71
71
  }
72
+ if (sharedFunctions_1.LampUtils.checkDimmerUnchanged(this, c)) {
73
+ return;
74
+ }
75
+ if (c.isAutomaticAction) {
76
+ // Preserve the target state for the automatic handler, as
77
+ this.targetAutomaticState = c.on;
78
+ }
72
79
  this.log(models_1.LogLevel.Debug, c.logMessage);
73
80
  if (c.on && c.brightness !== -1 && this.brightness < 10) {
74
81
  c.brightness = 10;
@@ -57,6 +57,13 @@ class ZigbeeDimmer extends zigbeeLamp_1.ZigbeeLamp {
57
57
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
58
58
  return;
59
59
  }
60
+ if (sharedFunctions_1.LampUtils.checkDimmerUnchanged(this, c)) {
61
+ return;
62
+ }
63
+ if (c.isAutomaticAction) {
64
+ // Preserve the target state for the automatic handler, as
65
+ this.targetAutomaticState = c.on;
66
+ }
60
67
  if (c.transitionTime > -1) {
61
68
  this.setState(this._stateIdTransitionTime, c.transitionTime);
62
69
  }
@@ -4,13 +4,14 @@ import { ZigbeeDevice } from './index';
4
4
  import { MotionSensorSettings } from '../../../../models';
5
5
  import { iBatteryDevice, iMotionSensor } from '../../baseDeviceInterfaces';
6
6
  import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
7
+ import { MotionSensorAction } from '../../../../models/action/motionSensorAction';
7
8
  export declare class ZigbeeMotionSensor extends ZigbeeDevice implements iMotionSensor, iBatteryDevice {
8
9
  /** @inheritDoc */
9
10
  settings: MotionSensorSettings;
10
11
  /** @inheritDoc */
11
12
  detectionsToday: number;
12
13
  protected _initialized: boolean;
13
- protected _movementDetectedCallback: Array<(pValue: boolean) => void>;
14
+ protected _movementDetectedCallback: Array<(action: MotionSensorAction) => void>;
14
15
  protected _needsMovementResetFallback: boolean;
15
16
  protected _fallBackTimeout: NodeJS.Timeout | undefined;
16
17
  protected _timeSinceLastMotion: number;
@@ -31,7 +32,7 @@ export declare class ZigbeeMotionSensor extends ZigbeeDevice implements iMotionS
31
32
  * @param pCallback - Function that accepts the new state as parameter
32
33
  */
33
34
  /** @inheritDoc */
34
- addMovementCallback(pCallback: (newState: boolean) => void): void;
35
+ addMovementCallback(pCallback: (action: MotionSensorAction) => void): void;
35
36
  /** @inheritDoc */
36
37
  persistMotionSensor(): void;
37
38
  updateMovement(newState: boolean): void;
@@ -5,6 +5,7 @@ const index_1 = require("./index");
5
5
  const models_1 = require("../../../../models");
6
6
  const services_1 = require("../../../services");
7
7
  const DeviceCapability_1 = require("../../DeviceCapability");
8
+ const motionSensorAction_1 = require("../../../../models/action/motionSensorAction");
8
9
  class ZigbeeMotionSensor extends index_1.ZigbeeDevice {
9
10
  constructor(pInfo, type) {
10
11
  var _a;
@@ -102,7 +103,7 @@ class ZigbeeMotionSensor extends index_1.ZigbeeDevice {
102
103
  this.log(models_1.LogLevel.Trace, `This is movement no. ${this.detectionsToday}`);
103
104
  }
104
105
  for (const c of this._movementDetectedCallback) {
105
- c(newState);
106
+ c(new motionSensorAction_1.MotionSensorAction(this));
106
107
  }
107
108
  }
108
109
  /** @inheritDoc */
@@ -19,7 +19,7 @@ export declare class ZigbeeShutter extends ZigbeeDevice implements iShutter {
19
19
  /** @inheritDoc */
20
20
  get currentLevel(): number;
21
21
  /** @inheritDoc */
22
- set currentLevel(value: number);
22
+ protected set currentLevel(value: number);
23
23
  protected _window?: Window;
24
24
  /** @inheritDoc */
25
25
  get window(): Window | undefined;
@@ -10,6 +10,7 @@ const zigbeeDevice_1 = require("./zigbeeDevice");
10
10
  const models_2 = require("../../models");
11
11
  const lodash_1 = __importDefault(require("lodash"));
12
12
  const DeviceCapability_1 = require("../../DeviceCapability");
13
+ const shutterPositionChangedAction_1 = require("../../../../models/action/shutterPositionChangedAction");
13
14
  class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
14
15
  constructor(pInfo, pType) {
15
16
  var _a, _b;
@@ -52,7 +53,7 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
52
53
  if (value !== this._currentLevel && this._window) {
53
54
  services_1.Utils.guardedNewThread(() => {
54
55
  var _a;
55
- (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(value);
56
+ (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(new shutterPositionChangedAction_1.ShutterPositionChangedAction(this, value));
56
57
  }, this);
57
58
  this.persist();
58
59
  }
@@ -2,6 +2,8 @@
2
2
  import { ZigbeeDevice } from './BaseDevices';
3
3
  import { iBatteryDevice, iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
+ import { HumiditySensorChangeAction } from '../../../models/action/humiditySensorChangeAction';
6
+ import { TemperatureSensorChangeAction } from '../../../models/action/temperatureSensorChangeAction';
5
7
  export declare class ZigbeeSonoffTemp extends ZigbeeDevice implements iTemperatureSensor, iHumiditySensor, iBatteryDevice {
6
8
  private _battery;
7
9
  private _lastBatteryPersist;
@@ -34,9 +36,9 @@ export declare class ZigbeeSonoffTemp extends ZigbeeDevice implements iTemperatu
34
36
  /** @inheritDoc */
35
37
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
36
38
  /** @inheritDoc */
37
- addHumidityCallback(pCallback: (pValue: number) => void): void;
39
+ addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
38
40
  /** @inheritDoc */
39
- addTempChangeCallback(pCallback: (pValue: number) => void): void;
41
+ addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
40
42
  /** @inheritDoc */
41
43
  onTemperaturChange(newTemperatur: number): void;
42
44
  /** @inheritDoc */
@@ -7,6 +7,8 @@ const deviceType_1 = require("../deviceType");
7
7
  const DeviceCapability_1 = require("../DeviceCapability");
8
8
  const models_1 = require("../../../models");
9
9
  const services_1 = require("../../services");
10
+ const humiditySensorChangeAction_1 = require("../../../models/action/humiditySensorChangeAction");
11
+ const temperatureSensorChangeAction_1 = require("../../../models/action/temperatureSensorChangeAction");
10
12
  class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
11
13
  /** @inheritDoc */
12
14
  get lastBatteryPersist() {
@@ -52,7 +54,7 @@ class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
52
54
  set humidity(val) {
53
55
  this._humidity = val;
54
56
  for (const cb of this._humidityCallbacks) {
55
- cb(val);
57
+ cb(new humiditySensorChangeAction_1.HumiditySensorChangeAction(this, val));
56
58
  }
57
59
  }
58
60
  /** @inheritDoc */
@@ -66,7 +68,7 @@ class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
66
68
  set temperature(val) {
67
69
  this._temperature = val;
68
70
  for (const cb of this._temperaturCallbacks) {
69
- cb(val);
71
+ cb(new temperatureSensorChangeAction_1.TemperatureSensorChangeAction(this, val));
70
72
  }
71
73
  }
72
74
  /** @inheritDoc */
@@ -92,14 +94,14 @@ class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
92
94
  addHumidityCallback(pCallback) {
93
95
  this._humidityCallbacks.push(pCallback);
94
96
  if (this._humidity > 0) {
95
- pCallback(this._humidity);
97
+ pCallback(new humiditySensorChangeAction_1.HumiditySensorChangeAction(this, this._humidity));
96
98
  }
97
99
  }
98
100
  /** @inheritDoc */
99
101
  addTempChangeCallback(pCallback) {
100
102
  this._temperaturCallbacks.push(pCallback);
101
103
  if (this._temperature > baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
102
- pCallback(this._temperature);
104
+ pCallback(new temperatureSensorChangeAction_1.TemperatureSensorChangeAction(this, this._temperature));
103
105
  }
104
106
  }
105
107
  /** @inheritDoc */
@@ -283,18 +283,18 @@ class AcDevice {
283
283
  }
284
284
  this.turnOn();
285
285
  }
286
- onRoomFirstEnter() {
286
+ onRoomFirstEnter(_action) {
287
287
  if (!this.settings.noCoolingOnMovement || !this.on || this.mode === ac_mode_1.AcMode.Heating) {
288
288
  return;
289
289
  }
290
290
  this.log(models_1.LogLevel.Info, 'Someone entered the room. Turning off AC');
291
291
  this.turnOff();
292
292
  }
293
- onRoomLastLeave() {
293
+ onRoomLastLeave(action) {
294
294
  if (!this.settings.noCoolingOnMovement) {
295
295
  return;
296
296
  }
297
- this.log(models_1.LogLevel.Info, 'Last person left the room. Checking if we should turn on AC');
297
+ this.log(models_1.LogLevel.Info, `Last person left the room (${action.reasonTrace}). Checking if we should turn on AC`);
298
298
  this.restoreTargetAutomaticValue();
299
299
  }
300
300
  /** @inheritDoc */
@@ -117,6 +117,13 @@ class OwnGoveeDevice {
117
117
  if (devices_1.LampUtils.checkBlockActive(this, c)) {
118
118
  return;
119
119
  }
120
+ if (devices_1.LampUtils.checkDimmerUnchanged(this, c)) {
121
+ return;
122
+ }
123
+ if (c.isAutomaticAction) {
124
+ // Preserve the target state for the automatic handler, as
125
+ this.targetAutomaticState = c.on;
126
+ }
120
127
  if (c.brightness > -1 && c.on) {
121
128
  this.setBrightness(c.brightness, () => {
122
129
  this.turnOn();