iobroker.iot 3.5.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -9
- package/admin/assets/index-Y479CE6x.js +681 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/assets/{ActionVisu-D9x2f6zu.js → ActionVisu-DE8dgNVF.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js → ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js → ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js} +2 -2
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js +5 -0
- package/admin/rules/assets/bootstrap-Ba57tu25.js +1 -0
- package/admin/rules/assets/hostInit-hos3Txsy.js +1 -1
- package/admin/rules/assets/{index-Duo7mFlZ.js → index-CbxmbJvB.js} +2 -2
- package/admin/rules/assets/{index-CAAeiKCc.js → index-DjPMvPni.js} +2 -2
- package/admin/rules/assets/index-_Y2FN5EZ.js +1152 -0
- package/admin/rules/assets/{virtualExposes-BqVak7rX.js → virtualExposes-BNZJTatg.js} +2 -2
- package/admin/rules/customRuleBlocks.js +2 -2
- package/io-package.json +27 -27
- package/package.json +17 -14
- package/admin/assets/index-Df2NS929.js +0 -681
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js +0 -10
- package/admin/rules/assets/bootstrap-BCFKIiwZ.js +0 -1
- package/admin/rules/assets/index-BwcOGyWI.js +0 -1152
- package/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js +0 -262
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +0 -124
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +0 -69
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +0 -34
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -27
- package/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +0 -75
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -39
- package/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +0 -50
- package/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -13
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -38
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -55
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +0 -56
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -11
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +0 -108
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +0 -40
- package/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +0 -62
- package/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +0 -22
- package/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js +0 -40
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +0 -32
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -17
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +0 -25
- package/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -28
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +0 -52
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -19
- package/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/AirCondition.js +0 -144
- package/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -12
- package/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/Control.js +0 -352
- package/lib/AlexaSmartHomeV3/Controls/Ct.js +0 -172
- package/lib/AlexaSmartHomeV3/Controls/Dimmer.js +0 -124
- package/lib/AlexaSmartHomeV3/Controls/Door.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Gate.js +0 -42
- package/lib/AlexaSmartHomeV3/Controls/Hue.js +0 -207
- package/lib/AlexaSmartHomeV3/Controls/Light.js +0 -54
- package/lib/AlexaSmartHomeV3/Controls/Lock.js +0 -36
- package/lib/AlexaSmartHomeV3/Controls/Motion.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -25
- package/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -10
- package/lib/AlexaSmartHomeV3/Controls/Socket.js +0 -21
- package/lib/AlexaSmartHomeV3/Controls/Temperature.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -86
- package/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/Volume.js +0 -109
- package/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Window.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Device.js +0 -84
- package/lib/AlexaSmartHomeV3/DeviceManager.js +0 -415
- package/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -8
- package/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js +0 -46
- package/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +0 -70
- package/lib/AlexaSmartHomeV3/Helpers/IotProxy.js +0 -44
- package/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -95
- package/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +0 -82
- package/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -583
- package/lib/Utils.js +0 -608
- package/lib/adminCommonSocket.js +0 -781
- package/lib/alexaCustom.js +0 -622
- package/lib/alexaSmartHomeV2.js +0 -2792
- package/lib/alexaSmartHomeV3.js +0 -117
- package/lib/alisa.js +0 -2412
- package/lib/devices.js +0 -20
- package/lib/functions.js +0 -21
- package/lib/googleHome.js +0 -3323
- package/lib/notifications.js +0 -37
- package/lib/remote.js +0 -1363
- package/lib/rooms.js +0 -45
- package/lib/texts.js +0 -79
- package/lib/translate.js +0 -19
- package/lib/visuApp.js +0 -157
- package/main.js +0 -1444
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const Base = require('./Base');
|
|
2
|
-
|
|
3
|
-
class Muted extends Base {
|
|
4
|
-
static matches(event) {
|
|
5
|
-
return event?.directive?.header?.namespace === 'Alexa.Speaker';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
matches(event) {
|
|
9
|
-
return Muted.matches(event) && event?.directive?.header?.name === 'SetMute';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
alexaDirectiveValue(event) {
|
|
13
|
-
return event.directive.payload['mute'];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = Muted;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const AdjustableProperty = require('./AdjustableProperty');
|
|
2
|
-
|
|
3
|
-
class Percentage extends AdjustableProperty {
|
|
4
|
-
|
|
5
|
-
matches(event) {
|
|
6
|
-
return Percentage.matches(event);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
alexaDirectiveValue(event) {
|
|
10
|
-
return Percentage.directive(event) === Percentage.SET ? super.alexaDirectiveValue(event) : event.directive.payload['percentageDelta'];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = Percentage;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const Base = require('./Base');
|
|
2
|
-
|
|
3
|
-
class PowerState extends Base {
|
|
4
|
-
static matches(event) {
|
|
5
|
-
return event?.directive?.header?.namespace === 'Alexa.PowerController';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
matches(event) {
|
|
9
|
-
return PowerState.matches(event);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static get ON() {
|
|
13
|
-
return 'ON';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static get OFF() {
|
|
17
|
-
return 'OFF';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
alexaDirectiveValue(event) {
|
|
21
|
-
return event.directive.header.name === 'TurnOn' ? PowerState.ON : PowerState.OFF;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = PowerState;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const Base = require('./Base');
|
|
2
|
-
|
|
3
|
-
class TargetSetpoint extends Base {
|
|
4
|
-
static matches(event) {
|
|
5
|
-
return event?.directive?.header?.name === 'SetTargetTemperature' || event?.directive?.header?.name === 'AdjustTargetTemperature';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
matches(event) {
|
|
9
|
-
return TargetSetpoint.matches(event);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static directive(event) {
|
|
13
|
-
return event.directive.header.name === 'AdjustTargetTemperature' ? TargetSetpoint.ADJUST : TargetSetpoint.SET;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
alexaDirectiveValue(event) {
|
|
17
|
-
return TargetSetpoint.directive(event) === TargetSetpoint.SET ? event.directive.payload.targetSetpoint.value : event.directive.payload.targetSetpointDelta.value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
reportValue(value) {
|
|
21
|
-
return {
|
|
22
|
-
value: value,
|
|
23
|
-
scale: TargetSetpoint.CELSIUS_SCALE,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = TargetSetpoint;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const Base = require('./Base');
|
|
2
|
-
|
|
3
|
-
class Temperature extends Base {
|
|
4
|
-
static matches(event) {
|
|
5
|
-
return event?.directive?.header?.namespace === 'Alexa.TemperatureSensor';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
matches(event) {
|
|
9
|
-
return Temperature.matches(event);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
reportValue(value) {
|
|
13
|
-
return {
|
|
14
|
-
value: value,
|
|
15
|
-
scale: Temperature.CELSIUS_SCALE,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = Temperature;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const Utils = require('../../Helpers/Utils');
|
|
2
|
-
const Base = require('./Base');
|
|
3
|
-
|
|
4
|
-
class ThermostatMode extends Base {
|
|
5
|
-
|
|
6
|
-
init(opts) {
|
|
7
|
-
super.init(opts);
|
|
8
|
-
// set mode to be AUTO for thermostats without mode at all
|
|
9
|
-
this.currentValue = this.setId ? undefined : ThermostatMode.AUTO;
|
|
10
|
-
this._supportedModes = opts.supportedModes;
|
|
11
|
-
this._supportedModesAsEnum = Utils.asEnum(this._supportedModes);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static matches(event) {
|
|
15
|
-
return event?.directive?.header?.name === 'SetThermostatMode';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
matches(event) {
|
|
20
|
-
return ThermostatMode.matches(event);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
alexaDirectiveValue(event) {
|
|
24
|
-
return event.directive.payload.thermostatMode.value;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get supportedModes() {
|
|
28
|
-
return this._supportedModes;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get supportedModesAsEnum() {
|
|
32
|
-
return this._supportedModesAsEnum;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
static get AUTO() {
|
|
36
|
-
return 'AUTO';
|
|
37
|
-
}
|
|
38
|
-
static get COOL() {
|
|
39
|
-
return 'COOL';
|
|
40
|
-
}
|
|
41
|
-
static get ECO() {
|
|
42
|
-
return 'ECO';
|
|
43
|
-
}
|
|
44
|
-
static get HEAT() {
|
|
45
|
-
return 'HEAT';
|
|
46
|
-
}
|
|
47
|
-
static get OFF() {
|
|
48
|
-
return 'OFF';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
module.exports = ThermostatMode;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const AdjustableProperty = require('./AdjustableProperty');
|
|
2
|
-
|
|
3
|
-
class Volume extends AdjustableProperty {
|
|
4
|
-
static matches(event) {
|
|
5
|
-
return event?.directive?.header?.namespace === 'Alexa.Speaker';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
matches(event) {
|
|
9
|
-
return Volume.matches(event)
|
|
10
|
-
&& ['AdjustVolume', 'SetVolume'].includes(event?.directive?.header?.name);
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static directive(event) {
|
|
15
|
-
return event.directive.header.name === 'AdjustVolume' ? Volume.ADJUST : Volume.SET;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = Volume;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const properties = {};
|
|
2
|
-
const propertiesPath = require('path').join(__dirname);
|
|
3
|
-
const excludedNames = ['index'];
|
|
4
|
-
|
|
5
|
-
require('fs')
|
|
6
|
-
.readdirSync(propertiesPath)
|
|
7
|
-
.forEach((file) => {
|
|
8
|
-
const name = file.replace(/\.js$/, '');
|
|
9
|
-
if (!excludedNames.includes(name)) {
|
|
10
|
-
properties[name] = require(`./${file}`);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
module.exports = properties;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const Control = require('./Control');
|
|
3
|
-
const Properties = require('../Alexa/Properties');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @class
|
|
7
|
-
*/
|
|
8
|
-
class AdjustableControl extends Control {
|
|
9
|
-
adjustableProperties() {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
isAdjustDirective(event) {
|
|
14
|
-
return this.adjustableProperties().some(property => property.matches(event) && property.directive(event) === Properties.Base.ADJUST);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
valueSetter(event) {
|
|
18
|
-
return this.isAdjustDirective(event) ? this.adjustValue.bind(this) : super.valueSetter(event);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = AdjustableControl;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const Capabilities = require('../Alexa/Capabilities');
|
|
2
|
-
const AdjustableControl = require('./AdjustableControl');
|
|
3
|
-
const Properties = require('../Alexa/Properties');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @class
|
|
7
|
-
*/
|
|
8
|
-
class AdjustablePercentageControl extends AdjustableControl {
|
|
9
|
-
adjustableProperties() {
|
|
10
|
-
return [Properties.Percentage];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
initCapabilities() {
|
|
15
|
-
let result = [new Capabilities.PercentageController()];
|
|
16
|
-
for (const property of result.flatMap(item => item.properties)) {
|
|
17
|
-
property.init(this.percentageInitObject())
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async setState(property, value) {
|
|
23
|
-
// todo: byON
|
|
24
|
-
return super.setState(property, value);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = AdjustablePercentageControl;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
const Capabilities = require('../Alexa/Capabilities');
|
|
2
|
-
const AdjustableControl = require('./AdjustableControl');
|
|
3
|
-
const Utils = require('../Helpers/Utils');
|
|
4
|
-
const Properties = require('../Alexa/Properties');
|
|
5
|
-
const AdapterProvider = require('../Helpers/AdapterProvider');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @class
|
|
9
|
-
*/
|
|
10
|
-
class AirCondition extends AdjustableControl {
|
|
11
|
-
get categories() {
|
|
12
|
-
return ['AIR_CONDITIONER']
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
adjustableProperties() {
|
|
16
|
-
return [Properties.TargetSetpoint];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get dedicatedOnOff() {
|
|
20
|
-
return this.states[this.statesMap.power] !== undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
initCapabilities() {
|
|
24
|
-
this._thermostatController = new Capabilities.ThermostatController();
|
|
25
|
-
this._thermostatMode = this._thermostatController.thermostatMode;
|
|
26
|
-
this._powerController = new Capabilities.PowerController();
|
|
27
|
-
this._powerState = this._powerController.powerState;
|
|
28
|
-
let result = [new Capabilities.TemperatureSensor(), this._thermostatController, this._powerController];
|
|
29
|
-
for (const property of result.flatMap(item => item.properties)) {
|
|
30
|
-
property.init(this.composeInitObject(property));
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async setState(property, value) {
|
|
36
|
-
// if we set power ON/OFF via thermostat mode
|
|
37
|
-
if (property.propertyName === Properties.PowerState.propertyName && !this.dedicatedOnOff) {
|
|
38
|
-
// set the mode to the last known value or AUTO by switching power ON
|
|
39
|
-
if (value) {
|
|
40
|
-
this._lastKnownMode = this._lastKnownMode || this._thermostatMode.supportedModesAsEnum[Properties.ThermostatMode.AUTO];
|
|
41
|
-
await AdapterProvider.setState(this._thermostatMode.setId, this._lastKnownMode);
|
|
42
|
-
this._thermostatMode.currentValue = this._lastKnownMode;
|
|
43
|
-
this._powerState.currentValue = true;
|
|
44
|
-
|
|
45
|
-
} else { // set mode to OFF
|
|
46
|
-
const modeOffValue = this._thermostatMode.supportedModesAsEnum[Properties.ThermostatMode.OFF];
|
|
47
|
-
await AdapterProvider.setState(this._thermostatMode.setId, modeOffValue);
|
|
48
|
-
this._thermostatMode.currentValue = this._lastKnownMode;
|
|
49
|
-
this._powerState.currentValue = false;
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
// just set the property
|
|
53
|
-
await AdapterProvider.setState(property.setId, value);
|
|
54
|
-
property.currentValue = value;
|
|
55
|
-
|
|
56
|
-
if (property.propertyName === Properties.ThermostatMode.propertyName) {
|
|
57
|
-
this._lastKnownMode = value;
|
|
58
|
-
if (!this.dedicatedOnOff) {
|
|
59
|
-
this._powerState.currentValue = value !== this._thermostatMode.supportedModesAsEnum[Properties.ThermostatMode.OFF];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async getOrRetrieveCurrentValue(property) {
|
|
67
|
-
if (property.currentValue === undefined) {
|
|
68
|
-
property.currentValue = await AdapterProvider.getState(property.getId);
|
|
69
|
-
|
|
70
|
-
// convert mode != OFF to power = true
|
|
71
|
-
if (property.propertyName === this._powerState.propertyName && !this.dedicatedOnOff) {
|
|
72
|
-
property.currentValue = property.currentValue !== this._thermostatMode.supportedModesAsEnum[Properties.ThermostatMode.OFF];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (property.currentValue === undefined) {
|
|
77
|
-
throw new Error(`unable to retrieve ${property.getId}`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return property.currentValue;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
composeInitObject(property) {
|
|
84
|
-
const map = this.statesMap;
|
|
85
|
-
|
|
86
|
-
if (property.propertyName === Properties.PowerState.propertyName) {
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
setState: this.states[map.power] || this.states[map.mode],
|
|
90
|
-
getState: this.states[map.power] || this.states[map.mode],
|
|
91
|
-
alexaSetter: function (alexaValue) {
|
|
92
|
-
return alexaValue === Properties.PowerState.ON;
|
|
93
|
-
},
|
|
94
|
-
alexaGetter: function (value) {
|
|
95
|
-
return value ? Properties.PowerState.ON : Properties.PowerState.OFF;
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (property.propertyName === Properties.Temperature.propertyName) {
|
|
101
|
-
return {
|
|
102
|
-
setState: this.states[map.set],
|
|
103
|
-
getState: this.states[map.actual] || this.states[map.set],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (property.propertyName === Properties.TargetSetpoint.propertyName) {
|
|
108
|
-
// const range = Utils.configuredRangeOrDefault(this.states[map.set]);
|
|
109
|
-
return {
|
|
110
|
-
setState: this.states[map.set],
|
|
111
|
-
getState: this.states[map.actual] || this.states[map.set],
|
|
112
|
-
alexaSetter: function (alexaValue) {
|
|
113
|
-
return Utils.ensureValueInRange(alexaValue, this.valuesRangeMin, this.valuesRangeMax);
|
|
114
|
-
},
|
|
115
|
-
alexaGetter: function (value) {
|
|
116
|
-
return value;
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (property.propertyName === Properties.ThermostatMode.propertyName) {
|
|
122
|
-
const initObject = {
|
|
123
|
-
setState: this.states[map.mode],
|
|
124
|
-
getState: this.states[map.mode],
|
|
125
|
-
alexaSetter: function (alexaValue) {
|
|
126
|
-
return this.supportedModesAsEnum[alexaValue];
|
|
127
|
-
},
|
|
128
|
-
alexaGetter: function (value) {
|
|
129
|
-
return this.supportedModesAsEnum[value];
|
|
130
|
-
},
|
|
131
|
-
supportedModes: [
|
|
132
|
-
Properties.ThermostatMode.AUTO,
|
|
133
|
-
Properties.ThermostatMode.COOL,
|
|
134
|
-
Properties.ThermostatMode.ECO,
|
|
135
|
-
Properties.ThermostatMode.HEAT,
|
|
136
|
-
Properties.ThermostatMode.OFF,
|
|
137
|
-
],
|
|
138
|
-
};
|
|
139
|
-
return initObject;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
module.exports = AirCondition;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const Capabilities = require('../Alexa/Capabilities');
|
|
2
|
-
const ReadOnlyDetector = require('./ReadOnlyDetector');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @class
|
|
6
|
-
*/
|
|
7
|
-
class ContactSensor extends ReadOnlyDetector {
|
|
8
|
-
get capability() {
|
|
9
|
-
return new Capabilities.ContactSensor();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get categories() {
|
|
13
|
-
return ['CONTACT_SENSOR'];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = ContactSensor;
|