Skip to content

Add support to get/set a schedule for a zone#9

Open
mattthewclayton wants to merge 2 commits intochrism0dwk:masterfrom
mattthewclayton:get_set_schedule
Open

Add support to get/set a schedule for a zone#9
mattthewclayton wants to merge 2 commits intochrism0dwk:masterfrom
mattthewclayton:get_set_schedule

Conversation

@mattthewclayton
Copy link

@mattthewclayton mattthewclayton commented May 17, 2019

Add API to get/set a schedule for a zone.
Possible Usecases:

  • Programatically update a zone to different schedules (Summer/Winter, Guest Room with/without guest)
  • Clone schedules across all zones - so multiple rooms can share the same schedule without having to enter them manually in the Tado app.

Example Usage:

from PyTado.PyTado.interface import Tado

t = Tado('user','pass')

## Set Tado in zone 5 to use the THREE_DAY timetable
t.setTimetable(5,Tado.Timetable.THREE_DAY)

## Get the schedule for zone 5,  MONDAY_TO_FRIDAY in the THREE_DAY timetable.
schedule = t.getSchedule(5,Tado.Timetable.THREE_DAY,"MONDAY_TO_FRIDAY")

## Somehow modify the current schedule, i am just setting all temps to 19
for item in schedule:
    item['setting']['temperature']['celsius'] = 19 
    del(item['setting']['temperature']['fahrenheit']) # Just because It would be wrong otherwise

## Tell Tado to apply the new schedule to the "Monday to Friday" day in the THREE_DAY timetable
newSchedule = t.setSchedule(5, Tado.Timetable.THREE_DAY, "MONDAY_TO_FRIDAY", schedule)

## Print out the returned data from the Tado API, which should be the new schedule
print(newSchedule)

@mattthewclayton
Copy link
Author

Added a bit more to allow you to get and set the current timetable mode for a zone (i.e is it THREE_DAY, ONE_DAY or SEVEN_DAY)

Added an enum to make this easier, updated the earlier example to factor this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant