Skip to content

Commit

Permalink
0.0.2-alpha6:
Browse files Browse the repository at this point in the history
- create object folders as channels so that enums can be assigned
- predefined states for fan speed, vane horizontal/vertical, "Swing" added
- min/max for setTemperature added
- changing operation mode doesn't power on device anymore
  • Loading branch information
Black-Thunder committed May 25, 2020
1 parent 753663c commit 383cf0e
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 14 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ Documentation:

## Changelog

### 0.0.2-alpha6 25.05.2020
* (Black-Thunder) create object folders as channels so that enums can be assigned
* (Black-Thunder) predefined states for fan speed, vane horizontal/vertical, "Swing" added
* (Black-Thunder) changing operation mode doesn't power on device anymore
* (Black-Thunder) min/max for setTemperature added

### 0.0.2-alpha5 25.05.2020
* (Black-Thunder) added more error logging

### 0.0.2-alpha4 25.05.2020
* (Black-Thunder) operation modes "Dry" and "Vent" added, removed confusing mode "Off" (device state is now only controlled by "power")
* (Black-Thunder) control of fan speed, horizontal and vertical vane direction added
Expand Down
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"common": {
"name": "melcloud",
"version": "0.0.2-alpha5",
"version": "0.0.2-alpha6",
"news": {
"0.0.2": {
"en": "first implementation of device control, added more device options, extended and optimized logging (e.g. when logging into MelCloud), implemented polling of cloud data",
Expand Down
70 changes: 58 additions & 12 deletions lib/melcloudDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ class MelcloudDevice {

async Save() {
//// INFO
const infoPrefix = commonDefines.AdapterDatapointIDs.Devices + "." + this.id + "." + commonDefines.AdapterDatapointIDs.Info + ".";
let infoPrefix = commonDefines.AdapterDatapointIDs.Devices + "." + this.id + "." + commonDefines.AdapterDatapointIDs.Info;
await gthat.setObjectNotExistsAsync(infoPrefix, {
type: "channel",
common: {
name: "Device information"
},
native: {}
});

infoPrefix += ".";

await gthat.setObjectNotExistsAsync(infoPrefix + commonDefines.AdapterStateIDs.DeviceName, {
type: "state",
Expand Down Expand Up @@ -295,7 +304,16 @@ class MelcloudDevice {
//// END INFO

//// CONTROL
const controlPrefix = commonDefines.AdapterDatapointIDs.Devices + "." + this.id + "." + commonDefines.AdapterDatapointIDs.Control + ".";
let controlPrefix = commonDefines.AdapterDatapointIDs.Devices + "." + this.id + "." + commonDefines.AdapterDatapointIDs.Control;
await gthat.setObjectNotExistsAsync(controlPrefix, {
type: "channel",
common: {
name: "Device control"
},
native: {}
});

controlPrefix += ".";

await gthat.setObjectNotExistsAsync(controlPrefix + commonDefines.AdapterStateIDs.Power, {
type: "state",
Expand All @@ -320,7 +338,7 @@ class MelcloudDevice {
read: true,
write: true,
desc: "Operation mode of the device",
"states": {
states: {
1: "HEAT",
2: "DRY",
3: "COOL",
Expand All @@ -339,6 +357,8 @@ class MelcloudDevice {
type: "number",
role: "value.temperature",
unit: this.platform.UseFahrenheit ? "°F" : "°C",
min: 10,
max: 40,
read: true,
write: true,
desc: "Target temperature of the device"
Expand All @@ -354,10 +374,18 @@ class MelcloudDevice {
type: "number",
role: "value",
min: 0,
max: this.numberOfFanSpeeds,
max: 5,
states: {
0: "AUTO",
1: "LOWEST",
2: "LOW",
3: "MEDIUM",
4: "HIGH",
5: "MAX"
},
read: true,
write: true,
desc: "Current fan speed of the device (0 = auto, 1...numberOfFanSpeeds = fan speed low to max)"
desc: "Current fan speed of the device"
},
native: {}
});
Expand All @@ -371,9 +399,18 @@ class MelcloudDevice {
role: "value",
min: 0,
max: 5,
states: {
0: "AUTO",
1: "LOWEST",
2: "LOW",
3: "MEDIUM",
4: "HIGH",
5: "MAX",
7: "SWING"
},
read: true,
write: true,
desc: "Current vertical direction of the device's vane (0 = swing, 1...5 = vane lowest to highest position)"
desc: "Current vertical direction of the device's vane"
},
native: {}
});
Expand All @@ -387,9 +424,18 @@ class MelcloudDevice {
role: "value",
min: 0,
max: 5,
states: {
0: "AUTO",
1: "LOWEST",
2: "LOW",
3: "MEDIUM",
4: "HIGH",
5: "MAX",
12: "SWING"
},
read: true,
write: true,
desc: "Current horizontal direction of the device's vane (0 = swing, 1...5 = vane lowest to highest position)"
desc: "Current horizontal direction of the device's vane"
},
native: {}
});
Expand Down Expand Up @@ -467,27 +513,27 @@ class MelcloudDevice {
r.EffectiveFlags = commonDefines.DeviceOperationModes.OFF.effectiveFlags;
break;
case commonDefines.DeviceOperationModes.HEAT:
r.Power = commonDefines.DeviceOperationModes.HEAT.power;
//r.Power = commonDefines.DeviceOperationModes.HEAT.power;
r.OperationMode = commonDefines.DeviceOperationModes.HEAT.value;
r.EffectiveFlags = commonDefines.DeviceOperationModes.HEAT.effectiveFlags;
break;
case commonDefines.DeviceOperationModes.DRY:
r.Power = commonDefines.DeviceOperationModes.DRY.power;
//r.Power = commonDefines.DeviceOperationModes.DRY.power;
r.OperationMode = commonDefines.DeviceOperationModes.DRY.value;
r.EffectiveFlags = commonDefines.DeviceOperationModes.DRY.effectiveFlags;
break;
case commonDefines.DeviceOperationModes.COOL:
r.Power = commonDefines.DeviceOperationModes.COOL.power;
//r.Power = commonDefines.DeviceOperationModes.COOL.power;
r.OperationMode = commonDefines.DeviceOperationModes.COOL.value;
r.EffectiveFlags = commonDefines.DeviceOperationModes.COOL.effectiveFlags;
break;
case commonDefines.DeviceOperationModes.VENT:
r.Power = commonDefines.DeviceOperationModes.VENT.power;
//r.Power = commonDefines.DeviceOperationModes.VENT.power;
r.OperationMode = commonDefines.DeviceOperationModes.VENT.value;
r.EffectiveFlags = commonDefines.DeviceOperationModes.VENT.effectiveFlags;
break;
case commonDefines.DeviceOperationModes.AUTO:
r.Power = commonDefines.DeviceOperationModes.AUTO.power;
//r.Power = commonDefines.DeviceOperationModes.AUTO.power;
r.OperationMode = commonDefines.DeviceOperationModes.AUTO.value;
r.EffectiveFlags = commonDefines.DeviceOperationModes.AUTO.effectiveFlags;
break;
Expand Down
9 changes: 9 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ class Melcloud extends utils.Adapter {

async initObjects() {
this.log.debug("Initializing objects...");

await this.setObjectNotExistsAsync(commonDefines.AdapterDatapointIDs.Info, {
type: "channel",
common: {
name: "Adapter information"
},
native: {}
});

await this.setObjectNotExistsAsync(commonDefines.AdapterDatapointIDs.Info + "." + commonDefines.AdapterStateIDs.Connection, {
type: "state",
common: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.melcloud",
"version": "0.0.2-alpha5",
"version": "0.0.2-alpha6",
"description": "melcloud",
"author": {
"name": "BlackThunder",
Expand Down

0 comments on commit 383cf0e

Please sign in to comment.