diff --git a/README.md b/README.md index 4178cf7e..c432a8f7 100644 --- a/README.md +++ b/README.md @@ -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 . 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 | @@ -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 diff --git a/lib/state_attr.js b/lib/state_attr.js index bdae4481..f4056b7d 100644 --- a/lib/state_attr.js +++ b/lib/state_attr.js @@ -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', @@ -573,8 +584,8 @@ const state_attrb = { 'name': 'Power', 'role': 'switch.power', 'states': { - 'off': 'off', - 'on': 'on' + 'OFF': 'Off', + 'ON': 'On' }, 'type': 'string', 'unit': '', @@ -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 diff --git a/main.js b/main.js index 26ec98ea..49b1c77c 100644 --- a/main.js +++ b/main.js @@ -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'); @@ -156,6 +156,7 @@ 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); @@ -163,6 +164,7 @@ class Tado extends utils.Adapter { this.create_state(id, 'boost', false); } break; + case ('resumeScheduleHome'): if (state.val == true) { await this.setResumeHomeScheduleTadoX(homeId); @@ -170,6 +172,7 @@ class Tado extends utils.Adapter { this.create_state(id, 'resumeScheduleHome', false); } break; + case ('resumeScheduleRoom'): if (state.val == true) { await this.setResumeRoomScheduleTadoX(homeId, roomId); @@ -177,6 +180,7 @@ class Tado extends utils.Adapter { this.create_state(id, 'resumeScheduleRoom', false); } break; + case ('allOff'): if (state.val == true) { await this.setAllOffTadoX(homeId); @@ -184,11 +188,16 @@ class Tado extends utils.Adapter { 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; } @@ -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; @@ -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)); @@ -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));