hoffmation-base 3.4.9 → 3.6.0
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.
- package/lib/api/api-service.d.ts +9 -12
- package/lib/api/api-service.js +13 -28
- package/lib/command/acPerformAutomaticCheckCommand.d.ts +18 -0
- package/lib/command/acPerformAutomaticCheckCommand.js +25 -0
- package/lib/command/acSetStateCommand.d.ts +34 -0
- package/lib/command/acSetStateCommand.js +40 -0
- package/lib/command/acWriteStateToDeviceCommand.d.ts +25 -0
- package/lib/command/acWriteStateToDeviceCommand.js +30 -0
- package/lib/command/excessEnergyConsumerSetStateCommand.d.ts +19 -0
- package/lib/command/excessEnergyConsumerSetStateCommand.js +26 -0
- package/lib/command/index.d.ts +4 -0
- package/lib/command/index.js +9 -1
- package/lib/devices/groups/heatGroup.d.ts +6 -3
- package/lib/devices/groups/heatGroup.js +19 -8
- package/lib/devices/groups/tasterGroup.js +5 -2
- package/lib/devices/jsObject/jsObjectEnergyManager.js +3 -4
- package/lib/devices/sharedFunctions/shutterUtils.js +7 -2
- package/lib/devices/tv/tvDevice.d.ts +2 -1
- package/lib/devices/tv/tvDevice.js +5 -1
- package/lib/devices/victron/victron-device.js +3 -4
- package/lib/devices/zigbee/zigbeeBlitzShp.d.ts +2 -3
- package/lib/devices/zigbee/zigbeeBlitzShp.js +5 -7
- package/lib/enums/commandType.d.ts +4 -0
- package/lib/enums/commandType.js +4 -0
- package/lib/interfaces/baseDevices/iAcDevice.d.ts +14 -4
- package/lib/interfaces/baseDevices/iExcessEnergyConsumer.d.ts +7 -6
- package/lib/interfaces/groups/iHeatGroup.d.ts +4 -3
- package/lib/services/ac/ac-device.d.ts +45 -13
- package/lib/services/ac/ac-device.js +97 -33
- package/lib/services/ac/daikin-service.d.ts +2 -1
- package/lib/services/ac/daikin-service.js +8 -13
- package/lib/services/ac/own-daikin-device.d.ts +4 -3
- package/lib/services/ac/own-daikin-device.js +6 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/api/api-service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseGroup, DeviceSettings } from '../devices';
|
|
2
|
-
import {
|
|
3
|
-
import { ActuatorSetStateCommand, BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, DimmerSetLightCommand, LampSetLightCommand, LedSetLightCommand, ShutterSetLevelCommand } from '../command';
|
|
2
|
+
import { ButtonPosition, ButtonPressType, CollisionSolving } from '../enums';
|
|
3
|
+
import { AcSetStateCommand, AcWriteStateToDeviceCommand, ActuatorSetStateCommand, BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, DimmerSetLightCommand, LampSetLightCommand, LedSetLightCommand, ShutterSetLevelCommand } from '../command';
|
|
4
4
|
import { iAcDevice, iBaseDevice, iRoomBase, iTemperatureMeasurement } from '../interfaces';
|
|
5
5
|
import { LogObject } from '../logging';
|
|
6
6
|
import { GroupSettings } from '../settingsObjects';
|
|
@@ -26,20 +26,17 @@ export declare class API {
|
|
|
26
26
|
static getRoom(id: string): iRoomBase | undefined;
|
|
27
27
|
static getLog(): LogObject[];
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @
|
|
33
|
-
* @param desiredTemperature - The desired temperature for the AC in Celsius
|
|
34
|
-
* @param forceTime - The time in ms this should not change before automatic change is allowed again
|
|
35
|
-
* @returns True if the AC was found and the state was changed
|
|
29
|
+
* Changes the state of a given AC
|
|
30
|
+
* @param deviceId - The device Id of the AC
|
|
31
|
+
* @param c - The command(stack) to perform on the AC including on/off, temp and so on.
|
|
32
|
+
* @returns In case it failed the Error containing the reason
|
|
36
33
|
*/
|
|
37
|
-
static
|
|
34
|
+
static acSetState(deviceId: string, c: AcSetStateCommand): Error | null;
|
|
38
35
|
/**
|
|
39
36
|
* Turns on/off all AC´s in the home
|
|
40
|
-
* @param
|
|
37
|
+
* @param c - The command(stack) to perform, built by the caller so the origin is recorded
|
|
41
38
|
*/
|
|
42
|
-
static setAllAc(
|
|
39
|
+
static setAllAc(c: AcWriteStateToDeviceCommand): void;
|
|
43
40
|
/**
|
|
44
41
|
* Changes the status of a given Lamp
|
|
45
42
|
* @param deviceId - The device Id of the lamp
|
package/lib/api/api-service.js
CHANGED
|
@@ -72,43 +72,28 @@ class API {
|
|
|
72
72
|
return logging_1.ServerLogService.getLog();
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @
|
|
79
|
-
* @param desiredTemperature - The desired temperature for the AC in Celsius
|
|
80
|
-
* @param forceTime - The time in ms this should not change before automatic change is allowed again
|
|
81
|
-
* @returns True if the AC was found and the state was changed
|
|
75
|
+
* Changes the state of a given AC
|
|
76
|
+
* @param deviceId - The device Id of the AC
|
|
77
|
+
* @param c - The command(stack) to perform on the AC including on/off, temp and so on.
|
|
78
|
+
* @returns In case it failed the Error containing the reason
|
|
82
79
|
*/
|
|
83
|
-
static
|
|
84
|
-
const d = this.getAc(
|
|
80
|
+
static acSetState(deviceId, c) {
|
|
81
|
+
const d = this.getAc(deviceId);
|
|
85
82
|
if (!d) {
|
|
86
|
-
|
|
87
|
-
return false;
|
|
83
|
+
return new Error(`AC Device for id ${deviceId} not found`);
|
|
88
84
|
}
|
|
89
85
|
if (!d.deviceCapabilities.includes(enums_1.DeviceCapability.ac)) {
|
|
90
|
-
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
if (desiredMode === undefined) {
|
|
94
|
-
if (!desiredState) {
|
|
95
|
-
desiredMode = enums_1.AcMode.Off;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
desiredMode = d.heatingAllowed ? enums_1.AcMode.Heating : enums_1.AcMode.Cooling;
|
|
99
|
-
}
|
|
86
|
+
return new Error(`Device for id ${deviceId} is not an ac`);
|
|
100
87
|
}
|
|
101
|
-
d.
|
|
102
|
-
|
|
103
|
-
return true;
|
|
88
|
+
d.setAcState(c);
|
|
89
|
+
return null;
|
|
104
90
|
}
|
|
105
91
|
/**
|
|
106
92
|
* Turns on/off all AC´s in the home
|
|
107
|
-
* @param
|
|
93
|
+
* @param c - The command(stack) to perform, built by the caller so the origin is recorded
|
|
108
94
|
*/
|
|
109
|
-
static setAllAc(
|
|
110
|
-
services_1.DaikinService.setAll(
|
|
111
|
-
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, `API Call to set all AC´s to ${desiredState}`);
|
|
95
|
+
static setAllAc(c) {
|
|
96
|
+
services_1.DaikinService.setAll(c, true);
|
|
112
97
|
}
|
|
113
98
|
/**
|
|
114
99
|
* Changes the status of a given Lamp
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from './baseCommand';
|
|
2
|
+
import { CommandSource, CommandType } from '../enums';
|
|
3
|
+
import { iBaseCommand } from './iBaseCommand';
|
|
4
|
+
export declare class AcPerformAutomaticCheckCommand extends BaseCommand {
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
type: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* Command asking an air-conditioning device to re-evaluate what its state should be.
|
|
9
|
+
*
|
|
10
|
+
* The check itself has several possible triggers - the recurring interval, a lifted
|
|
11
|
+
* automatic block, or an outside caller. Each supplies its own source and reason here, so
|
|
12
|
+
* the resulting device command can be traced back to what asked for the re-evaluation.
|
|
13
|
+
* @param source - The event this check results from
|
|
14
|
+
* @param reason - What triggered the check
|
|
15
|
+
*/
|
|
16
|
+
constructor(source: CommandSource | iBaseCommand, reason?: string);
|
|
17
|
+
get logMessage(): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcPerformAutomaticCheckCommand = void 0;
|
|
4
|
+
const baseCommand_1 = require("./baseCommand");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
class AcPerformAutomaticCheckCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command asking an air-conditioning device to re-evaluate what its state should be.
|
|
9
|
+
*
|
|
10
|
+
* The check itself has several possible triggers - the recurring interval, a lifted
|
|
11
|
+
* automatic block, or an outside caller. Each supplies its own source and reason here, so
|
|
12
|
+
* the resulting device command can be traced back to what asked for the re-evaluation.
|
|
13
|
+
* @param source - The event this check results from
|
|
14
|
+
* @param reason - What triggered the check
|
|
15
|
+
*/
|
|
16
|
+
constructor(source, reason = '') {
|
|
17
|
+
super(source, reason);
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
this.type = enums_1.CommandType.AcPerformAutomaticCheckCommand;
|
|
20
|
+
}
|
|
21
|
+
get logMessage() {
|
|
22
|
+
return `Ac perform automatic check for reason: ${this.reasonTrace}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.AcPerformAutomaticCheckCommand = AcPerformAutomaticCheckCommand;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseCommand } from './baseCommand';
|
|
2
|
+
import { AcMode, CommandSource, CommandType } from '../enums';
|
|
3
|
+
import { BlockAutomaticCommand } from './blockAutomaticCommand';
|
|
4
|
+
import { iBaseCommand } from './iBaseCommand';
|
|
5
|
+
export declare class AcSetStateCommand extends BaseCommand {
|
|
6
|
+
readonly mode: AcMode | undefined;
|
|
7
|
+
readonly desiredTemperature: number | undefined;
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
type: CommandType;
|
|
10
|
+
/**
|
|
11
|
+
* The command to disable automatic actions for a specific duration.
|
|
12
|
+
* Null = no automatic actions will be disabled.
|
|
13
|
+
* Undefined = no automatic actions will be disabled.
|
|
14
|
+
*/
|
|
15
|
+
disableAutomaticCommand: BlockAutomaticCommand | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Command to set the state of an air-conditioning device
|
|
18
|
+
* @param source - The source of the command
|
|
19
|
+
* @param mode - The desired mode; {@link AcMode.Off} turns the device off. Leave undefined
|
|
20
|
+
* to just switch it on and let the device pick the mode, which depends on season and settings
|
|
21
|
+
* it alone knows.
|
|
22
|
+
* @param desiredTemperature - The desired temperature; if unset the device calculates it
|
|
23
|
+
* @param reason - You can provide a reason for clarification
|
|
24
|
+
* @param disableAutomatic - If provided, the device will remain in the desired state for the
|
|
25
|
+
* given disable action. Automatic decisions pass nothing here, so they do not block themselves.
|
|
26
|
+
*/
|
|
27
|
+
constructor(source: CommandSource | iBaseCommand, mode: AcMode | undefined, desiredTemperature?: number | undefined, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
|
|
28
|
+
/**
|
|
29
|
+
* Whether this command results in the device running
|
|
30
|
+
* @returns True unless the desired mode is {@link AcMode.Off}
|
|
31
|
+
*/
|
|
32
|
+
get on(): boolean;
|
|
33
|
+
get logMessage(): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcSetStateCommand = void 0;
|
|
4
|
+
const baseCommand_1 = require("./baseCommand");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
class AcSetStateCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the state of an air-conditioning device
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param mode - The desired mode; {@link AcMode.Off} turns the device off. Leave undefined
|
|
11
|
+
* to just switch it on and let the device pick the mode, which depends on season and settings
|
|
12
|
+
* it alone knows.
|
|
13
|
+
* @param desiredTemperature - The desired temperature; if unset the device calculates it
|
|
14
|
+
* @param reason - You can provide a reason for clarification
|
|
15
|
+
* @param disableAutomatic - If provided, the device will remain in the desired state for the
|
|
16
|
+
* given disable action. Automatic decisions pass nothing here, so they do not block themselves.
|
|
17
|
+
*/
|
|
18
|
+
constructor(source, mode, desiredTemperature = undefined, reason = '', disableAutomatic) {
|
|
19
|
+
super(source, reason);
|
|
20
|
+
this.mode = mode;
|
|
21
|
+
this.desiredTemperature = desiredTemperature;
|
|
22
|
+
/** @inheritDoc */
|
|
23
|
+
this.type = enums_1.CommandType.AcSetStateCommand;
|
|
24
|
+
this.disableAutomaticCommand = disableAutomatic;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether this command results in the device running
|
|
28
|
+
* @returns True unless the desired mode is {@link AcMode.Off}
|
|
29
|
+
*/
|
|
30
|
+
get on() {
|
|
31
|
+
return this.mode !== enums_1.AcMode.Off;
|
|
32
|
+
}
|
|
33
|
+
get logMessage() {
|
|
34
|
+
var _a;
|
|
35
|
+
const temp = this.desiredTemperature !== undefined ? ` at ${this.desiredTemperature}°C` : ' at calculated temperature';
|
|
36
|
+
const mode = this.mode !== undefined ? enums_1.AcMode[this.mode] : 'device default';
|
|
37
|
+
return `Ac setState to mode ${mode}${temp} with disableCommand ${(_a = this.disableAutomaticCommand) === null || _a === void 0 ? void 0 : _a.logMessage} for reason: ${this.reasonTrace}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.AcSetStateCommand = AcSetStateCommand;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseCommand } from './baseCommand';
|
|
2
|
+
import { CommandSource, CommandType } from '../enums';
|
|
3
|
+
import { BlockAutomaticCommand } from './blockAutomaticCommand';
|
|
4
|
+
import { iBaseCommand } from './iBaseCommand';
|
|
5
|
+
export declare class AcWriteStateToDeviceCommand extends BaseCommand {
|
|
6
|
+
readonly on: boolean;
|
|
7
|
+
/** @inheritDoc */
|
|
8
|
+
type: CommandType;
|
|
9
|
+
/**
|
|
10
|
+
* The command to disable automatic actions for a specific duration.
|
|
11
|
+
* A block is not a device setting, so a pure power write can carry one too.
|
|
12
|
+
* Undefined = no automatic actions will be disabled.
|
|
13
|
+
*/
|
|
14
|
+
disableAutomaticCommand: BlockAutomaticCommand | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Command to write the power state of an air-conditioning device to the device itself
|
|
17
|
+
* @param source - The source of the command
|
|
18
|
+
* @param on - The new power state
|
|
19
|
+
* @param reason - You can provide a reason for clarification
|
|
20
|
+
* @param disableAutomatic - If provided, the device will remain in the desired state for the
|
|
21
|
+
* given disable action
|
|
22
|
+
*/
|
|
23
|
+
constructor(source: CommandSource | iBaseCommand, on: boolean, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
|
|
24
|
+
get logMessage(): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcWriteStateToDeviceCommand = void 0;
|
|
4
|
+
const baseCommand_1 = require("./baseCommand");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
const acSetStateCommand_1 = require("./acSetStateCommand");
|
|
7
|
+
class AcWriteStateToDeviceCommand extends baseCommand_1.BaseCommand {
|
|
8
|
+
/**
|
|
9
|
+
* Command to write the power state of an air-conditioning device to the device itself
|
|
10
|
+
* @param source - The source of the command
|
|
11
|
+
* @param on - The new power state
|
|
12
|
+
* @param reason - You can provide a reason for clarification
|
|
13
|
+
* @param disableAutomatic - If provided, the device will remain in the desired state for the
|
|
14
|
+
* given disable action
|
|
15
|
+
*/
|
|
16
|
+
constructor(source, on, reason = '', disableAutomatic) {
|
|
17
|
+
super(source, reason);
|
|
18
|
+
this.on = on;
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
this.type = enums_1.CommandType.AcWriteStateToDeviceCommand;
|
|
21
|
+
this.disableAutomaticCommand = disableAutomatic;
|
|
22
|
+
}
|
|
23
|
+
get logMessage() {
|
|
24
|
+
if (this.source instanceof acSetStateCommand_1.AcSetStateCommand) {
|
|
25
|
+
return `Ac Write StateToDevice original Log-message: ${this.source.logMessage}`;
|
|
26
|
+
}
|
|
27
|
+
return `Ac writeStateToDevice(${this.on}) for reason: ${this.reasonTrace}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.AcWriteStateToDeviceCommand = AcWriteStateToDeviceCommand;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseCommand } from './baseCommand';
|
|
2
|
+
import { CommandSource, CommandType } from '../enums';
|
|
3
|
+
import { iBaseCommand } from './iBaseCommand';
|
|
4
|
+
export declare class ExcessEnergyConsumerSetStateCommand extends BaseCommand {
|
|
5
|
+
readonly on: boolean;
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
type: CommandType;
|
|
8
|
+
/**
|
|
9
|
+
* Command from the energy manager asking a consumer to start or stop.
|
|
10
|
+
*
|
|
11
|
+
* Carries the measurement the decision was based on, so the resulting device command can be
|
|
12
|
+
* traced back to why the manager acted rather than just that it did.
|
|
13
|
+
* @param source - The event this decision results from
|
|
14
|
+
* @param on - Whether the consumer should run
|
|
15
|
+
* @param reason - The energy situation that triggered the decision
|
|
16
|
+
*/
|
|
17
|
+
constructor(source: CommandSource | iBaseCommand, on: boolean, reason?: string);
|
|
18
|
+
get logMessage(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExcessEnergyConsumerSetStateCommand = void 0;
|
|
4
|
+
const baseCommand_1 = require("./baseCommand");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
class ExcessEnergyConsumerSetStateCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command from the energy manager asking a consumer to start or stop.
|
|
9
|
+
*
|
|
10
|
+
* Carries the measurement the decision was based on, so the resulting device command can be
|
|
11
|
+
* traced back to why the manager acted rather than just that it did.
|
|
12
|
+
* @param source - The event this decision results from
|
|
13
|
+
* @param on - Whether the consumer should run
|
|
14
|
+
* @param reason - The energy situation that triggered the decision
|
|
15
|
+
*/
|
|
16
|
+
constructor(source, on, reason = '') {
|
|
17
|
+
super(source, reason);
|
|
18
|
+
this.on = on;
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
this.type = enums_1.CommandType.ExcessEnergyConsumerSetStateCommand;
|
|
21
|
+
}
|
|
22
|
+
get logMessage() {
|
|
23
|
+
return `Excess energy consumer setState to ${this.on} for reason: ${this.reasonTrace}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ExcessEnergyConsumerSetStateCommand = ExcessEnergyConsumerSetStateCommand;
|
package/lib/command/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ export { BlockAutomaticCommand } from './blockAutomaticCommand';
|
|
|
2
2
|
export { BlockAutomaticUntilCommand } from './blockAutomaticUntilCommand';
|
|
3
3
|
export { BlockAutomaticLiftBlockCommand } from './blockAutomaticLiftBlockCommand';
|
|
4
4
|
export { RestoreTargetAutomaticValueCommand } from './restoreTargetAutomaticValueCommand';
|
|
5
|
+
export { AcPerformAutomaticCheckCommand } from './acPerformAutomaticCheckCommand';
|
|
6
|
+
export { ExcessEnergyConsumerSetStateCommand } from './excessEnergyConsumerSetStateCommand';
|
|
7
|
+
export { AcSetStateCommand } from './acSetStateCommand';
|
|
8
|
+
export { AcWriteStateToDeviceCommand } from './acWriteStateToDeviceCommand';
|
|
5
9
|
export { ActuatorSetStateCommand } from './actuatorSetStateCommand';
|
|
6
10
|
export { ActuatorToggleCommand } from './actuatorToggleCommand';
|
|
7
11
|
export { ActuatorWriteStateToDeviceCommand } from './actuatorWriteStateToDeviceCommand';
|
package/lib/command/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WledSetLightCommand = exports.WindowSetRolloByWeatherStatusCommand = exports.WindowSetDesiredPositionCommand = exports.WindowRestoreDesiredPositionCommand = exports.ShutterSunsetDownCommand = exports.ShutterSunriseUpCommand = exports.ShutterSetLevelCommand = exports.RoomSetLightTimeBasedCommand = exports.RoomRestoreShutterPositionCommand = exports.RoomRestoreLightCommand = exports.LightGroupSwitchTimeConditionalCommand = exports.LedSetLightCommand = exports.LampToggleLightCommand = exports.LampSetTimeBasedCommand = exports.LampSetLightCommand = exports.FloorSetAllShuttersCommand = exports.DimmerSetLightCommand = exports.BaseCommand = exports.ActuatorWriteStateToDeviceCommand = exports.ActuatorToggleCommand = exports.ActuatorSetStateCommand = exports.RestoreTargetAutomaticValueCommand = exports.BlockAutomaticLiftBlockCommand = exports.BlockAutomaticUntilCommand = exports.BlockAutomaticCommand = void 0;
|
|
3
|
+
exports.WledSetLightCommand = exports.WindowSetRolloByWeatherStatusCommand = exports.WindowSetDesiredPositionCommand = exports.WindowRestoreDesiredPositionCommand = exports.ShutterSunsetDownCommand = exports.ShutterSunriseUpCommand = exports.ShutterSetLevelCommand = exports.RoomSetLightTimeBasedCommand = exports.RoomRestoreShutterPositionCommand = exports.RoomRestoreLightCommand = exports.LightGroupSwitchTimeConditionalCommand = exports.LedSetLightCommand = exports.LampToggleLightCommand = exports.LampSetTimeBasedCommand = exports.LampSetLightCommand = exports.FloorSetAllShuttersCommand = exports.DimmerSetLightCommand = exports.BaseCommand = exports.ActuatorWriteStateToDeviceCommand = exports.ActuatorToggleCommand = exports.ActuatorSetStateCommand = exports.AcWriteStateToDeviceCommand = exports.AcSetStateCommand = exports.ExcessEnergyConsumerSetStateCommand = exports.AcPerformAutomaticCheckCommand = exports.RestoreTargetAutomaticValueCommand = exports.BlockAutomaticLiftBlockCommand = exports.BlockAutomaticUntilCommand = exports.BlockAutomaticCommand = void 0;
|
|
4
4
|
var blockAutomaticCommand_1 = require("./blockAutomaticCommand");
|
|
5
5
|
Object.defineProperty(exports, "BlockAutomaticCommand", { enumerable: true, get: function () { return blockAutomaticCommand_1.BlockAutomaticCommand; } });
|
|
6
6
|
var blockAutomaticUntilCommand_1 = require("./blockAutomaticUntilCommand");
|
|
@@ -9,6 +9,14 @@ var blockAutomaticLiftBlockCommand_1 = require("./blockAutomaticLiftBlockCommand
|
|
|
9
9
|
Object.defineProperty(exports, "BlockAutomaticLiftBlockCommand", { enumerable: true, get: function () { return blockAutomaticLiftBlockCommand_1.BlockAutomaticLiftBlockCommand; } });
|
|
10
10
|
var restoreTargetAutomaticValueCommand_1 = require("./restoreTargetAutomaticValueCommand");
|
|
11
11
|
Object.defineProperty(exports, "RestoreTargetAutomaticValueCommand", { enumerable: true, get: function () { return restoreTargetAutomaticValueCommand_1.RestoreTargetAutomaticValueCommand; } });
|
|
12
|
+
var acPerformAutomaticCheckCommand_1 = require("./acPerformAutomaticCheckCommand");
|
|
13
|
+
Object.defineProperty(exports, "AcPerformAutomaticCheckCommand", { enumerable: true, get: function () { return acPerformAutomaticCheckCommand_1.AcPerformAutomaticCheckCommand; } });
|
|
14
|
+
var excessEnergyConsumerSetStateCommand_1 = require("./excessEnergyConsumerSetStateCommand");
|
|
15
|
+
Object.defineProperty(exports, "ExcessEnergyConsumerSetStateCommand", { enumerable: true, get: function () { return excessEnergyConsumerSetStateCommand_1.ExcessEnergyConsumerSetStateCommand; } });
|
|
16
|
+
var acSetStateCommand_1 = require("./acSetStateCommand");
|
|
17
|
+
Object.defineProperty(exports, "AcSetStateCommand", { enumerable: true, get: function () { return acSetStateCommand_1.AcSetStateCommand; } });
|
|
18
|
+
var acWriteStateToDeviceCommand_1 = require("./acWriteStateToDeviceCommand");
|
|
19
|
+
Object.defineProperty(exports, "AcWriteStateToDeviceCommand", { enumerable: true, get: function () { return acWriteStateToDeviceCommand_1.AcWriteStateToDeviceCommand; } });
|
|
12
20
|
var actuatorSetStateCommand_1 = require("./actuatorSetStateCommand");
|
|
13
21
|
Object.defineProperty(exports, "ActuatorSetStateCommand", { enumerable: true, get: function () { return actuatorSetStateCommand_1.ActuatorSetStateCommand; } });
|
|
14
22
|
var actuatorToggleCommand_1 = require("./actuatorToggleCommand");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { iHeater, iHeatGroup, iHumidityCollector, iTemperatureCollector } from '../../interfaces';
|
|
2
2
|
import { HeatGroupSettings, TemperatureSettings } from '../../settingsObjects';
|
|
3
|
+
import { CommandSource } from '../../enums';
|
|
3
4
|
import { AcDevice } from '../../services';
|
|
5
|
+
import { iBaseCommand } from '../../command';
|
|
4
6
|
import { BaseGroup } from './base-group';
|
|
5
7
|
export declare class HeatGroup extends BaseGroup implements iHeatGroup {
|
|
6
8
|
/** @inheritDoc */
|
|
@@ -25,11 +27,12 @@ export declare class HeatGroup extends BaseGroup implements iHeatGroup {
|
|
|
25
27
|
initialize(): void;
|
|
26
28
|
/**
|
|
27
29
|
* Sets all ACs to new desired Value
|
|
28
|
-
* TODO: Migrate to new Command System
|
|
29
30
|
* @param newDesiredState - The new desired (on/off) state
|
|
30
|
-
* @param
|
|
31
|
+
* @param source - The event this results from, so the device command can be traced back to it.
|
|
32
|
+
* Whether this counts as a force action is derived from it, which is what the former
|
|
33
|
+
* `force` flag encoded.
|
|
31
34
|
*/
|
|
32
|
-
setAc(newDesiredState: boolean,
|
|
35
|
+
setAc(newDesiredState: boolean, source: CommandSource | iBaseCommand): void;
|
|
33
36
|
deleteAutomaticPoint(name: string): void;
|
|
34
37
|
setAutomaticPoint(setting: TemperatureSettings): void;
|
|
35
38
|
recalcRoomTemperatur(): void;
|
|
@@ -140,20 +140,31 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Sets all ACs to new desired Value
|
|
143
|
-
* TODO: Migrate to new Command System
|
|
144
143
|
* @param newDesiredState - The new desired (on/off) state
|
|
145
|
-
* @param
|
|
144
|
+
* @param source - The event this results from, so the device command can be traced back to it.
|
|
145
|
+
* Whether this counts as a force action is derived from it, which is what the former
|
|
146
|
+
* `force` flag encoded.
|
|
146
147
|
*/
|
|
147
|
-
setAc(newDesiredState,
|
|
148
|
+
setAc(newDesiredState, source) {
|
|
148
149
|
const devs = this.getOwnAcDevices();
|
|
149
150
|
this.log(enums_1.LogLevel.Debug, `set ${devs.length} Ac's to new State: ${newDesiredState}`);
|
|
150
151
|
for (const dev of devs) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
const command = new command_1.AcSetStateCommand(source,
|
|
153
|
+
// Undefined mode means "just switch it on"; the device resolves which mode that is.
|
|
154
|
+
newDesiredState ? undefined : enums_1.AcMode.Off, undefined, 'HeatGroup setAc');
|
|
155
|
+
// As before, only switching off pins the automatic - and the block travels inside the command
|
|
156
|
+
// so setAcState applies it centrally.
|
|
157
|
+
//
|
|
158
|
+
// The duration now comes from the device's own settings, built the way every other device
|
|
159
|
+
// builds its block (see ShutterUtils.setLevel). It used to be a hard-coded hour here, which
|
|
160
|
+
// is exactly what the configured default resolves to - so nothing changes today; what changes
|
|
161
|
+
// is that a single unit can be given a shorter block without touching group code. Building it
|
|
162
|
+
// from the command rather than from `source` also puts the block into the reason chain, so the
|
|
163
|
+
// log says which switch-off set it.
|
|
164
|
+
if (!newDesiredState) {
|
|
165
|
+
command.disableAutomaticCommand = dev.settings.buildBlockAutomaticCommand(command);
|
|
154
166
|
}
|
|
155
|
-
dev.
|
|
156
|
-
dev.blockAutomationHandler.disableAutomatic(new command_1.BlockAutomaticCommand(force ? enums_1.CommandSource.Force : enums_1.CommandSource.Unknown, 60 * 60 * 1000));
|
|
167
|
+
dev.setAcState(command);
|
|
157
168
|
}
|
|
158
169
|
}
|
|
159
170
|
deleteAutomaticPoint(name) {
|
|
@@ -70,6 +70,9 @@ class TasterGroup extends base_group_1.BaseGroup {
|
|
|
70
70
|
}, 'Play Radio');
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
// TODO: Migrate buttons to the new Command System. addCb only yields a boolean, so the
|
|
74
|
+
// press itself is not an action that could be chained - which button and whether it was
|
|
75
|
+
// short or long is therefore lost before it reaches the device.
|
|
73
76
|
if (((_j = settings_service_1.SettingsService.settings.daikin) === null || _j === void 0 ? void 0 : _j.buttonBotRightForAc) === true) {
|
|
74
77
|
const heatGroup = this.getRoom().HeatGroup;
|
|
75
78
|
if (heatGroup !== undefined && heatGroup.getOwnAcDevices().length > 0) {
|
|
@@ -77,13 +80,13 @@ class TasterGroup extends base_group_1.BaseGroup {
|
|
|
77
80
|
if (!pValue) {
|
|
78
81
|
return;
|
|
79
82
|
}
|
|
80
|
-
heatGroup.setAc(true,
|
|
83
|
+
heatGroup.setAc(true, enums_1.CommandSource.Manual);
|
|
81
84
|
}, 'Turn Ac On');
|
|
82
85
|
(_l = t.buttonBotRight) === null || _l === void 0 ? void 0 : _l.addCb(enums_1.ButtonPressType.long, (pValue) => {
|
|
83
86
|
if (!pValue) {
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
86
|
-
heatGroup.setAc(false,
|
|
89
|
+
heatGroup.setAc(false, enums_1.CommandSource.Force);
|
|
87
90
|
}, 'Turn Ac Off');
|
|
88
91
|
}
|
|
89
92
|
}
|
|
@@ -5,6 +5,7 @@ const IoBrokerBaseDevice_1 = require("../IoBrokerBaseDevice");
|
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const models_1 = require("../../models");
|
|
7
7
|
const enums_1 = require("../../enums");
|
|
8
|
+
const command_1 = require("../../command");
|
|
8
9
|
const models_2 = require("../models");
|
|
9
10
|
class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
10
11
|
constructor(info) {
|
|
@@ -166,8 +167,7 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
166
167
|
}
|
|
167
168
|
if (result.newState) {
|
|
168
169
|
this.blockDeviceChangeTime = utils_1.Utils.nowMS() + result.device.energySettings.powerReactionTime;
|
|
169
|
-
result.device.
|
|
170
|
-
result.device.turnOnForExcessEnergy();
|
|
170
|
+
result.device.setExcessEnergyState(new command_1.ExcessEnergyConsumerSetStateCommand(enums_1.CommandSource.Automatic, true, `Energy manager has ${this.excessEnergy}W to spare`));
|
|
171
171
|
this._lastDeviceChange = result;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -179,8 +179,7 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
179
179
|
}
|
|
180
180
|
if (!result.newState) {
|
|
181
181
|
this.blockDeviceChangeTime = utils_1.Utils.nowMS() + result.device.energySettings.powerReactionTime;
|
|
182
|
-
result.device.
|
|
183
|
-
result.device.turnOffDueToMissingEnergy();
|
|
182
|
+
result.device.setExcessEnergyState(new command_1.ExcessEnergyConsumerSetStateCommand(enums_1.CommandSource.Automatic, false, `Energy manager is short of energy at ${this.excessEnergy}W`));
|
|
184
183
|
this._lastDeviceChange = result;
|
|
185
184
|
}
|
|
186
185
|
}
|
|
@@ -62,16 +62,21 @@ class ShutterUtils {
|
|
|
62
62
|
}
|
|
63
63
|
device.logCommand(c);
|
|
64
64
|
if (device.window !== undefined) {
|
|
65
|
+
// Only a manual command deserves an alert, because only then is someone waiting for a shutter
|
|
66
|
+
// that will not move. The automatic run meets an open window every evening, and an Alert is
|
|
67
|
+
// what reaches Telegram - a nightly push for an expected skip. Info keeps the decision
|
|
68
|
+
// reconstructable without waking anybody.
|
|
69
|
+
const warningLevel = c.isManual ? enums_1.LogLevel.Alert : enums_1.LogLevel.Info;
|
|
65
70
|
if (device.window.griffeInPosition(enums_1.WindowPosition.open) > 0 && pPosition < 100) {
|
|
66
71
|
if (!c.skipOpenWarning) {
|
|
67
|
-
device.log(
|
|
72
|
+
device.log(warningLevel, 'Not closing the shutter, as the window is open!');
|
|
68
73
|
}
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
if (device.window.griffeInPosition(enums_1.WindowPosition.tilted) > 0 && pPosition < 50) {
|
|
72
77
|
pPosition = 50;
|
|
73
78
|
if (!c.skipOpenWarning) {
|
|
74
|
-
device.log(
|
|
79
|
+
device.log(warningLevel, 'Not closing the shutter, as the window is half open!');
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DeviceCapability, DeviceType, TvDeviceType } from '../../enums';
|
|
2
|
+
import { ExcessEnergyConsumerSetStateCommand } from '../../command';
|
|
2
3
|
import { iTvDevice } from '../../interfaces';
|
|
3
4
|
import { TvSettings } from '../../settingsObjects';
|
|
4
5
|
import { RoomBaseDevice } from '../RoomBaseDevice';
|
|
@@ -19,7 +20,7 @@ export declare abstract class TvDevice extends RoomBaseDevice implements iTvDevi
|
|
|
19
20
|
abstract volumeUp(): void;
|
|
20
21
|
abstract turnOn(): void;
|
|
21
22
|
abstract turnOff(): void;
|
|
22
|
-
|
|
23
|
+
setExcessEnergyState(c: ExcessEnergyConsumerSetStateCommand): void;
|
|
23
24
|
automaticCheck(): void;
|
|
24
25
|
toJSON(): Partial<TvDevice>;
|
|
25
26
|
}
|
|
@@ -33,7 +33,11 @@ class TvDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
33
33
|
var _a;
|
|
34
34
|
return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `ac-${this.info.room}-${this.info.customName}`;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
setExcessEnergyState(c) {
|
|
37
|
+
// A TV is never switched on to burn surplus energy, only off when it runs short.
|
|
38
|
+
if (c.on) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
this.turnOff();
|
|
38
42
|
}
|
|
39
43
|
automaticCheck() {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VictronDevice = void 0;
|
|
4
4
|
const enums_1 = require("../../enums");
|
|
5
|
+
const command_1 = require("../../command");
|
|
5
6
|
const settingsObjects_1 = require("../../settingsObjects");
|
|
6
7
|
const sharedFunctions_1 = require("../sharedFunctions");
|
|
7
8
|
const DeviceInfo_1 = require("../DeviceInfo");
|
|
@@ -212,8 +213,7 @@ class VictronDevice extends BaseDevice_1.BaseDevice {
|
|
|
212
213
|
}
|
|
213
214
|
if (result.newState) {
|
|
214
215
|
this.blockDeviceChangeTime = utils_1.Utils.nowMS() + result.device.energySettings.powerReactionTime;
|
|
215
|
-
result.device.
|
|
216
|
-
result.device.turnOnForExcessEnergy();
|
|
216
|
+
result.device.setExcessEnergyState(new command_1.ExcessEnergyConsumerSetStateCommand(enums_1.CommandSource.Automatic, true, `Energy manager has ${this.excessEnergy}W to spare`));
|
|
217
217
|
this._lastDeviceChange = result;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -225,8 +225,7 @@ class VictronDevice extends BaseDevice_1.BaseDevice {
|
|
|
225
225
|
}
|
|
226
226
|
if (!result.newState) {
|
|
227
227
|
this.blockDeviceChangeTime = utils_1.Utils.nowMS() + result.device.energySettings.powerReactionTime;
|
|
228
|
-
result.device.
|
|
229
|
-
result.device.turnOffDueToMissingEnergy();
|
|
228
|
+
result.device.setExcessEnergyState(new command_1.ExcessEnergyConsumerSetStateCommand(enums_1.CommandSource.Automatic, false, `Energy manager is short of energy at ${this.excessEnergy}W`));
|
|
230
229
|
this._lastDeviceChange = result;
|
|
231
230
|
}
|
|
232
231
|
}
|
|
@@ -3,6 +3,7 @@ import { ZigbeeActuator } from './BaseDevices';
|
|
|
3
3
|
import { iExcessEnergyConsumer } from '../../interfaces';
|
|
4
4
|
import { iLoadMeter } from '../../interfaces/baseDevices/iLoadMeter';
|
|
5
5
|
import { ActuatorSettings, ExcessEnergyConsumerSettings } from '../../settingsObjects';
|
|
6
|
+
import { ExcessEnergyConsumerSetStateCommand } from '../../command';
|
|
6
7
|
export declare class ZigbeeBlitzShp extends ZigbeeActuator implements iExcessEnergyConsumer, iLoadMeter {
|
|
7
8
|
/** @inheritDoc */
|
|
8
9
|
settings: ActuatorSettings;
|
|
@@ -29,9 +30,7 @@ export declare class ZigbeeBlitzShp extends ZigbeeActuator implements iExcessEne
|
|
|
29
30
|
/** @inheritDoc */
|
|
30
31
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
31
32
|
/** @inheritDoc */
|
|
32
|
-
|
|
33
|
-
/** @inheritDoc */
|
|
34
|
-
turnOffDueToMissingEnergy(): void;
|
|
33
|
+
setExcessEnergyState(c: ExcessEnergyConsumerSetStateCommand): void;
|
|
35
34
|
/** @inheritDoc */
|
|
36
35
|
wasActivatedByExcessEnergy(): boolean;
|
|
37
36
|
}
|
|
@@ -75,13 +75,11 @@ class ZigbeeBlitzShp extends BaseDevices_1.ZigbeeActuator {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
/** @inheritDoc */
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
turnOffDueToMissingEnergy() {
|
|
84
|
-
this.setActuator(new command_1.ActuatorSetStateCommand(enums_1.CommandSource.Automatic, false, 'Turn off due to missing energy'));
|
|
78
|
+
setExcessEnergyState(c) {
|
|
79
|
+
if (c.on) {
|
|
80
|
+
this._activatedByExcessEnergy = true;
|
|
81
|
+
}
|
|
82
|
+
this.setActuator(new command_1.ActuatorSetStateCommand(c, c.on, c.on ? 'Turn on for excess energy' : 'Turn off due to missing energy'));
|
|
85
83
|
}
|
|
86
84
|
/** @inheritDoc */
|
|
87
85
|
wasActivatedByExcessEnergy() {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare enum CommandType {
|
|
2
|
+
AcPerformAutomaticCheckCommand = "AcPerformAutomaticCheckCommand",
|
|
3
|
+
ExcessEnergyConsumerSetStateCommand = "ExcessEnergyConsumerSetStateCommand",
|
|
4
|
+
AcSetStateCommand = "AcSetStateCommand",
|
|
5
|
+
AcWriteStateToDeviceCommand = "AcWriteStateToDeviceCommand",
|
|
2
6
|
ActuatorChangeAction = "ActuatorChangeAction",
|
|
3
7
|
BatteryManagerLevelChangeAction = "BatteryManagerLevelChangeAction",
|
|
4
8
|
BlockAutomaticLiftBlockCommand = "BlockAutomaticLiftBlockCommand",
|
package/lib/enums/commandType.js
CHANGED
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CommandType = void 0;
|
|
4
4
|
var CommandType;
|
|
5
5
|
(function (CommandType) {
|
|
6
|
+
CommandType["AcPerformAutomaticCheckCommand"] = "AcPerformAutomaticCheckCommand";
|
|
7
|
+
CommandType["ExcessEnergyConsumerSetStateCommand"] = "ExcessEnergyConsumerSetStateCommand";
|
|
8
|
+
CommandType["AcSetStateCommand"] = "AcSetStateCommand";
|
|
9
|
+
CommandType["AcWriteStateToDeviceCommand"] = "AcWriteStateToDeviceCommand";
|
|
6
10
|
CommandType["ActuatorChangeAction"] = "ActuatorChangeAction";
|
|
7
11
|
CommandType["BatteryManagerLevelChangeAction"] = "BatteryManagerLevelChangeAction";
|
|
8
12
|
CommandType["BlockAutomaticLiftBlockCommand"] = "BlockAutomaticLiftBlockCommand";
|