hoffmation-base 3.0.0-alpha.2 → 3.0.0-alpha.21
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/liquid-pid.d.ts +2 -5
- package/lib/liquid-pid.js +2 -5
- package/lib/models/command/ShutterSetLevelCommand.d.ts +7 -0
- package/lib/models/command/ShutterSetLevelCommand.js +8 -1
- package/lib/models/command/WindowRestoreDesiredPositionCommand.d.ts +5 -0
- package/lib/models/command/WindowRestoreDesiredPositionCommand.js +5 -0
- package/lib/models/command/WindowSetDesiredPositionCommand.d.ts +6 -0
- package/lib/models/command/WindowSetDesiredPositionCommand.js +6 -0
- package/lib/models/command/WindowSetRolloByWeatherStatusCommand.d.ts +5 -0
- package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +5 -0
- package/lib/models/command/actuatorSetStateCommand.d.ts +7 -0
- package/lib/models/command/actuatorSetStateCommand.js +9 -2
- package/lib/models/command/actuatorToggleCommand.d.ts +5 -0
- package/lib/models/command/actuatorToggleCommand.js +6 -1
- package/lib/models/command/actuatorWriteStateToDeviceCommand.d.ts +7 -1
- package/lib/models/command/actuatorWriteStateToDeviceCommand.js +12 -2
- package/lib/models/command/baseCommand.d.ts +14 -1
- package/lib/models/command/baseCommand.js +40 -6
- package/lib/models/command/blockAutomaticCommand.d.ts +17 -0
- package/lib/models/command/blockAutomaticCommand.js +22 -0
- package/lib/models/command/blockAutomaticLiftBlockCommand.d.ts +12 -0
- package/lib/models/command/blockAutomaticLiftBlockCommand.js +17 -0
- package/lib/models/command/blockAutomaticUntilCommand.d.ts +17 -0
- package/lib/models/command/blockAutomaticUntilCommand.js +22 -0
- package/lib/models/command/commandSource.d.ts +19 -0
- package/lib/models/command/commandSource.js +20 -0
- package/lib/models/command/commandType.d.ts +3 -0
- package/lib/models/command/commandType.js +3 -0
- package/lib/models/command/dimmerSetLightCommand.d.ts +7 -6
- package/lib/models/command/dimmerSetLightCommand.js +13 -11
- package/lib/models/command/floorSetAllShuttersCommand.d.ts +4 -4
- package/lib/models/command/floorSetAllShuttersCommand.js +4 -4
- package/lib/models/command/index.d.ts +3 -0
- package/lib/models/command/index.js +7 -1
- package/lib/models/command/lampSetLightCommand.d.ts +7 -0
- package/lib/models/command/lampSetLightCommand.js +8 -1
- package/lib/models/command/lampSetTimeBasedCommand.d.ts +4 -4
- package/lib/models/command/lampSetTimeBasedCommand.js +5 -5
- package/lib/models/command/lampToggleLightCommand.d.ts +5 -5
- package/lib/models/command/lampToggleLightCommand.js +6 -6
- package/lib/models/command/ledSetLightCommand.d.ts +15 -9
- package/lib/models/command/ledSetLightCommand.js +16 -10
- package/lib/models/command/lightGroupSwitchTimeConditionalCommand.d.ts +6 -0
- package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +6 -0
- package/lib/models/command/restoreTargetAutomaticValueCommand.d.ts +5 -0
- package/lib/models/command/restoreTargetAutomaticValueCommand.js +6 -1
- package/lib/models/command/roomRestoreLightCommand.d.ts +5 -0
- package/lib/models/command/roomRestoreLightCommand.js +5 -0
- package/lib/models/command/roomRestoreShutterPositionCommand.d.ts +6 -0
- package/lib/models/command/roomRestoreShutterPositionCommand.js +6 -0
- package/lib/models/command/roomSetLightTimeBasedCommand.d.ts +3 -3
- package/lib/models/command/roomSetLightTimeBasedCommand.js +3 -3
- package/lib/models/command/shutterSunriseUpCommand.d.ts +5 -0
- package/lib/models/command/shutterSunriseUpCommand.js +5 -0
- package/lib/models/command/shutterSunsetDownCommand.d.ts +5 -0
- package/lib/models/command/shutterSunsetDownCommand.js +5 -0
- package/lib/models/command/wledSetLightCommand.d.ts +11 -0
- package/lib/models/command/wledSetLightCommand.js +13 -0
- package/lib/models/connectionCallbacks.d.ts +4 -4
- package/lib/models/deviceConfig.d.ts +2 -2
- package/lib/models/deviceSettings/acSettings.d.ts +6 -5
- package/lib/models/deviceSettings/acSettings.js +10 -8
- package/lib/models/deviceSettings/actuatorSettings.d.ts +13 -4
- package/lib/models/deviceSettings/actuatorSettings.js +19 -9
- package/lib/models/deviceSettings/garageDoorOpenerSettings.d.ts +0 -1
- package/lib/models/deviceSettings/garageDoorOpenerSettings.js +0 -1
- package/lib/models/deviceSettings/heaterSettings.d.ts +0 -6
- package/lib/models/deviceSettings/heaterSettings.js +0 -6
- package/lib/models/deviceSettings/ledSettings.js +10 -18
- package/lib/models/deviceSettings/motionSensorSettings.d.ts +0 -1
- package/lib/models/deviceSettings/motionSensorSettings.js +0 -1
- package/lib/models/deviceSettings/shutterSettings.d.ts +0 -3
- package/lib/models/deviceSettings/shutterSettings.js +0 -3
- package/lib/models/deviceSettings/wledSettings.js +5 -13
- package/lib/models/groupSettings/heatGroupSettings.d.ts +3 -1
- package/lib/models/groupSettings/heatGroupSettings.js +3 -1
- package/lib/models/iIdHolder.d.ts +6 -0
- package/lib/models/objectSettings.d.ts +2 -2
- package/lib/models/objectSettings.js +2 -2
- package/lib/models/rooms/RoomBase.d.ts +2 -1
- package/lib/models/rooms/RoomBase.js +4 -3
- package/lib/models/rooms/iRoomBase.d.ts +17 -0
- package/lib/models/rooms/iRoomImportEnforcer.d.ts +4 -0
- package/lib/server/devices/Griffe.js +0 -1
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +11 -16
- package/lib/server/devices/IoBrokerBaseDevice.js +21 -17
- package/lib/server/devices/IoBrokerDeviceInfo.d.ts +2 -2
- package/lib/server/devices/IoBrokerDeviceInfo.js +6 -4
- package/lib/server/devices/baseDeviceInterfaces/iAcDevice.d.ts +30 -3
- package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +16 -0
- package/lib/server/devices/baseDeviceInterfaces/iBaseDevice.d.ts +25 -0
- package/lib/server/devices/baseDeviceInterfaces/iBatteryDevice.d.ts +10 -1
- package/lib/server/devices/baseDeviceInterfaces/iBluetoothDetector.d.ts +5 -5
- package/lib/server/devices/baseDeviceInterfaces/iButtonSwitch.d.ts +13 -0
- package/lib/server/devices/baseDeviceInterfaces/iCameraDevice.d.ts +10 -0
- package/lib/server/devices/baseDeviceInterfaces/iDimmableLamp.d.ts +9 -2
- package/lib/server/devices/baseDeviceInterfaces/iEnergyManager.d.ts +13 -2
- package/lib/server/devices/baseDeviceInterfaces/iExcessEnergyConsumer.d.ts +16 -2
- package/lib/server/devices/baseDeviceInterfaces/iGarageDoorOpener.d.ts +10 -0
- package/lib/server/devices/baseDeviceInterfaces/iHandleSensor.d.ts +12 -0
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +12 -2
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +7 -0
- package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +4 -0
- package/lib/server/devices/baseDeviceInterfaces/iLedRgbCct.d.ts +5 -0
- package/lib/server/devices/baseDeviceInterfaces/iMotionSensor.d.ts +7 -1
- package/lib/server/devices/baseDeviceInterfaces/iScene.d.ts +7 -0
- package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +7 -0
- package/lib/server/devices/baseDeviceInterfaces/iSmokeDetectorDevice.d.ts +7 -0
- package/lib/server/devices/baseDeviceInterfaces/iSpeaker.d.ts +25 -0
- package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +11 -0
- package/lib/server/devices/baseDeviceInterfaces/iTemporaryDisableAutomatic.d.ts +7 -0
- package/lib/server/devices/baseDeviceInterfaces/iTvDevice.d.ts +12 -0
- package/lib/server/devices/baseDeviceInterfaces/iVibrationSensor.d.ts +0 -1
- package/lib/server/devices/blueIris/cameraDevice.d.ts +2 -3
- package/lib/server/devices/blueIris/cameraDevice.js +2 -3
- package/lib/server/devices/dachs/interfaces/KeyListEntity.d.ts +0 -8
- package/lib/server/devices/dachs/interfaces/KeyListEntity.js +0 -8
- package/lib/server/devices/dachs/lib/dachsHttpClient.d.ts +1 -1
- package/lib/server/devices/groups/Window.d.ts +1 -0
- package/lib/server/devices/groups/Window.js +1 -0
- package/lib/server/devices/groups/heatGroup.d.ts +7 -6
- package/lib/server/devices/groups/heatGroup.js +8 -9
- package/lib/server/devices/groups/lightGroup.d.ts +2 -2
- package/lib/server/devices/groups/lightGroup.js +11 -10
- package/lib/server/devices/groups/presenceGroup.d.ts +0 -1
- package/lib/server/devices/groups/presenceGroup.js +0 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +0 -6
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +1 -2
- package/lib/server/devices/hmIPDevices/hmIpRoll.js +2 -2
- package/lib/server/devices/iDeviceUpdater.d.ts +11 -0
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +1 -1
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +1 -1
- package/lib/server/devices/sharedFunctions/lampUtils.d.ts +1 -0
- package/lib/server/devices/sharedFunctions/lampUtils.js +32 -15
- package/lib/server/devices/wledDevice.d.ts +1 -0
- package/lib/server/devices/wledDevice.js +13 -8
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +0 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.js +9 -18
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +8 -8
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.d.ts +2 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.js +6 -4
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +1 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +1 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +3 -3
- package/lib/server/devices/zigbee/BaseDevices/zigbeeSwitch.d.ts +1 -1
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +1 -1
- package/lib/server/devices/zigbee/zigbeeEuroHeater.d.ts +2 -3
- package/lib/server/devices/zigbee/zigbeeEuroHeater.js +2 -3
- package/lib/server/ioBroker/connection.d.ts +20 -20
- package/lib/server/ioBroker/connection.js +29 -21
- package/lib/server/ioBroker/socketIOConnectOptions.d.ts +2 -2
- package/lib/server/ioBroker/socketIOVisCommand.d.ts +5 -1
- package/lib/server/services/Sonos/polly-service.js +1 -2
- package/lib/server/services/Translation/res.d.ts +34 -19
- package/lib/server/services/Translation/res.js +34 -19
- package/lib/server/services/ac/ac-device.d.ts +0 -5
- package/lib/server/services/ac/ac-device.js +17 -18
- package/lib/server/services/ac/daikin-service.js +2 -1
- package/lib/server/services/ac/own-daikin-device.js +12 -4
- package/lib/server/services/api/api-service.d.ts +117 -52
- package/lib/server/services/api/api-service.js +160 -68
- package/lib/server/services/blockAutomaticHandler.d.ts +6 -8
- package/lib/server/services/blockAutomaticHandler.js +15 -13
- package/lib/server/services/dbo/iPersist.d.ts +96 -0
- package/lib/server/services/govee/own-govee-device.js +4 -7
- package/lib/server/services/https-service.d.ts +3 -2
- package/lib/server/services/https-service.js +3 -2
- package/lib/server/services/log-service/log-service.d.ts +2 -2
- package/lib/server/services/log-service/log-service.js +2 -2
- package/lib/server/services/news-service.d.ts +5 -6
- package/lib/server/services/news-service.js +5 -6
- package/lib/server/services/room-service/room-service.d.ts +3 -2
- package/lib/server/services/room-service/room-service.js +4 -3
- package/lib/server/services/settings-service.d.ts +3 -2
- package/lib/server/services/settings-service.js +3 -2
- package/lib/server/services/utils/iDisposeable.d.ts +3 -0
- package/lib/server/services/victron/victron-device.d.ts +2 -2
- package/lib/server/services/victron/victron-device.js +2 -2
- package/lib/server/services/weather/weather-current.d.ts +0 -2
- package/lib/server/services/weather/weather-service.d.ts +4 -1
- package/lib/server/services/weather/weather-service.js +4 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
package/lib/liquid-pid.d.ts
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* I'm a NodeJS guy not a scientist, so please be a careful!!!
|
|
6
6
|
* FYI: http://en.wikipedia.org/wiki/PID_controller
|
|
7
|
-
*
|
|
8
|
-
* @module controller
|
|
9
|
-
*
|
|
10
7
|
* @author https://github.com/hekike/liquid-pid
|
|
11
|
-
*
|
|
12
|
-
|
|
8
|
+
* licence: MIT
|
|
9
|
+
*/
|
|
13
10
|
export declare class PIDController {
|
|
14
11
|
private _Tref;
|
|
15
12
|
private readonly _Pmax;
|
package/lib/liquid-pid.js
CHANGED
|
@@ -7,12 +7,9 @@ exports.PIDController = void 0;
|
|
|
7
7
|
*
|
|
8
8
|
* I'm a NodeJS guy not a scientist, so please be a careful!!!
|
|
9
9
|
* FYI: http://en.wikipedia.org/wiki/PID_controller
|
|
10
|
-
*
|
|
11
|
-
* @module controller
|
|
12
|
-
*
|
|
13
10
|
* @author https://github.com/hekike/liquid-pid
|
|
14
|
-
*
|
|
15
|
-
|
|
11
|
+
* licence: MIT
|
|
12
|
+
*/
|
|
16
13
|
class PIDController {
|
|
17
14
|
constructor(options) {
|
|
18
15
|
var _a, _b, _c, _d, _f, _g;
|
|
@@ -5,6 +5,13 @@ export declare class ShutterSetLevelCommand extends BaseCommand {
|
|
|
5
5
|
readonly level: number;
|
|
6
6
|
readonly skipOpenWarning: boolean;
|
|
7
7
|
_commandType: CommandType;
|
|
8
|
+
/**
|
|
9
|
+
* Command to set the level of a shutter
|
|
10
|
+
* @param source - The source of the command
|
|
11
|
+
* @param level - The level to set the shutter to (0: close, 100: completely open)
|
|
12
|
+
* @param reason - You can provide a reason for clarification
|
|
13
|
+
* @param skipOpenWarning - Whether to skip the warning of window being open
|
|
14
|
+
*/
|
|
8
15
|
constructor(source: CommandSource | BaseCommand, level: number, reason?: string, skipOpenWarning?: boolean);
|
|
9
16
|
get logMessage(): string;
|
|
10
17
|
}
|
|
@@ -4,6 +4,13 @@ exports.ShutterSetLevelCommand = void 0;
|
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
6
|
class ShutterSetLevelCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the level of a shutter
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param level - The level to set the shutter to (0: close, 100: completely open)
|
|
11
|
+
* @param reason - You can provide a reason for clarification
|
|
12
|
+
* @param skipOpenWarning - Whether to skip the warning of window being open
|
|
13
|
+
*/
|
|
7
14
|
constructor(source, level, reason = '', skipOpenWarning = false) {
|
|
8
15
|
super(source, reason);
|
|
9
16
|
this.level = level;
|
|
@@ -11,7 +18,7 @@ class ShutterSetLevelCommand extends baseCommand_1.BaseCommand {
|
|
|
11
18
|
this._commandType = commandType_1.CommandType.ShutterSetLevelCommand;
|
|
12
19
|
}
|
|
13
20
|
get logMessage() {
|
|
14
|
-
return `Shutter setLevel to ${this.level}
|
|
21
|
+
return `Shutter setLevel to ${this.level} for reason: ${this.reasonTrace}`;
|
|
15
22
|
}
|
|
16
23
|
}
|
|
17
24
|
exports.ShutterSetLevelCommand = ShutterSetLevelCommand;
|
|
@@ -3,5 +3,10 @@ import { CommandSource } from './commandSource';
|
|
|
3
3
|
import { CommandType } from './commandType';
|
|
4
4
|
export declare class WindowRestoreDesiredPositionCommand extends BaseCommand {
|
|
5
5
|
_commandType: CommandType;
|
|
6
|
+
/**
|
|
7
|
+
* Command to restore the desired position of the shutter of a window
|
|
8
|
+
* @param source - The source of the command
|
|
9
|
+
* @param reason - You can provide a reason for clarification
|
|
10
|
+
*/
|
|
6
11
|
constructor(source: CommandSource | BaseCommand, reason?: string);
|
|
7
12
|
}
|
|
@@ -4,6 +4,11 @@ exports.WindowRestoreDesiredPositionCommand = void 0;
|
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
6
|
class WindowRestoreDesiredPositionCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to restore the desired position of the shutter of a window
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param reason - You can provide a reason for clarification
|
|
11
|
+
*/
|
|
7
12
|
constructor(source, reason = '') {
|
|
8
13
|
super(source, reason);
|
|
9
14
|
this._commandType = commandType_1.CommandType.WindowRestoreDesiredPositionCommand;
|
|
@@ -4,5 +4,11 @@ import { CommandType } from './commandType';
|
|
|
4
4
|
export declare class WindowSetDesiredPositionCommand extends BaseCommand {
|
|
5
5
|
readonly position: number;
|
|
6
6
|
_commandType: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the desired position of the shutter of a window
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param position - The desired position of the shutter (0 closed, 100 open)
|
|
11
|
+
* @param reason - You can provide a reason for clarification
|
|
12
|
+
*/
|
|
7
13
|
constructor(source: CommandSource | BaseCommand, position: number, reason?: string);
|
|
8
14
|
}
|
|
@@ -4,6 +4,12 @@ exports.WindowSetDesiredPositionCommand = void 0;
|
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
6
|
class WindowSetDesiredPositionCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the desired position of the shutter of a window
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param position - The desired position of the shutter (0 closed, 100 open)
|
|
11
|
+
* @param reason - You can provide a reason for clarification
|
|
12
|
+
*/
|
|
7
13
|
constructor(source, position, reason = '') {
|
|
8
14
|
super(source, reason);
|
|
9
15
|
this.position = position;
|
|
@@ -3,5 +3,10 @@ import { CommandSource } from './commandSource';
|
|
|
3
3
|
import { CommandType } from './commandType';
|
|
4
4
|
export declare class WindowSetRolloByWeatherStatusCommand extends BaseCommand {
|
|
5
5
|
_commandType: CommandType;
|
|
6
|
+
/**
|
|
7
|
+
* Command to set the desired position of the shutter of a window based on the weather status
|
|
8
|
+
* @param source - The source of the command
|
|
9
|
+
* @param reason - You can provide a reason for clarification
|
|
10
|
+
*/
|
|
6
11
|
constructor(source: CommandSource | BaseCommand, reason?: string);
|
|
7
12
|
}
|
|
@@ -4,6 +4,11 @@ exports.WindowSetRolloByWeatherStatusCommand = void 0;
|
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
6
|
class WindowSetRolloByWeatherStatusCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the desired position of the shutter of a window based on the weather status
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param reason - You can provide a reason for clarification
|
|
11
|
+
*/
|
|
7
12
|
constructor(source, reason = '') {
|
|
8
13
|
super(source, reason);
|
|
9
14
|
this._commandType = commandType_1.CommandType.WindowSetRolloByWeatherStatusCommand;
|
|
@@ -7,6 +7,13 @@ export declare class ActuatorSetStateCommand extends BaseCommand {
|
|
|
7
7
|
readonly on: boolean;
|
|
8
8
|
timeout: number;
|
|
9
9
|
_commandType: CommandType;
|
|
10
|
+
/**
|
|
11
|
+
* Command to set the state of an actuator
|
|
12
|
+
* @param source - The source of the command
|
|
13
|
+
* @param on - The new state of the actuator
|
|
14
|
+
* @param reason - You can provide a reason for clarification
|
|
15
|
+
* @param timeout - If provided, the device automatic will be turned off for the given time in ms
|
|
16
|
+
*/
|
|
10
17
|
constructor(source: CommandSource | BaseCommand, on: boolean, reason?: string, timeout?: number);
|
|
11
18
|
get logMessage(): string;
|
|
12
19
|
static byActuatorAndToggleCommand(device: iActuator, c: ActuatorToggleCommand): ActuatorSetStateCommand;
|
|
@@ -4,14 +4,21 @@ exports.ActuatorSetStateCommand = void 0;
|
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
6
|
class ActuatorSetStateCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to set the state of an actuator
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param on - The new state of the actuator
|
|
11
|
+
* @param reason - You can provide a reason for clarification
|
|
12
|
+
* @param timeout - If provided, the device automatic will be turned off for the given time in ms
|
|
13
|
+
*/
|
|
7
14
|
constructor(source, on, reason = '', timeout = -1) {
|
|
8
15
|
super(source, reason);
|
|
9
16
|
this.on = on;
|
|
10
17
|
this.timeout = timeout;
|
|
11
|
-
this._commandType = commandType_1.CommandType.
|
|
18
|
+
this._commandType = commandType_1.CommandType.ActuatorSetStateCommand;
|
|
12
19
|
}
|
|
13
20
|
get logMessage() {
|
|
14
|
-
return `Actuator setState to ${this.on}
|
|
21
|
+
return `Actuator setState to ${this.on} with timeout ${this.timeout} for reason: ${this.reasonTrace}`;
|
|
15
22
|
}
|
|
16
23
|
static byActuatorAndToggleCommand(device, c) {
|
|
17
24
|
const newVal = device.queuedValue !== null ? !device.queuedValue : !device.actuatorOn;
|
|
@@ -3,6 +3,11 @@ import { BaseCommand } from './baseCommand';
|
|
|
3
3
|
import { CommandSource } from './commandSource';
|
|
4
4
|
export declare class ActuatorToggleCommand extends BaseCommand {
|
|
5
5
|
_commandType: CommandType;
|
|
6
|
+
/**
|
|
7
|
+
* Command to toggle the state of an actuator
|
|
8
|
+
* @param source - The source of the command
|
|
9
|
+
* @param reason - You can provide a reason for clarification
|
|
10
|
+
*/
|
|
6
11
|
constructor(source: CommandSource | BaseCommand, reason?: string);
|
|
7
12
|
get logMessage(): string;
|
|
8
13
|
}
|
|
@@ -4,12 +4,17 @@ exports.ActuatorToggleCommand = void 0;
|
|
|
4
4
|
const commandType_1 = require("./commandType");
|
|
5
5
|
const baseCommand_1 = require("./baseCommand");
|
|
6
6
|
class ActuatorToggleCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to toggle the state of an actuator
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param reason - You can provide a reason for clarification
|
|
11
|
+
*/
|
|
7
12
|
constructor(source, reason = '') {
|
|
8
13
|
super(source, reason);
|
|
9
14
|
this._commandType = commandType_1.CommandType.ActuatorToggleCommand;
|
|
10
15
|
}
|
|
11
16
|
get logMessage() {
|
|
12
|
-
return `Actuator toggle
|
|
17
|
+
return `Actuator toggle for reason: ${this.reasonTrace}`;
|
|
13
18
|
}
|
|
14
19
|
}
|
|
15
20
|
exports.ActuatorToggleCommand = ActuatorToggleCommand;
|
|
@@ -4,6 +4,12 @@ import { CommandSource } from './commandSource';
|
|
|
4
4
|
export declare class ActuatorWriteStateToDeviceCommand extends BaseCommand {
|
|
5
5
|
readonly stateValue: boolean;
|
|
6
6
|
_commandType: CommandType;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Command to write the state of an actuator to the device
|
|
9
|
+
* @param source - The source of the command
|
|
10
|
+
* @param stateValue - The new state of the actuator
|
|
11
|
+
* @param reason - You can provide a reason for clarification
|
|
12
|
+
*/
|
|
13
|
+
constructor(source: CommandSource | BaseCommand, stateValue: boolean, reason?: string);
|
|
8
14
|
get logMessage(): string;
|
|
9
15
|
}
|
|
@@ -3,14 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ActuatorWriteStateToDeviceCommand = void 0;
|
|
4
4
|
const baseCommand_1 = require("./baseCommand");
|
|
5
5
|
const commandType_1 = require("./commandType");
|
|
6
|
+
const actuatorSetStateCommand_1 = require("./actuatorSetStateCommand");
|
|
6
7
|
class ActuatorWriteStateToDeviceCommand extends baseCommand_1.BaseCommand {
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Command to write the state of an actuator to the device
|
|
10
|
+
* @param source - The source of the command
|
|
11
|
+
* @param stateValue - The new state of the actuator
|
|
12
|
+
* @param reason - You can provide a reason for clarification
|
|
13
|
+
*/
|
|
14
|
+
constructor(source, stateValue, reason = '') {
|
|
8
15
|
super(source, reason);
|
|
9
16
|
this.stateValue = stateValue;
|
|
10
17
|
this._commandType = commandType_1.CommandType.ActuatorWriteStateToDeviceCommand;
|
|
11
18
|
}
|
|
12
19
|
get logMessage() {
|
|
13
|
-
|
|
20
|
+
if (this.source instanceof actuatorSetStateCommand_1.ActuatorSetStateCommand) {
|
|
21
|
+
return `Actuator Write StateToDevice original Log-message: ${this.source.logMessage}`;
|
|
22
|
+
}
|
|
23
|
+
return `Actuator writeStateToDevice(${this.stateValue}) for reason: ${this.reasonTrace}`;
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
exports.ActuatorWriteStateToDeviceCommand = ActuatorWriteStateToDeviceCommand;
|
|
@@ -5,8 +5,21 @@ export declare abstract class BaseCommand {
|
|
|
5
5
|
readonly reason: string;
|
|
6
6
|
readonly timestamp: Date;
|
|
7
7
|
abstract _commandType: CommandType;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* If set, this will be used in regards to checking if this is a force/manual/automatic action.
|
|
10
|
+
* @type {CommandSource | undefined} The source of the command
|
|
11
|
+
*/
|
|
12
|
+
overrideCommandSource: CommandSource | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Base class for all commands
|
|
15
|
+
* @param source - The source of the command
|
|
16
|
+
* @param reason - You can provide a reason for clarification
|
|
17
|
+
*/
|
|
18
|
+
protected constructor(source?: CommandSource | BaseCommand, reason?: string);
|
|
19
|
+
get isAutomaticAction(): boolean;
|
|
9
20
|
get isForceAction(): boolean;
|
|
21
|
+
get isManual(): boolean;
|
|
10
22
|
get isInitial(): boolean;
|
|
11
23
|
get reasonTrace(): string;
|
|
24
|
+
containsType(type: CommandType): boolean;
|
|
12
25
|
}
|
|
@@ -3,32 +3,66 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseCommand = void 0;
|
|
4
4
|
const commandSource_1 = require("./commandSource");
|
|
5
5
|
class BaseCommand {
|
|
6
|
+
/**
|
|
7
|
+
* Base class for all commands
|
|
8
|
+
* @param source - The source of the command
|
|
9
|
+
* @param reason - You can provide a reason for clarification
|
|
10
|
+
*/
|
|
6
11
|
constructor(source = commandSource_1.CommandSource.Unknown, reason = '') {
|
|
7
12
|
this.source = source;
|
|
8
13
|
this.reason = reason;
|
|
9
14
|
this.timestamp = new Date();
|
|
10
15
|
}
|
|
16
|
+
get isAutomaticAction() {
|
|
17
|
+
if (this.source instanceof BaseCommand) {
|
|
18
|
+
return this.source.isAutomaticAction;
|
|
19
|
+
}
|
|
20
|
+
return this.source === commandSource_1.CommandSource.Automatic;
|
|
21
|
+
}
|
|
11
22
|
get isForceAction() {
|
|
23
|
+
if (this.overrideCommandSource !== undefined) {
|
|
24
|
+
return (this.overrideCommandSource === commandSource_1.CommandSource.Manual ||
|
|
25
|
+
this.overrideCommandSource === commandSource_1.CommandSource.API ||
|
|
26
|
+
this.overrideCommandSource === commandSource_1.CommandSource.Force);
|
|
27
|
+
}
|
|
12
28
|
if (this.source instanceof BaseCommand) {
|
|
13
29
|
return this.source.isForceAction;
|
|
14
30
|
}
|
|
15
31
|
return (this.source === commandSource_1.CommandSource.Manual || this.source === commandSource_1.CommandSource.API || this.source === commandSource_1.CommandSource.Force);
|
|
16
32
|
}
|
|
33
|
+
get isManual() {
|
|
34
|
+
if (this.overrideCommandSource !== undefined) {
|
|
35
|
+
return this.overrideCommandSource === commandSource_1.CommandSource.Manual || this.overrideCommandSource === commandSource_1.CommandSource.API;
|
|
36
|
+
}
|
|
37
|
+
if (this.source instanceof BaseCommand) {
|
|
38
|
+
return this.source.isManual;
|
|
39
|
+
}
|
|
40
|
+
return this.source === commandSource_1.CommandSource.Manual || this.source === commandSource_1.CommandSource.API;
|
|
41
|
+
}
|
|
17
42
|
get isInitial() {
|
|
43
|
+
if (this.overrideCommandSource !== undefined) {
|
|
44
|
+
return this.overrideCommandSource === commandSource_1.CommandSource.Initial;
|
|
45
|
+
}
|
|
18
46
|
if (this.source instanceof BaseCommand) {
|
|
19
47
|
return this.source.isInitial;
|
|
20
48
|
}
|
|
21
49
|
return this.source === commandSource_1.CommandSource.Initial;
|
|
22
50
|
}
|
|
23
51
|
get reasonTrace() {
|
|
24
|
-
|
|
25
|
-
if (this.source
|
|
26
|
-
|
|
52
|
+
const ownPart = this.reason !== '' ? `${this._commandType}("${this.reason}")` : `${this._commandType}`;
|
|
53
|
+
if (typeof this.source === 'object') {
|
|
54
|
+
return `${this.source.reasonTrace} -> ${ownPart}`;
|
|
27
55
|
}
|
|
28
|
-
|
|
29
|
-
|
|
56
|
+
return `CommandType("${commandSource_1.CommandSource[this.source]}") stack => ${ownPart}`;
|
|
57
|
+
}
|
|
58
|
+
containsType(type) {
|
|
59
|
+
if (this._commandType === type) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (this.source instanceof BaseCommand) {
|
|
63
|
+
return this.source.containsType(type);
|
|
30
64
|
}
|
|
31
|
-
return
|
|
65
|
+
return false;
|
|
32
66
|
}
|
|
33
67
|
}
|
|
34
68
|
exports.BaseCommand = BaseCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandType } from './commandType';
|
|
2
|
+
import { CommandSource } from './commandSource';
|
|
3
|
+
import { CollisionSolving } from '../collisionSolving';
|
|
4
|
+
import { BaseCommand } from './baseCommand';
|
|
5
|
+
export declare class BlockAutomaticCommand extends BaseCommand {
|
|
6
|
+
durationMS: number;
|
|
7
|
+
onCollideAction: CollisionSolving;
|
|
8
|
+
_commandType: CommandType;
|
|
9
|
+
/**
|
|
10
|
+
* Command to disable automatic actions for a specific duration.
|
|
11
|
+
* @param source - The source of the command.
|
|
12
|
+
* @param durationMS - The duration in milliseconds for the automatic actions to be disabled.
|
|
13
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
14
|
+
* @param onCollideAction - The action to take if a block is already active. --> Default: overrideIfGreater
|
|
15
|
+
*/
|
|
16
|
+
constructor(source: CommandSource | BaseCommand, durationMS: number, reason?: string, onCollideAction?: CollisionSolving);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockAutomaticCommand = void 0;
|
|
4
|
+
const commandType_1 = require("./commandType");
|
|
5
|
+
const collisionSolving_1 = require("../collisionSolving");
|
|
6
|
+
const baseCommand_1 = require("./baseCommand");
|
|
7
|
+
class BlockAutomaticCommand extends baseCommand_1.BaseCommand {
|
|
8
|
+
/**
|
|
9
|
+
* Command to disable automatic actions for a specific duration.
|
|
10
|
+
* @param source - The source of the command.
|
|
11
|
+
* @param durationMS - The duration in milliseconds for the automatic actions to be disabled.
|
|
12
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
13
|
+
* @param onCollideAction - The action to take if a block is already active. --> Default: overrideIfGreater
|
|
14
|
+
*/
|
|
15
|
+
constructor(source, durationMS, reason = '', onCollideAction = collisionSolving_1.CollisionSolving.overrideIfGreater) {
|
|
16
|
+
super(source, reason);
|
|
17
|
+
this.durationMS = durationMS;
|
|
18
|
+
this.onCollideAction = onCollideAction;
|
|
19
|
+
this._commandType = commandType_1.CommandType.BlockAutomaticCommand;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BlockAutomaticCommand = BlockAutomaticCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandType } from './commandType';
|
|
2
|
+
import { CommandSource } from './commandSource';
|
|
3
|
+
import { BaseCommand } from './baseCommand';
|
|
4
|
+
export declare class BlockAutomaticLiftBlockCommand extends BaseCommand {
|
|
5
|
+
_commandType: CommandType;
|
|
6
|
+
/**
|
|
7
|
+
* Command to lift a block --> Restore the automatic actions.
|
|
8
|
+
* @param source - The source of the command.
|
|
9
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
10
|
+
*/
|
|
11
|
+
constructor(source: CommandSource | BaseCommand, reason?: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockAutomaticLiftBlockCommand = void 0;
|
|
4
|
+
const commandType_1 = require("./commandType");
|
|
5
|
+
const baseCommand_1 = require("./baseCommand");
|
|
6
|
+
class BlockAutomaticLiftBlockCommand extends baseCommand_1.BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Command to lift a block --> Restore the automatic actions.
|
|
9
|
+
* @param source - The source of the command.
|
|
10
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
11
|
+
*/
|
|
12
|
+
constructor(source, reason = '') {
|
|
13
|
+
super(source, reason);
|
|
14
|
+
this._commandType = commandType_1.CommandType.BlockAutomaticLiftBlockCommand;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BlockAutomaticLiftBlockCommand = BlockAutomaticLiftBlockCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandType } from './commandType';
|
|
2
|
+
import { CommandSource } from './commandSource';
|
|
3
|
+
import { CollisionSolving } from '../collisionSolving';
|
|
4
|
+
import { BaseCommand } from './baseCommand';
|
|
5
|
+
export declare class BlockAutomaticUntilCommand extends BaseCommand {
|
|
6
|
+
targetDate: Date;
|
|
7
|
+
onCollideAction: CollisionSolving;
|
|
8
|
+
_commandType: CommandType;
|
|
9
|
+
/**
|
|
10
|
+
* Command to disable automatic actions until a specific date.
|
|
11
|
+
* @param source - The source of the command.
|
|
12
|
+
* @param targetDate - The date until the automatic actions will be disabled.
|
|
13
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
14
|
+
* @param onCollideAction - The action to take if a block is already active. --> Default: overrideIfGreater
|
|
15
|
+
*/
|
|
16
|
+
constructor(source: CommandSource | BaseCommand, targetDate: Date, reason?: string, onCollideAction?: CollisionSolving);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockAutomaticUntilCommand = void 0;
|
|
4
|
+
const commandType_1 = require("./commandType");
|
|
5
|
+
const collisionSolving_1 = require("../collisionSolving");
|
|
6
|
+
const baseCommand_1 = require("./baseCommand");
|
|
7
|
+
class BlockAutomaticUntilCommand extends baseCommand_1.BaseCommand {
|
|
8
|
+
/**
|
|
9
|
+
* Command to disable automatic actions until a specific date.
|
|
10
|
+
* @param source - The source of the command.
|
|
11
|
+
* @param targetDate - The date until the automatic actions will be disabled.
|
|
12
|
+
* @param reason - You can provide an individual reason here for debugging purpose.
|
|
13
|
+
* @param onCollideAction - The action to take if a block is already active. --> Default: overrideIfGreater
|
|
14
|
+
*/
|
|
15
|
+
constructor(source, targetDate, reason = '', onCollideAction = collisionSolving_1.CollisionSolving.overrideIfGreater) {
|
|
16
|
+
super(source, reason);
|
|
17
|
+
this.targetDate = targetDate;
|
|
18
|
+
this.onCollideAction = onCollideAction;
|
|
19
|
+
this._commandType = commandType_1.CommandType.BlockAutomaticUntilCommand;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BlockAutomaticUntilCommand = BlockAutomaticUntilCommand;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
export declare enum CommandSource {
|
|
2
|
+
/**
|
|
3
|
+
* In case of unclear command stack/source this should be used.
|
|
4
|
+
*/
|
|
2
5
|
Unknown = 0,
|
|
6
|
+
/**
|
|
7
|
+
* This should mark all startup commands, as this allows devices to treat this correctly.
|
|
8
|
+
*/
|
|
3
9
|
Initial = 1,
|
|
10
|
+
/**
|
|
11
|
+
* This should mark all commands that are executed as an automatic response to a certain action/change.
|
|
12
|
+
*/
|
|
4
13
|
Automatic = 2,
|
|
14
|
+
/**
|
|
15
|
+
* This should mark all commands that are executed by a user thus having a higher priority than other automatic commands.
|
|
16
|
+
*/
|
|
5
17
|
Manual = 3,
|
|
18
|
+
/**
|
|
19
|
+
* This should mark all commands that are executed by an API call.
|
|
20
|
+
* !WARNING! API could be an automatic call, but also a manual call e.g. using hoffmation-ios or homebridge-hoffmation --> So this is a higher priority than Automatic but still lower than manual/force.
|
|
21
|
+
*/
|
|
6
22
|
API = 4,
|
|
23
|
+
/**
|
|
24
|
+
* This should mark all commands that have highest priority, thus overruling/ignoring certain controls/safety mechanisms.
|
|
25
|
+
*/
|
|
7
26
|
Force = 5
|
|
8
27
|
}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandSource = void 0;
|
|
4
|
+
// Definition: Enum for command source.
|
|
4
5
|
var CommandSource;
|
|
5
6
|
(function (CommandSource) {
|
|
7
|
+
/**
|
|
8
|
+
* In case of unclear command stack/source this should be used.
|
|
9
|
+
*/
|
|
6
10
|
CommandSource[CommandSource["Unknown"] = 0] = "Unknown";
|
|
11
|
+
/**
|
|
12
|
+
* This should mark all startup commands, as this allows devices to treat this correctly.
|
|
13
|
+
*/
|
|
7
14
|
CommandSource[CommandSource["Initial"] = 1] = "Initial";
|
|
15
|
+
/**
|
|
16
|
+
* This should mark all commands that are executed as an automatic response to a certain action/change.
|
|
17
|
+
*/
|
|
8
18
|
CommandSource[CommandSource["Automatic"] = 2] = "Automatic";
|
|
19
|
+
/**
|
|
20
|
+
* This should mark all commands that are executed by a user thus having a higher priority than other automatic commands.
|
|
21
|
+
*/
|
|
9
22
|
CommandSource[CommandSource["Manual"] = 3] = "Manual";
|
|
23
|
+
/**
|
|
24
|
+
* This should mark all commands that are executed by an API call.
|
|
25
|
+
* !WARNING! API could be an automatic call, but also a manual call e.g. using hoffmation-ios or homebridge-hoffmation --> So this is a higher priority than Automatic but still lower than manual/force.
|
|
26
|
+
*/
|
|
10
27
|
CommandSource[CommandSource["API"] = 4] = "API";
|
|
28
|
+
/**
|
|
29
|
+
* This should mark all commands that have highest priority, thus overruling/ignoring certain controls/safety mechanisms.
|
|
30
|
+
*/
|
|
11
31
|
CommandSource[CommandSource["Force"] = 5] = "Force";
|
|
12
32
|
})(CommandSource || (exports.CommandSource = CommandSource = {}));
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare enum CommandType {
|
|
2
|
+
BlockAutomaticLiftBlockCommand = "BlockAutomaticLiftBlockCommand",
|
|
3
|
+
BlockAutomaticCommand = "BlockAutomaticCommand",
|
|
4
|
+
BlockAutomaticUntilCommand = "BlockAutomaticUntilCommand",
|
|
2
5
|
ActuatorToggleCommand = "ActuatorToggleCommand",
|
|
3
6
|
ActuatorSetStateCommand = "ActuatorSetStateCommand",
|
|
4
7
|
ActuatorRestoreTargetAutomaticValueCommand = "ActuatorRestoreTargetAutomaticValueCommand",
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CommandType = void 0;
|
|
4
4
|
var CommandType;
|
|
5
5
|
(function (CommandType) {
|
|
6
|
+
CommandType["BlockAutomaticLiftBlockCommand"] = "BlockAutomaticLiftBlockCommand";
|
|
7
|
+
CommandType["BlockAutomaticCommand"] = "BlockAutomaticCommand";
|
|
8
|
+
CommandType["BlockAutomaticUntilCommand"] = "BlockAutomaticUntilCommand";
|
|
6
9
|
CommandType["ActuatorToggleCommand"] = "ActuatorToggleCommand";
|
|
7
10
|
CommandType["ActuatorSetStateCommand"] = "ActuatorSetStateCommand";
|
|
8
11
|
CommandType["ActuatorRestoreTargetAutomaticValueCommand"] = "ActuatorRestoreTargetAutomaticValueCommand";
|
|
@@ -9,12 +9,13 @@ export declare class DimmerSetLightCommand extends LampSetLightCommand {
|
|
|
9
9
|
transitionTime: number;
|
|
10
10
|
_commandType: CommandType;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
12
|
+
* Command to change the light of a dimmer
|
|
13
|
+
* @param source - The source of the command
|
|
14
|
+
* @param on - The desired value
|
|
15
|
+
* @param reason - You can provide a reason for clarity
|
|
16
|
+
* @param timeout - A chosen Timeout after which the light should be reset
|
|
17
|
+
* @param brightness - The desired brightness
|
|
18
|
+
* @param transitionTime - The transition time during turnOn/turnOff
|
|
18
19
|
*/
|
|
19
20
|
constructor(source: CommandSource | BaseCommand, on: boolean, reason?: string, timeout?: number, brightness?: number, transitionTime?: number);
|
|
20
21
|
get logMessage(): string;
|
|
@@ -6,12 +6,13 @@ const commandType_1 = require("./commandType");
|
|
|
6
6
|
const timeCallback_1 = require("../timeCallback");
|
|
7
7
|
class DimmerSetLightCommand extends lampSetLightCommand_1.LampSetLightCommand {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
9
|
+
* Command to change the light of a dimmer
|
|
10
|
+
* @param source - The source of the command
|
|
11
|
+
* @param on - The desired value
|
|
12
|
+
* @param reason - You can provide a reason for clarity
|
|
13
|
+
* @param timeout - A chosen Timeout after which the light should be reset
|
|
14
|
+
* @param brightness - The desired brightness
|
|
15
|
+
* @param transitionTime - The transition time during turnOn/turnOff
|
|
15
16
|
*/
|
|
16
17
|
constructor(source, on, reason = '', timeout = -1, brightness = -1, transitionTime = -1) {
|
|
17
18
|
super(source, on, reason, timeout);
|
|
@@ -20,18 +21,19 @@ class DimmerSetLightCommand extends lampSetLightCommand_1.LampSetLightCommand {
|
|
|
20
21
|
this._commandType = commandType_1.CommandType.DimmerSetLightCommand;
|
|
21
22
|
}
|
|
22
23
|
get logMessage() {
|
|
23
|
-
return `Dimmer setLight to ${this.on}
|
|
24
|
+
return `Dimmer setLight to ${this.on} with Brightness ${this.brightness} with timeout ${this.timeout} for reason: ${this.reasonTrace}`;
|
|
24
25
|
}
|
|
25
26
|
static byTimeBased(s, c) {
|
|
27
|
+
const manual = c.isForceAction;
|
|
26
28
|
switch (c.time) {
|
|
27
29
|
case timeCallback_1.TimeOfDay.Daylight:
|
|
28
|
-
return new DimmerSetLightCommand(c,
|
|
30
|
+
return new DimmerSetLightCommand(c, manual || s.dayOn, 'Daylight', c.timeout, s.dayBrightness);
|
|
29
31
|
case timeCallback_1.TimeOfDay.BeforeSunrise:
|
|
30
|
-
return new DimmerSetLightCommand(c, s.dawnOn, '', c.timeout, s.dawnBrightness, undefined);
|
|
32
|
+
return new DimmerSetLightCommand(c, manual || s.dawnOn, 'Dawn', c.timeout, s.dawnBrightness, undefined);
|
|
31
33
|
case timeCallback_1.TimeOfDay.AfterSunset:
|
|
32
|
-
return new DimmerSetLightCommand(c, s.duskOn, '', c.timeout, s.duskBrightness, undefined);
|
|
34
|
+
return new DimmerSetLightCommand(c, manual || s.duskOn, 'Dusk', c.timeout, s.duskBrightness, undefined);
|
|
33
35
|
case timeCallback_1.TimeOfDay.Night:
|
|
34
|
-
return new DimmerSetLightCommand(c, s.nightOn, '', c.timeout, s.nightBrightness, undefined);
|
|
36
|
+
return new DimmerSetLightCommand(c, manual || s.nightOn, 'Night', c.timeout, s.nightBrightness, undefined);
|
|
35
37
|
default:
|
|
36
38
|
throw new Error(`TimeOfDay ${c.time} not supported`);
|
|
37
39
|
}
|