Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
HGlab01 committed Oct 17, 2024
1 parent ef0a025 commit 683f2b4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Tado° (https://www.tado.com) is the expert in smart heating and energy manageme
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.

## TADO° X
Tado X **is currently not supported** by this adapter. The adapter supports Tado V3, V3+ and V2.
If someone is supporting to add Tado X functionality, raise a ticket or send an email to <myiobrokeradapters@gmail.com>. You will need to support some debugging session and interact with the adapter developer.
Basic support for Tado X available.
If your setup is not working, please raise a ticket (https://github.com/DrozmotiX/ioBroker.tado/issues/new?assignees=HGlab01&labels=enhancement&projects=&template=Enhancement.md&title=). You will need to support some debugging session and interact with the adapter developer.

## Things you can steer
## Things you can steer on Tado Classic
| State | Description |
| ----- | ----------- |
| tado.[x].[yyyyyy].Rooms.[z].setting.power | Turn device on/off |
Expand All @@ -42,6 +42,18 @@ If someone is supporting to add Tado X functionality, raise a ticket or send an
| tado.[x].[yyyyyy].Rooms.[z].setting.horizontalSwing | Horizontal swing (only AC devices with V3 and olderversions) |
| tado.[x].[yyyyyy].meterReadings | JSON-Object with {"date":"YYYY-MM-DD","reading": 1234} can be used to upload meter-readings to Energy IQ |

## Things you can steer on Tado *X*
| State | Description |
| ----- | ----------- |
| tado.[x].[yyyyyy].Rooms.[z].setting.power | Turn device on/off |
| tado.[x].[yyyyyy].Rooms.[z].setting.temperature.value | Define temperature |
| tado.[x].[yyyyyy].Rooms.[z].manualControlTermination.controlType | Set time table mode |
| tado.[x].[yyyyyy].Rooms.[z].manualControlTermination.remainingTimeInSeconds | Duration time for timer mode |
| tado.[x].[yyyyyy].Rooms.[z].resumeScheduleRoom | Back to automatic mode for this room |
| tado.[x].[yyyyyy].Rooms.resumeScheduleHome | Back to automatic mode for all rooms |
| tado.[x].[yyyyyy].Rooms.allOff | Switch all rooms of |
| tado.[x].[yyyyyy].Rooms.boost | Switch all rooms to boost mode |

## Requires
* Node.js 18 or higher
* ioBroker host (js-controller) 5.0 or higher
Expand Down
20 changes: 15 additions & 5 deletions lib/state_attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ const state_attrb = {
'type': 'boolean',
'write': true
},
'controlType': {
'name': 'Control Type',
'role': 'state',
'type': 'string',
'write': true,
'states': {
'TIMER': 'Use Timer',
'MANUAL': 'Manual',
'NEXT_TIME_BLOCK': 'Next time block'
}
},
'dazzleMode': {
'name': 'Dazzle Mode',
'role': 'state',
Expand Down Expand Up @@ -573,8 +584,8 @@ const state_attrb = {
'name': 'Power',
'role': 'switch.power',
'states': {
'off': 'off',
'on': 'on'
'OFF': 'Off',
'ON': 'On'
},
'type': 'string',
'unit': '',
Expand Down Expand Up @@ -935,15 +946,14 @@ const state_attrb = {
'type': {
'name': 'Type',
'role': 'state',
'write': true
},
'typeSkillBasedApp': {
'name': 'Type Skill Based App',
'role': 'state',
'states': {
'Manual': 'Permanent',
'Next_Time_Block': 'Next Block',
'Timer': 'Use Timer'
'NEXT_TIME_BLOCK': 'Next Block',
'TIMER': 'Use Timer'
},
'unit': '',
'write': true
Expand Down
24 changes: 20 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Tado extends utils.Adapter {
async onStateChangeTadoX(id, state, homeId, roomId, deviceId, statename, beforeStatename) {
this.log.info(id + ' changed');
const temperature = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.setting.temperature.value');
const mode = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.manualControlTermination.type');
const mode = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.manualControlTermination.controlType');
const power = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.setting.power');
const remainingTimeInSeconds = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.manualControlTermination.remainingTimeInSeconds');
const nextTimeBlockStart = await this.getStateAsync(homeId + '.Rooms.' + roomId + '.nextTimeBlock.start');
Expand Down Expand Up @@ -156,39 +156,48 @@ class Tado extends utils.Adapter {
set_power = 'ON';
await this.setManualControlTadoX(homeId, roomId, set_power, set_temp, set_terminationMode, set_boostMode, set_remainingTimeInSeconds);
break;

case ('boost'):
if (state.val == true) {
await this.setBoostTadoX(homeId);
await jsonExplorer.sleep(1000);
this.create_state(id, 'boost', false);
}
break;

case ('resumeScheduleHome'):
if (state.val == true) {
await this.setResumeHomeScheduleTadoX(homeId);
await jsonExplorer.sleep(1000);
this.create_state(id, 'resumeScheduleHome', false);
}
break;

case ('resumeScheduleRoom'):
if (state.val == true) {
await this.setResumeRoomScheduleTadoX(homeId, roomId);
await jsonExplorer.sleep(1000);
this.create_state(id, 'resumeScheduleRoom', false);
}
break;

case ('allOff'):
if (state.val == true) {
await this.setAllOffTadoX(homeId);
await jsonExplorer.sleep(1000);
this.create_state(id, 'allOff', false);
}
break;

case ('remainingTimeInSeconds'):
set_terminationMode = 'TIMER';
await this.setManualControlTadoX(homeId, roomId, set_power, set_temp, set_terminationMode, set_boostMode, set_remainingTimeInSeconds);
break;
case ('type'):

case ('controlType'):
if (beforeStatename != 'manualControlTermination') {
this.log.warn('Change of ' + id + ' ignored'); break;
}
await this.setManualControlTadoX(homeId, roomId, set_power, set_temp, set_terminationMode, set_boostMode, set_remainingTimeInSeconds);
break;
}
Expand Down Expand Up @@ -1027,6 +1036,7 @@ class Tado extends utils.Adapter {
rooms.allOff = false;

for (const i in roomsAndDevices.rooms) {

if (rooms[i].boostMode == null) {
rooms[i].boostMode = {};
rooms[i].boostMode.type = null;
Expand All @@ -1036,7 +1046,10 @@ class Tado extends utils.Adapter {
rooms[i].manualControlTermination = {};
rooms[i].manualControlTermination.projectedExpiry = null;
rooms[i].manualControlTermination.remainingTimeInSeconds = null;
rooms[i].manualControlTermination.type = null;
rooms[i].manualControlTermination.controlType = null;
} else {
rooms[i].manualControlTermination.controlType = rooms[i].manualControlTermination.type;
delete rooms[i].manualControlTermination.type;
}
}
this.log.info('Modified rooms object is' + JSON.stringify(rooms));
Expand Down Expand Up @@ -1065,7 +1078,10 @@ class Tado extends utils.Adapter {
roomsAndDevices.manualControlTermination = {};
roomsAndDevices.manualControlTermination.projectedExpiry = null;
roomsAndDevices.manualControlTermination.remainingTimeInSeconds = null;
roomsAndDevices.manualControlTermination.type = null;
roomsAndDevices.manualControlTermination.controlType = null;
} else {
roomsAndDevices.manualControlTermination.controlType = roomsAndDevices.manualControlTermination.type;
delete roomsAndDevices.manualControlTermination.type;
}
roomsAndDevices.resumeScheduleRoom = false;
this.log.info('Modified RoomsAndDevices object is ' + JSON.stringify(roomsAndDevices));
Expand Down

0 comments on commit 683f2b4

Please sign in to comment.